Made wxGTK compile and link again. Broke wxMSW a little.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4098 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -12,10 +12,15 @@
|
||||
#ifndef _WX_CLIPBRD_H_BASE_
|
||||
#define _WX_CLIPBRD_H_BASE_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "clipboardbase.h"
|
||||
#endif
|
||||
|
||||
#include "wx/defs.h"
|
||||
|
||||
#if wxUSE_CLIPBOARD
|
||||
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/wxchar.h"
|
||||
|
||||
@@ -33,30 +38,32 @@ class WXDLLEXPORT wxDataObject;
|
||||
class WXDLLEXPORT wxClipboardBase : public wxObject
|
||||
{
|
||||
public:
|
||||
wxClipboardBase();
|
||||
|
||||
// open the clipboard before Add/SetData() and GetData()
|
||||
virtual bool Open();
|
||||
virtual bool Open() = 0;
|
||||
|
||||
// close the clipboard after Add/SetData() and GetData()
|
||||
virtual void Close();
|
||||
virtual void Close() = 0;
|
||||
|
||||
// add to the clipboard data
|
||||
//
|
||||
// NB: the clipboard owns the pointer and will delete it, so data must be
|
||||
// allocated on the heap
|
||||
virtual bool AddData( wxDataObject *data );
|
||||
virtual bool AddData( wxDataObject *data ) = 0;
|
||||
|
||||
// set the clipboard data, this is the same as Clear() followed by
|
||||
// AddData()
|
||||
virtual bool SetData( wxDataObject *data );
|
||||
virtual bool SetData( wxDataObject *data ) = 0;
|
||||
|
||||
// ask if data in correct format is available
|
||||
virtual bool IsSupported( const wxDataFormat& format );
|
||||
virtual bool IsSupported( const wxDataFormat& format ) = 0;
|
||||
|
||||
// fill data with data on the clipboard (if available)
|
||||
virtual bool GetData( wxDataObject& data );
|
||||
|
||||
virtual bool GetData( wxDataObject& data ) = 0;
|
||||
|
||||
// clears wxTheClipboard and the system's clipboard if possible
|
||||
virtual void Clear();
|
||||
virtual void Clear() = 0;
|
||||
|
||||
// flushes the clipboard: this means that the data which is currently on
|
||||
// clipboard will stay available even after the application exits (possibly
|
||||
@@ -104,25 +111,6 @@ public:
|
||||
// The global clipboard object
|
||||
WXDLLEXPORT_DATA(extern wxClipboard *) wxTheClipboard;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxClipboardModule: module responsible for initializing the global clipboard
|
||||
// object
|
||||
//
|
||||
// NB: IMPLEMENT_DYNAMIC_CLASS() for it is in common/appcmn.cpp
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxClipboardModule : public wxModule
|
||||
{
|
||||
public:
|
||||
bool OnInit()
|
||||
{ wxTheClipboard = new wxClipboard; return TRUE; }
|
||||
void OnExit()
|
||||
{ delete wxTheClipboard; wxTheClipboard = (wxClipboard *)NULL; }
|
||||
|
||||
private:
|
||||
DECLARE_DYNAMIC_CLASS(wxClipboardModule)
|
||||
};
|
||||
|
||||
#endif // wxUSE_CLIPBOARD
|
||||
|
||||
#endif // _WX_CLIPBRD_H_BASE_
|
||||
|
@@ -331,7 +331,7 @@ public:
|
||||
virtual wxBitmap GetBitmap() const { return m_bitmap; }
|
||||
virtual void SetBitmap(const wxBitmap& bitmap) { m_bitmap = bitmap; }
|
||||
|
||||
private:
|
||||
protected:
|
||||
wxBitmap m_bitmap;
|
||||
};
|
||||
|
||||
@@ -349,7 +349,7 @@ public:
|
||||
wxFileDataObjectBase() : wxDataObjectSimple(wxDF_FILENAME) { }
|
||||
|
||||
// get a reference to our array
|
||||
const wxArrayString& GetFilenames() { return m_filenames; }
|
||||
const wxArrayString& GetFilenames() const { return m_filenames; }
|
||||
|
||||
// the Get() functions do nothing for us
|
||||
virtual size_t GetDataSize() const { return 0; }
|
||||
|
@@ -44,7 +44,9 @@ public:
|
||||
virtual ~wxDropSourceBase() { }
|
||||
|
||||
// set the data which is transfered by drag and drop
|
||||
void SetData(wxDataObject& data) { delete m_data; m_data = &data; }
|
||||
void SetData(wxDataObject& data)
|
||||
{ if (m_data) delete m_data;
|
||||
m_data = &data; }
|
||||
|
||||
// start drag action, see enum wxDragResult for return value description
|
||||
//
|
||||
@@ -80,7 +82,7 @@ public:
|
||||
// ctor takes a pointer to heap-allocated wxDataObject which will be owned
|
||||
// by wxDropTarget and deleted by it automatically. If you don't give it
|
||||
// here, you can use SetDataObject() later.
|
||||
wxDropTargetBase(wxDataObject *dataObject = NULL)
|
||||
wxDropTargetBase(wxDataObject *dataObject = (wxDataObject*)NULL)
|
||||
{ m_dataObject = dataObject; }
|
||||
// dtor deletes our data object
|
||||
virtual ~wxDropTargetBase()
|
||||
@@ -90,13 +92,23 @@ public:
|
||||
wxDataObject *GetDataObject() const
|
||||
{ return m_dataObject; }
|
||||
void SetDataObject(wxDataObject *dataObject)
|
||||
{ delete m_dataObject; m_dataObject = dataObject; }
|
||||
{ if (m_dataObject) delete m_dataObject;
|
||||
m_dataObject = dataObject; }
|
||||
|
||||
// called when mouse enters/leaves the window: might be used to give
|
||||
// some visual feedback to the user
|
||||
virtual void OnEnter() { }
|
||||
virtual void OnLeave() { }
|
||||
|
||||
// this function is called when data enters over position (x, y) - if it
|
||||
// returns TRUE, the dragging icon can indicate that the window would
|
||||
// accept a drop here
|
||||
virtual bool OnEnter(wxCoord x, wxCoord y) = 0;
|
||||
|
||||
// this function is called when data is move over position (x, y) - if it
|
||||
// returns TRUE, the dragging icon can indicate that the window would
|
||||
// accept a drop here
|
||||
virtual bool OnMove(wxCoord x, wxCoord y) = 0;
|
||||
|
||||
// this function is called when data is dropped at position (x, y) - if it
|
||||
// returns TRUE, OnData() will be called immediately afterwards which will
|
||||
// allow to retrieve the data dropped.
|
||||
|
@@ -20,6 +20,10 @@
|
||||
|
||||
class wxDataObject : public wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
wxDataObject();
|
||||
|
||||
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_DATAOBJ_H_
|
||||
|
@@ -46,7 +46,6 @@ protected:
|
||||
void Clear() { free(m_pngData); }
|
||||
void ClearAll() { Clear(); Init(); }
|
||||
|
||||
private:
|
||||
size_t m_pngSize;
|
||||
void *m_pngData;
|
||||
|
||||
@@ -63,6 +62,8 @@ 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);
|
||||
|
@@ -41,135 +41,40 @@ class wxDropSource;
|
||||
// wxDropTarget
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxDropTarget: public wxObject
|
||||
class wxDropTarget: public wxDropTargetBase
|
||||
{
|
||||
public:
|
||||
wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
|
||||
|
||||
virtual bool OnEnter(wxCoord x, wxCoord y) ;
|
||||
virtual bool OnMove(wxCoord x, wxCoord y);
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y);
|
||||
virtual bool OnData(wxCoord x, wxCoord y);
|
||||
virtual bool GetData();
|
||||
|
||||
wxDropTarget();
|
||||
~wxDropTarget();
|
||||
// implementation
|
||||
|
||||
/* may be overridden to react to events */
|
||||
virtual void OnEnter();
|
||||
virtual void OnLeave();
|
||||
GdkAtom GetMatchingPair();
|
||||
void RegisterWidget( GtkWidget *widget );
|
||||
void UnregisterWidget( GtkWidget *widget );
|
||||
|
||||
/* may be overridden to reject certain formats or drops
|
||||
on certain areas. always returns TRUE by default
|
||||
indicating that you'd accept the data from the drag. */
|
||||
virtual bool OnMove( long x, long y );
|
||||
GdkDragContext *m_dragContext;
|
||||
GtkWidget *m_dragWidget;
|
||||
GtkSelectionData *m_dragData;
|
||||
guint m_dragTime;
|
||||
bool m_firstMotion; /* gdk has no "gdk_drag_enter" event */
|
||||
|
||||
/* has to be overridden to accept a drop event. call
|
||||
IsSupported() to ask which formats are available
|
||||
and then call RequestData() to indicate the format
|
||||
you request. */
|
||||
virtual bool OnDrop( long x, long y );
|
||||
|
||||
/* this gets called once the data has actually arrived. get
|
||||
it with GetData(). this has to be overridden. */
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
/* called from within OnDrop() to request a certain format
|
||||
from the drop event. */
|
||||
bool RequestData( wxDataFormat format );
|
||||
|
||||
/* called to query what formats are available */
|
||||
bool IsSupported( wxDataFormat format );
|
||||
|
||||
/* fill data with data from the dragging source */
|
||||
bool GetData( wxDataObject *data );
|
||||
|
||||
virtual size_t GetFormatCount() const = 0;
|
||||
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
||||
|
||||
// implementation
|
||||
|
||||
void RegisterWidget( GtkWidget *widget );
|
||||
void UnregisterWidget( GtkWidget *widget );
|
||||
|
||||
GdkDragContext *m_dragContext;
|
||||
GtkWidget *m_dragWidget;
|
||||
GtkSelectionData *m_dragData;
|
||||
guint m_dragTime;
|
||||
bool m_firstMotion; /* gdk has no "gdk_drag_enter" event */
|
||||
|
||||
void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
|
||||
void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
|
||||
void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
|
||||
void SetDragTime( guint time ) { m_dragTime = time; }
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxTextDropTarget
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxTextDropTarget: public wxDropTarget
|
||||
{
|
||||
public:
|
||||
|
||||
wxTextDropTarget() {}
|
||||
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
/* you have to override OnDropData to get at the text */
|
||||
virtual bool OnDropText( long x, long y, const wxChar *text ) = 0;
|
||||
|
||||
virtual size_t GetFormatCount() const
|
||||
{ return 1; }
|
||||
virtual wxDataFormat GetFormat(size_t n) const
|
||||
{ return wxDF_TEXT; }
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxPrivateDropTarget
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
class wxPrivateDropTarget: public wxDropTarget
|
||||
{
|
||||
public:
|
||||
|
||||
wxPrivateDropTarget();
|
||||
wxPrivateDropTarget( const wxString &id );
|
||||
|
||||
virtual bool OnMove( long x, long y );
|
||||
virtual bool OnDrop( long x, long y );
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
virtual bool OnDropData( long x, long y, void *data, size_t size ) = 0;
|
||||
|
||||
void SetId( const wxString& id ) { m_id = id; }
|
||||
wxString GetId() { return m_id; }
|
||||
|
||||
private:
|
||||
|
||||
wxString m_id;
|
||||
};
|
||||
*/
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// A drop target which accepts files (dragged from File Manager or Explorer)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class wxFileDropTarget: public wxDropTarget
|
||||
{
|
||||
public:
|
||||
|
||||
wxFileDropTarget() {}
|
||||
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
virtual bool OnDropFiles( long x, long y, size_t nFiles, const wxChar * const aszFiles[] ) = 0;
|
||||
|
||||
virtual size_t GetFormatCount() const
|
||||
{ return 1; }
|
||||
virtual wxDataFormat GetFormat(size_t n) const
|
||||
{ return wxDF_FILENAME; }
|
||||
void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
|
||||
void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
|
||||
void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
|
||||
void SetDragTime( guint time ) { m_dragTime = time; }
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDropSource
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxDropSource: public wxObject
|
||||
class wxDropSource: public wxDropSourceBase
|
||||
{
|
||||
public:
|
||||
/* constructor. set data later with SetData() */
|
||||
|
@@ -20,6 +20,10 @@
|
||||
|
||||
class wxDataObject : public wxDataObjectBase
|
||||
{
|
||||
public:
|
||||
wxDataObject();
|
||||
|
||||
virtual bool IsSupportedFormat( const wxDataFormat& format, Direction dir = Get ) const;
|
||||
};
|
||||
|
||||
#endif // _WX_GTK_DATAOBJ_H_
|
||||
|
@@ -46,7 +46,6 @@ protected:
|
||||
void Clear() { free(m_pngData); }
|
||||
void ClearAll() { Clear(); Init(); }
|
||||
|
||||
private:
|
||||
size_t m_pngSize;
|
||||
void *m_pngData;
|
||||
|
||||
@@ -63,6 +62,8 @@ 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);
|
||||
|
@@ -41,135 +41,40 @@ class wxDropSource;
|
||||
// wxDropTarget
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxDropTarget: public wxObject
|
||||
class wxDropTarget: public wxDropTargetBase
|
||||
{
|
||||
public:
|
||||
wxDropTarget(wxDataObject *dataObject = (wxDataObject*) NULL );
|
||||
|
||||
virtual bool OnEnter(wxCoord x, wxCoord y) ;
|
||||
virtual bool OnMove(wxCoord x, wxCoord y);
|
||||
virtual bool OnDrop(wxCoord x, wxCoord y);
|
||||
virtual bool OnData(wxCoord x, wxCoord y);
|
||||
virtual bool GetData();
|
||||
|
||||
wxDropTarget();
|
||||
~wxDropTarget();
|
||||
// implementation
|
||||
|
||||
/* may be overridden to react to events */
|
||||
virtual void OnEnter();
|
||||
virtual void OnLeave();
|
||||
GdkAtom GetMatchingPair();
|
||||
void RegisterWidget( GtkWidget *widget );
|
||||
void UnregisterWidget( GtkWidget *widget );
|
||||
|
||||
/* may be overridden to reject certain formats or drops
|
||||
on certain areas. always returns TRUE by default
|
||||
indicating that you'd accept the data from the drag. */
|
||||
virtual bool OnMove( long x, long y );
|
||||
GdkDragContext *m_dragContext;
|
||||
GtkWidget *m_dragWidget;
|
||||
GtkSelectionData *m_dragData;
|
||||
guint m_dragTime;
|
||||
bool m_firstMotion; /* gdk has no "gdk_drag_enter" event */
|
||||
|
||||
/* has to be overridden to accept a drop event. call
|
||||
IsSupported() to ask which formats are available
|
||||
and then call RequestData() to indicate the format
|
||||
you request. */
|
||||
virtual bool OnDrop( long x, long y );
|
||||
|
||||
/* this gets called once the data has actually arrived. get
|
||||
it with GetData(). this has to be overridden. */
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
/* called from within OnDrop() to request a certain format
|
||||
from the drop event. */
|
||||
bool RequestData( wxDataFormat format );
|
||||
|
||||
/* called to query what formats are available */
|
||||
bool IsSupported( wxDataFormat format );
|
||||
|
||||
/* fill data with data from the dragging source */
|
||||
bool GetData( wxDataObject *data );
|
||||
|
||||
virtual size_t GetFormatCount() const = 0;
|
||||
virtual wxDataFormat GetFormat(size_t n) const = 0;
|
||||
|
||||
// implementation
|
||||
|
||||
void RegisterWidget( GtkWidget *widget );
|
||||
void UnregisterWidget( GtkWidget *widget );
|
||||
|
||||
GdkDragContext *m_dragContext;
|
||||
GtkWidget *m_dragWidget;
|
||||
GtkSelectionData *m_dragData;
|
||||
guint m_dragTime;
|
||||
bool m_firstMotion; /* gdk has no "gdk_drag_enter" event */
|
||||
|
||||
void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
|
||||
void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
|
||||
void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
|
||||
void SetDragTime( guint time ) { m_dragTime = time; }
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxTextDropTarget
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxTextDropTarget: public wxDropTarget
|
||||
{
|
||||
public:
|
||||
|
||||
wxTextDropTarget() {}
|
||||
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
/* you have to override OnDropData to get at the text */
|
||||
virtual bool OnDropText( long x, long y, const wxChar *text ) = 0;
|
||||
|
||||
virtual size_t GetFormatCount() const
|
||||
{ return 1; }
|
||||
virtual wxDataFormat GetFormat(size_t n) const
|
||||
{ return wxDF_TEXT; }
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxPrivateDropTarget
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
class wxPrivateDropTarget: public wxDropTarget
|
||||
{
|
||||
public:
|
||||
|
||||
wxPrivateDropTarget();
|
||||
wxPrivateDropTarget( const wxString &id );
|
||||
|
||||
virtual bool OnMove( long x, long y );
|
||||
virtual bool OnDrop( long x, long y );
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
virtual bool OnDropData( long x, long y, void *data, size_t size ) = 0;
|
||||
|
||||
void SetId( const wxString& id ) { m_id = id; }
|
||||
wxString GetId() { return m_id; }
|
||||
|
||||
private:
|
||||
|
||||
wxString m_id;
|
||||
};
|
||||
*/
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// A drop target which accepts files (dragged from File Manager or Explorer)
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class wxFileDropTarget: public wxDropTarget
|
||||
{
|
||||
public:
|
||||
|
||||
wxFileDropTarget() {}
|
||||
|
||||
virtual bool OnData( long x, long y );
|
||||
|
||||
virtual bool OnDropFiles( long x, long y, size_t nFiles, const wxChar * const aszFiles[] ) = 0;
|
||||
|
||||
virtual size_t GetFormatCount() const
|
||||
{ return 1; }
|
||||
virtual wxDataFormat GetFormat(size_t n) const
|
||||
{ return wxDF_FILENAME; }
|
||||
void SetDragContext( GdkDragContext *dc ) { m_dragContext = dc; }
|
||||
void SetDragWidget( GtkWidget *w ) { m_dragWidget = w; }
|
||||
void SetDragData( GtkSelectionData *sd ) { m_dragData = sd; }
|
||||
void SetDragTime( guint time ) { m_dragTime = time; }
|
||||
};
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// wxDropSource
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
class wxDropSource: public wxObject
|
||||
class wxDropSource: public wxDropSourceBase
|
||||
{
|
||||
public:
|
||||
/* constructor. set data later with SetData() */
|
||||
|
Reference in New Issue
Block a user