Implemented a simple modality under X11.
Filled wxDataFormat and wxDataObject etc. Added skeleton for X11 clipboard. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14370 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
9
configure
vendored
9
configure
vendored
@@ -19603,12 +19603,6 @@ EOF
|
||||
|
||||
fi
|
||||
|
||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
||||
if test "$wxUSE_X11" = 1; then
|
||||
echo "configure: warning: Clipboard not yet supported under X11... disabled" 1>&2
|
||||
wxUSE_CLIPBOARD=no
|
||||
fi
|
||||
|
||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define wxUSE_CLIPBOARD 1
|
||||
@@ -19620,7 +19614,6 @@ EOF
|
||||
EOF
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
|
||||
if test "$wxUSE_GTK" = 1; then
|
||||
@@ -20509,7 +20502,7 @@ SAMPLES_SUBDIRS="`echo $SAMPLES_SUBDIRS | tr -s ' ' | tr ' ' '\n' | sort | uniq
|
||||
|
||||
|
||||
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
|
||||
echo "configure:20513: checking whether ${MAKE-make} sets \${MAKE}" >&5
|
||||
echo "configure:20506: checking whether ${MAKE-make} sets \${MAKE}" >&5
|
||||
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
|
@@ -4114,19 +4114,12 @@ if test "$wxUSE_IPC" = "yes"; then
|
||||
AC_DEFINE(wxUSE_IPC)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
||||
if test "$wxUSE_X11" = 1; then
|
||||
AC_MSG_WARN([Clipboard not yet supported under X11... disabled])
|
||||
wxUSE_CLIPBOARD=no
|
||||
fi
|
||||
|
||||
if test "$wxUSE_CLIPBOARD" = "yes"; then
|
||||
AC_DEFINE(wxUSE_CLIPBOARD)
|
||||
|
||||
dnl required by clipboard code in configuration check
|
||||
AC_DEFINE(wxUSE_DATAOBJ)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$wxUSE_DRAG_AND_DROP" = "yes" ; then
|
||||
if test "$wxUSE_GTK" = 1; then
|
||||
|
@@ -1186,6 +1186,7 @@ colour.h X11H
|
||||
cursor.h X11H
|
||||
dataform.h X11H
|
||||
dataobj.h X11H
|
||||
dataobj2.h X11H
|
||||
dc.h X11H
|
||||
dcclient.h X11H
|
||||
dcmemory.h X11H
|
||||
|
@@ -460,6 +460,8 @@ private:
|
||||
#else // !__WXMSW__
|
||||
#if defined(__WXGTK__)
|
||||
#include "wx/gtk/dataobj2.h"
|
||||
#elif defined(__WXX11__)
|
||||
#include "wx/x11/dataobj2.h"
|
||||
#elif defined(__WXMAC__)
|
||||
#include "wx/mac/dataobj2.h"
|
||||
#elif defined(__WXPM__)
|
||||
|
@@ -1,39 +1,31 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: clipbrd.h
|
||||
// Purpose: Clipboard functionality.
|
||||
// Author: Julian Smart
|
||||
// Modified by:
|
||||
// Author: Robert Roebling
|
||||
// Created: 17/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart
|
||||
// Copyright: (c) Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_CLIPBRD_H_
|
||||
#define _WX_CLIPBRD_H_
|
||||
#ifndef __X11CLIPBOARDH__
|
||||
#define __X11CLIPBOARDH__
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "clipbrd.h"
|
||||
#pragma interface
|
||||
#endif
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/list.h"
|
||||
#include "wx/dataobj.h"
|
||||
#include "wx/control.h"
|
||||
#include "wx/module.h"
|
||||
|
||||
bool WXDLLEXPORT wxOpenClipboard();
|
||||
bool WXDLLEXPORT wxClipboardOpen();
|
||||
bool WXDLLEXPORT wxCloseClipboard();
|
||||
bool WXDLLEXPORT wxEmptyClipboard();
|
||||
bool WXDLLEXPORT wxIsClipboardFormatAvailable(wxDataFormat dataFormat);
|
||||
bool WXDLLEXPORT wxSetClipboardData(wxDataFormat dataFormat, wxObject *obj, int width = 0, int height = 0);
|
||||
wxObject* WXDLLEXPORT wxGetClipboardData(wxDataFormat dataFormat, long *len = NULL);
|
||||
wxDataFormat WXDLLEXPORT wxEnumClipboardFormats(wxDataFormat dataFormat);
|
||||
wxDataFormat WXDLLEXPORT wxRegisterClipboardFormat(char *formatName);
|
||||
bool WXDLLEXPORT wxGetClipboardFormatName(wxDataFormat dataFormat, char *formatName, int maxCount);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxClipboard
|
||||
//-----------------------------------------------------------------------------
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxClipboard : public wxClipboardBase
|
||||
{
|
||||
@@ -47,16 +39,16 @@ public:
|
||||
// close the clipboard after SetData() and GetData()
|
||||
virtual void Close();
|
||||
|
||||
// opened?
|
||||
virtual bool IsOpened() const { return m_open; }
|
||||
// query whether the clipboard is opened
|
||||
virtual bool IsOpened() const;
|
||||
|
||||
// replaces the data on the clipboard with data
|
||||
// set the clipboard data. all other formats will be deleted.
|
||||
virtual bool SetData( wxDataObject *data );
|
||||
|
||||
// adds data to the clipboard
|
||||
// add to the clipboard data.
|
||||
virtual bool AddData( wxDataObject *data );
|
||||
|
||||
// format available on the clipboard ?
|
||||
// ask if data in correct format is available
|
||||
virtual bool IsSupported( const wxDataFormat& format );
|
||||
|
||||
// fill data with data on the clipboard (if available)
|
||||
@@ -65,20 +57,32 @@ public:
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
|
||||
// If primary == TRUE, use primary selection in all further ops,
|
||||
// primary == FALSE resets it.
|
||||
virtual void UsePrimarySelection(bool primary = TRUE)
|
||||
{ m_usePrimary = primary; }
|
||||
|
||||
// implementation from now on
|
||||
|
||||
bool m_open;
|
||||
wxList m_data;
|
||||
bool m_ownsClipboard;
|
||||
bool m_ownsPrimarySelection;
|
||||
wxDataObject *m_data;
|
||||
|
||||
WXWindow m_clipboardWidget; /* for getting and offering data */
|
||||
WXWindow m_targetsWidget; /* for getting list of supported formats */
|
||||
bool m_waiting; /* querying data or formats is asynchronous */
|
||||
|
||||
bool m_formatSupported;
|
||||
Atom m_targetRequested;
|
||||
bool m_usePrimary;
|
||||
wxDataObject *m_receivedData;
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxClipboard)
|
||||
};
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
#endif
|
||||
// wxUSE_CLIPBOARD
|
||||
|
||||
#endif
|
||||
// _WX_CLIPBRD_H_
|
||||
// __X11CLIPBOARDH__
|
||||
|
@@ -9,8 +9,8 @@
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MOTIF_DATAFORM_H
|
||||
#define _WX_MOTIF_DATAFORM_H
|
||||
#ifndef _WX_X11_DATAFORM_H
|
||||
#define _WX_X11_DATAFORM_H
|
||||
|
||||
class wxDataFormat
|
||||
{
|
||||
@@ -62,5 +62,5 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_MOTIF_DATAFORM_H
|
||||
#endif // _WX_X11_DATAFORM_H
|
||||
|
||||
|
@@ -3,12 +3,12 @@
|
||||
// Purpose: declaration of the wxDataObject class for Motif
|
||||
// Author: Julian Smart
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 Julian Smart
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_MOTIF_DATAOBJ_H_
|
||||
#define _WX_MOTIF_DATAOBJ_H_
|
||||
#ifndef _WX_X11_DATAOBJ_H_
|
||||
#define _WX_X11_DATAOBJ_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dataobj.h"
|
||||
@@ -21,10 +21,14 @@
|
||||
class wxDataObject : public wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
wxDataObject();
|
||||
|
||||
#ifdef __DARWIN__
|
||||
~wxDataObject() { }
|
||||
#endif
|
||||
|
||||
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
|
||||
};
|
||||
|
||||
#endif //_WX_MOTIF_DATAOBJ_H_
|
||||
#endif //_WX_X11_DATAOBJ_H_
|
||||
|
||||
|
89
include/wx/x11/dataobj2.h
Normal file
89
include/wx/x11/dataobj2.h
Normal file
@@ -0,0 +1,89 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: gtk/dataobj2.h
|
||||
// Purpose: declaration of standard wxDataObjectSimple-derived classes
|
||||
// Author: Robert Roebling
|
||||
// Created: 19.10.99 (extracted from gtk/dataobj.h)
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998, 1999 Vadim Zeitlin, Robert Roebling
|
||||
// Licence: wxWindows license
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_X11_DATAOBJ2_H_
|
||||
#define _WX_X11_DATAOBJ2_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "dataobj.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxBitmapDataObject is a specialization of wxDataObject for bitmaps
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxBitmapDataObject : public wxBitmapDataObjectBase
|
||||
{
|
||||
public:
|
||||
// ctors
|
||||
wxBitmapDataObject();
|
||||
wxBitmapDataObject(const wxBitmap& bitmap);
|
||||
|
||||
// destr
|
||||
~wxBitmapDataObject();
|
||||
|
||||
// override base class virtual to update PNG data too
|
||||
virtual void SetBitmap(const wxBitmap& bitmap);
|
||||
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
virtual size_t GetDataSize() const { return m_pngSize; }
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
|
||||
protected:
|
||||
void Init() { m_pngData = (void *)NULL; m_pngSize = 0; }
|
||||
void Clear() { free(m_pngData); }
|
||||
void ClearAll() { Clear(); Init(); }
|
||||
|
||||
size_t m_pngSize;
|
||||
void *m_pngData;
|
||||
|
||||
void DoConvertToPng();
|
||||
|
||||
private:
|
||||
// virtual function hiding supression
|
||||
size_t GetDataSize(const wxDataFormat& format) const
|
||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileDataObject is a specialization of wxDataObject for file names
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxFileDataObject : public wxFileDataObjectBase
|
||||
{
|
||||
public:
|
||||
// implement base class pure virtuals
|
||||
// ----------------------------------
|
||||
|
||||
void AddFile( const wxString &filename );
|
||||
|
||||
virtual size_t GetDataSize() const;
|
||||
virtual bool GetDataHere(void *buf) const;
|
||||
virtual bool SetData(size_t len, const void *buf);
|
||||
|
||||
private:
|
||||
// virtual function hiding supression
|
||||
size_t GetDataSize(const wxDataFormat& format) const
|
||||
{ return(wxDataObjectSimple::GetDataSize(format)); }
|
||||
bool GetDataHere(const wxDataFormat& format, void* pBuf) const
|
||||
{ return(wxDataObjectSimple::GetDataHere(format, pBuf)); }
|
||||
bool SetData(const wxDataFormat& format, size_t nLen, const void* pBuf)
|
||||
{ return(wxDataObjectSimple::SetData(format, nLen, pBuf)); }
|
||||
};
|
||||
|
||||
#endif // _WX_X11_DATAOBJ2_H_
|
||||
|
@@ -174,9 +174,6 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
|
||||
|
||||
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
char *test = NULL;
|
||||
*test = 0;
|
||||
|
||||
// TRUE is to force the frame to close
|
||||
Close(TRUE);
|
||||
}
|
||||
|
@@ -435,7 +435,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
wxKeyEvent keyEvent(wxEVT_KEY_DOWN);
|
||||
wxTranslateKeyEvent(keyEvent, win, window, event);
|
||||
|
||||
wxLogDebug( "OnKey from %s", win->GetName().c_str() );
|
||||
// wxLogDebug( "OnKey from %s", win->GetName().c_str() );
|
||||
|
||||
// We didn't process wxEVT_KEY_DOWN, so send
|
||||
// wxEVT_CHAR
|
||||
@@ -599,13 +599,19 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
if (!win->IsEnabled())
|
||||
return;
|
||||
|
||||
#if 1
|
||||
// Here we check if the top level window is
|
||||
// disabled, which is one aspect of modality.
|
||||
wxWindow *tlw = win;
|
||||
while (tlw && !tlw->IsTopLevel())
|
||||
tlw = tlw->GetParent();
|
||||
if (tlw && !tlw->IsEnabled())
|
||||
return;
|
||||
|
||||
if (event->type == ButtonPress)
|
||||
{
|
||||
if ((win != wxWindow::FindFocus()) && win->AcceptsFocus())
|
||||
win->SetFocus();
|
||||
}
|
||||
#endif
|
||||
|
||||
wxMouseEvent wxevent;
|
||||
wxTranslateMouseEvent(wxevent, win, window, event);
|
||||
@@ -618,7 +624,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
if (win && event->xfocus.detail != NotifyPointer)
|
||||
#endif
|
||||
{
|
||||
wxLogDebug( "FocusIn from %s", win->GetName().c_str() );
|
||||
// wxLogDebug( "FocusIn from %s", win->GetName().c_str() );
|
||||
|
||||
wxFocusEvent focusEvent(wxEVT_SET_FOCUS, win->GetId());
|
||||
focusEvent.SetEventObject(win);
|
||||
@@ -632,7 +638,7 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
||||
if (win && event->xfocus.detail != NotifyPointer)
|
||||
#endif
|
||||
{
|
||||
wxLogDebug( "FocusOut from %s", win->GetName().c_str() );
|
||||
// wxLogDebug( "FocusOut from %s", win->GetName().c_str() );
|
||||
|
||||
wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId());
|
||||
focusEvent.SetEventObject(win);
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -120,8 +120,6 @@ const char *wxGetTextFromUserPromptStr = "Input Text";
|
||||
const char *wxMessageBoxCaptionStr = "Message";
|
||||
const char *wxFileSelectorPromptStr = "Select a file";
|
||||
const char *wxFileSelectorDefaultWildcardStr = "*.*";
|
||||
const char *wxInternalErrorStr = "wxWindows Internal Error";
|
||||
const char *wxFatalErrorStr = "wxWindows Fatal Error";
|
||||
const char *wxDirDialogNameStr = "wxDirCtrl";
|
||||
const char *wxDirDialogDefaultFolderStr = "/";
|
||||
const wxChar *wxTreeCtrlNameStr = wxT("wxTreeCtrl");
|
||||
|
@@ -13,17 +13,11 @@
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
|
||||
#include "wx/dataobj.h"
|
||||
#include "wx/mstream.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/image.h"
|
||||
|
||||
#ifdef __VMS__
|
||||
#pragma message disable nosimpint
|
||||
#endif
|
||||
#ifdef __VMS__
|
||||
#pragma message enable nosimpint
|
||||
#endif
|
||||
#include "wx/utils.h"
|
||||
#include "wx/x11/private.h"
|
||||
|
||||
@@ -142,59 +136,237 @@ void wxDataFormat::PrepareFormats()
|
||||
if (!g_pngAtom)
|
||||
g_pngAtom = XInternAtom( (Display*) wxGetDisplay(), "image/png", FALSE );
|
||||
if (!g_fileAtom)
|
||||
g_fileAtom = XInternAtom( (Display*) wxGetDisplay(), "file:ALL", FALSE );
|
||||
g_fileAtom = XInternAtom( (Display*) wxGetDisplay(), "text/uri-list", FALSE );
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDataObject
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
wxDataObject::wxDataObject()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxDataObject::IsSupportedFormat(const wxDataFormat& format, Direction dir) const
|
||||
{
|
||||
size_t nFormatCount = GetFormatCount(dir);
|
||||
if ( nFormatCount == 1 )
|
||||
{
|
||||
return format == GetPreferredFormat();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxDataFormat *formats = new wxDataFormat[nFormatCount];
|
||||
GetAllFormats(formats,dir);
|
||||
|
||||
size_t n;
|
||||
for ( n = 0; n < nFormatCount; n++ )
|
||||
{
|
||||
if ( formats[n] == format )
|
||||
break;
|
||||
}
|
||||
|
||||
delete [] formats;
|
||||
|
||||
// found?
|
||||
return n < nFormatCount;
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFileDataObject
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxFileDataObject::GetDataHere(void *buf) const
|
||||
{
|
||||
wxString filenames;
|
||||
|
||||
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||
{
|
||||
filenames += m_filenames[i];
|
||||
filenames += (wxChar) 0;
|
||||
}
|
||||
|
||||
memcpy( buf, filenames.mbc_str(), filenames.Len() + 1 );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
size_t wxFileDataObject::GetDataSize() const
|
||||
{
|
||||
size_t res = 0;
|
||||
|
||||
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||
{
|
||||
res += m_filenames[i].Len();
|
||||
res += 1;
|
||||
}
|
||||
|
||||
return res + 1;
|
||||
}
|
||||
|
||||
bool wxFileDataObject::SetData(size_t WXUNUSED(size), const void *buf)
|
||||
{
|
||||
// VZ: old format
|
||||
#if 0
|
||||
// filenames are stores as a string with #0 as deliminators
|
||||
const char *filenames = (const char*) buf;
|
||||
size_t pos = 0;
|
||||
for(;;)
|
||||
{
|
||||
if (filenames[0] == 0)
|
||||
break;
|
||||
if (pos >= size)
|
||||
break;
|
||||
wxString file( filenames ); // this returns the first file
|
||||
AddFile( file );
|
||||
pos += file.Len()+1;
|
||||
filenames += file.Len()+1;
|
||||
}
|
||||
#else // 1
|
||||
m_filenames.Empty();
|
||||
|
||||
// the text/uri-list format is a sequence of URIs (filenames prefixed by
|
||||
// "file:" as far as I see) delimited by "\r\n" of total length size
|
||||
// (I wonder what happens if the file has '\n' in its filename??)
|
||||
wxString filename;
|
||||
for ( const char *p = (const char *)buf; ; p++ )
|
||||
{
|
||||
// some broken programs (testdnd GTK+ sample!) omit the trailing
|
||||
// "\r\n", so check for '\0' explicitly here instead of doing it in
|
||||
// the loop statement to account for it
|
||||
if ( (*p == '\r' && *(p+1) == '\n') || !*p )
|
||||
{
|
||||
size_t lenPrefix = 5; // strlen("file:")
|
||||
if ( filename.Left(lenPrefix).MakeLower() == _T("file:") )
|
||||
{
|
||||
// sometimes the syntax is "file:filename", sometimes it's
|
||||
// URL-like: "file://filename" - deal with both
|
||||
if ( filename[lenPrefix] == _T('/') &&
|
||||
filename[lenPrefix + 1] == _T('/') )
|
||||
{
|
||||
// skip the slashes
|
||||
lenPrefix += 2;
|
||||
}
|
||||
|
||||
AddFile(filename.c_str() + lenPrefix);
|
||||
filename.Empty();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug(_T("Unsupported URI '%s' in wxFileDataObject"),
|
||||
filename.c_str());
|
||||
}
|
||||
|
||||
if ( !*p )
|
||||
break;
|
||||
|
||||
// skip '\r'
|
||||
p++;
|
||||
}
|
||||
else
|
||||
{
|
||||
filename += *p;
|
||||
}
|
||||
}
|
||||
#endif // 0/1
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxFileDataObject::AddFile( const wxString &filename )
|
||||
{
|
||||
m_filenames.Add( filename );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxPrivateDataObject
|
||||
// wxBitmapDataObject
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS( wxPrivateDataObject, wxDataObject )
|
||||
|
||||
void wxPrivateDataObject::Free()
|
||||
wxBitmapDataObject::wxBitmapDataObject()
|
||||
{
|
||||
if ( m_data )
|
||||
free(m_data);
|
||||
Init();
|
||||
}
|
||||
|
||||
wxPrivateDataObject::wxPrivateDataObject()
|
||||
wxBitmapDataObject::wxBitmapDataObject( const wxBitmap& bitmap )
|
||||
: wxBitmapDataObjectBase(bitmap)
|
||||
{
|
||||
wxString id = wxT("application/");
|
||||
id += wxTheApp->GetAppName();
|
||||
Init();
|
||||
|
||||
m_format.SetId( id );
|
||||
|
||||
m_size = 0;
|
||||
m_data = (void *)NULL;
|
||||
DoConvertToPng();
|
||||
}
|
||||
|
||||
void wxPrivateDataObject::SetData( const void *data, size_t size )
|
||||
wxBitmapDataObject::~wxBitmapDataObject()
|
||||
{
|
||||
Free();
|
||||
|
||||
m_size = size;
|
||||
m_data = malloc(size);
|
||||
|
||||
memcpy( m_data, data, size );
|
||||
Clear();
|
||||
}
|
||||
|
||||
void wxPrivateDataObject::WriteData( void *dest ) const
|
||||
void wxBitmapDataObject::SetBitmap( const wxBitmap &bitmap )
|
||||
{
|
||||
WriteData( m_data, dest );
|
||||
ClearAll();
|
||||
|
||||
wxBitmapDataObjectBase::SetBitmap(bitmap);
|
||||
|
||||
DoConvertToPng();
|
||||
}
|
||||
|
||||
size_t wxPrivateDataObject::GetSize() const
|
||||
bool wxBitmapDataObject::GetDataHere(void *buf) const
|
||||
{
|
||||
return m_size;
|
||||
if ( !m_pngSize )
|
||||
{
|
||||
wxFAIL_MSG( wxT("attempt to copy empty bitmap failed") );
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxPrivateDataObject::WriteData( const void *data, void *dest ) const
|
||||
{
|
||||
memcpy( dest, data, GetSize() );
|
||||
memcpy(buf, m_pngData, m_pngSize);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // 0
|
||||
bool wxBitmapDataObject::SetData(size_t size, const void *buf)
|
||||
{
|
||||
Clear();
|
||||
|
||||
#if wxUSE_LIBPNG
|
||||
m_pngSize = size;
|
||||
m_pngData = malloc(m_pngSize);
|
||||
|
||||
memcpy( m_pngData, buf, m_pngSize );
|
||||
|
||||
wxMemoryInputStream mstream( (char*) m_pngData, m_pngSize );
|
||||
wxImage image;
|
||||
wxPNGHandler handler;
|
||||
if ( !handler.LoadFile( &image, mstream ) )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_bitmap = image.ConvertToBitmap();
|
||||
|
||||
return m_bitmap.Ok();
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxBitmapDataObject::DoConvertToPng()
|
||||
{
|
||||
#if wxUSE_LIBPNG
|
||||
if (!m_bitmap.Ok())
|
||||
return;
|
||||
|
||||
wxImage image( m_bitmap );
|
||||
wxPNGHandler handler;
|
||||
|
||||
wxCountingOutputStream count;
|
||||
handler.SaveFile( &image, count );
|
||||
|
||||
m_pngSize = count.GetSize() + 100; // sometimes the size seems to vary ???
|
||||
m_pngData = malloc(m_pngSize);
|
||||
|
||||
wxMemoryOutputStream mstream( (char*) m_pngData, m_pngSize );
|
||||
handler.SaveFile( &image, mstream );
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
@@ -473,6 +473,7 @@ ALL_HEADERS = \
|
||||
x11/cursor.h \
|
||||
x11/dataform.h \
|
||||
x11/dataobj.h \
|
||||
x11/dataobj2.h \
|
||||
x11/dc.h \
|
||||
x11/dcclient.h \
|
||||
x11/dcmemory.h \
|
||||
|
@@ -447,14 +447,14 @@ bool wxSetWMDecorations(Window w, long style)
|
||||
|
||||
if (style & wxRESIZE_BORDER)
|
||||
{
|
||||
wxLogDebug("MWM_DECOR_RESIZEH");
|
||||
// wxLogDebug("MWM_DECOR_RESIZEH");
|
||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||
hints.decorations |= MWM_DECOR_RESIZEH;
|
||||
}
|
||||
|
||||
if (style & wxSYSTEM_MENU)
|
||||
{
|
||||
wxLogDebug("MWM_DECOR_MENU");
|
||||
// wxLogDebug("MWM_DECOR_MENU");
|
||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||
hints.decorations |= MWM_DECOR_MENU;
|
||||
}
|
||||
@@ -463,28 +463,28 @@ bool wxSetWMDecorations(Window w, long style)
|
||||
(style & wxTINY_CAPTION_HORIZ) ||
|
||||
(style & wxTINY_CAPTION_VERT))
|
||||
{
|
||||
wxLogDebug("MWM_DECOR_TITLE");
|
||||
// wxLogDebug("MWM_DECOR_TITLE");
|
||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||
hints.decorations |= MWM_DECOR_TITLE;
|
||||
}
|
||||
|
||||
if ((style & wxTHICK_FRAME) || (style & wxSIMPLE_BORDER) || (style & wxCAPTION))
|
||||
{
|
||||
wxLogDebug("MWM_DECOR_BORDER");
|
||||
// wxLogDebug("MWM_DECOR_BORDER");
|
||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||
hints.decorations |= MWM_DECOR_BORDER;
|
||||
}
|
||||
|
||||
if (style & wxMINIMIZE_BOX)
|
||||
{
|
||||
wxLogDebug("MWM_DECOR_MINIMIZE");
|
||||
// wxLogDebug("MWM_DECOR_MINIMIZE");
|
||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||
hints.decorations |= MWM_DECOR_MINIMIZE;
|
||||
}
|
||||
|
||||
if (style & wxMAXIMIZE_BOX)
|
||||
{
|
||||
wxLogDebug("MWM_DECOR_MAXIMIZE");
|
||||
// wxLogDebug("MWM_DECOR_MAXIMIZE");
|
||||
hints.flags |= MWM_HINTS_DECORATIONS;
|
||||
hints.decorations |= MWM_DECOR_MAXIMIZE;
|
||||
}
|
||||
@@ -585,14 +585,11 @@ void wxTopLevelWindowX11::DoSetClientSize(int width, int height)
|
||||
|
||||
void wxTopLevelWindowX11::DoSetSize(int x, int y, int width, int height, int sizeFlags)
|
||||
{
|
||||
wxString msg;
|
||||
msg.Printf("Setting pos: %d, %d", x, y);
|
||||
wxLogDebug(msg);
|
||||
wxLogDebug( "Setting pos: %d, %d", x, y );
|
||||
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
||||
|
||||
wxPoint pt = GetPosition();
|
||||
msg.Printf("After, pos: %d, %d", pt.x, pt.y);
|
||||
wxLogDebug(msg);
|
||||
wxLogDebug( "After, pos: %d, %d", pt.x, pt.y );
|
||||
#if 0
|
||||
XSync(wxGlobalDisplay(), False);
|
||||
int w, h;
|
||||
@@ -655,9 +652,7 @@ void wxTopLevelWindowX11::DoGetPosition(int *x, int *y) const
|
||||
XTranslateCoordinates(wxGlobalDisplay(), window, XDefaultRootWindow(wxGlobalDisplay()),
|
||||
0, 0, & offsetX, & offsetY, & childWindow);
|
||||
|
||||
wxString msg;
|
||||
msg.Printf("Offset: %d, %d", offsetX, offsetY);
|
||||
wxLogDebug(msg);
|
||||
wxLogDebug("Offset: %d, %d", offsetX, offsetY);
|
||||
#endif
|
||||
|
||||
XWindowAttributes attr;
|
||||
|
@@ -383,7 +383,7 @@ void wxWindowX11::DoCaptureMouse()
|
||||
return;
|
||||
}
|
||||
|
||||
wxLogDebug("Grabbed pointer in %s", GetName().c_str() );
|
||||
// wxLogDebug("Grabbed pointer in %s", GetName().c_str() );
|
||||
|
||||
#if 0
|
||||
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
||||
@@ -443,7 +443,7 @@ void wxWindowX11::DoReleaseMouse()
|
||||
#endif
|
||||
}
|
||||
|
||||
wxLogDebug( "Ungrabbed pointer in %s", GetName().c_str() );
|
||||
// wxLogDebug( "Ungrabbed pointer in %s", GetName().c_str() );
|
||||
|
||||
m_winCaptured = FALSE;
|
||||
}
|
||||
|
Reference in New Issue
Block a user