--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: clipboard.h
+// Purpose:
+// Author: Robert Roebling
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __GTKCLIPBOARDH__
+#define __GTKCLIPBOARDH__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/control.h"
+#include "wx/dnd.h" // for wxDataObject
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class wxClipboard;
+
+//-----------------------------------------------------------------------------
+// global functions
+//-----------------------------------------------------------------------------
+
+void wxInitClipboard();
+void wxDoneClipboard();
+
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern wxClipboard* wxTheClipboard;
+
+//-----------------------------------------------------------------------------
+// wxClipboard
+//-----------------------------------------------------------------------------
+
+class wxClipboard: public wxObject
+{
+ DECLARE_DYNAMIC_CLASS(wxClipboard)
+
+public:
+
+ wxClipboard();
+ ~wxClipboard();
+
+ virtual void SetData( wxDataObject *data );
+ virtual void *GetData( wxDataFormat format, size_t *length );
+ virtual bool IsAvailable( wxDataFormat format );
+
+ // implementation
+
+ wxDataObject *m_data;
+ char *m_sentString,
+ *m_receivedString;
+ void *m_receivedTargets;
+ size_t m_receivedLength;
+ GtkWidget *m_clipboardWidget;
+};
+
+#endif
+ // __GTKCLIPBOARDH__
class wxDataObject: public wxObject
{
public:
- // all data formats (values are the same as in windows.h, do not change!)
- enum StdFormat
- {
- Invalid,
- Text,
- Bitmap,
- MetafilePict,
- Sylk,
- Dif,
- Tiff,
- OemText,
- Dib,
- Palette,
- Pendata,
- Riff,
- Wave,
- UnicodeText,
- EnhMetafile,
- Hdrop,
- Locale,
- Max
- };
-
- // function to return symbolic name of clipboard format (debug messages)
- static const char *GetFormatName(wxDataFormat format);
-
- // ctor & dtor
+
wxDataObject() {};
~wxDataObject() {};
- // pure virtuals to override
- // get the best suited format for our data
virtual wxDataFormat GetPreferredFormat() const = 0;
- // decide if we support this format (should be one of values of
- // StdFormat enumerations or a user-defined format)
- virtual bool IsSupportedFormat(wxDataFormat format) const = 0;
- // get the (total) size of data
+ virtual bool IsSupportedFormat( wxDataFormat format ) const = 0;
virtual size_t GetDataSize() const = 0;
- // copy raw data to provided pointer
- virtual void GetDataHere(void *pBuf) const = 0;
+ virtual void GetDataHere( void *data ) const = 0;
};
class wxTextDataObject : public wxDataObject
{
public:
- // ctors
+
wxTextDataObject() { }
wxTextDataObject(const wxString& strText) : m_strText(strText) { }
void Init(const wxString& strText) { m_strText = strText; }
- // implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_TEXT; }
+
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDF_TEXT; }
+
virtual size_t GetDataSize() const
- { return m_strText.Len() + 1; } // +1 for trailing '\0'of course
- virtual void GetDataHere(void *pBuf) const
- { memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
+ { return m_strText.Len() + 1; } // +1 for trailing '\0'
+
+ virtual void GetDataHere( void *data ) const
+ { memcpy(data, m_strText.c_str(), GetDataSize()); }
private:
wxString m_strText;
void AddFile( const wxString &file )
{ m_files += file; m_files += '\0'; }
- // implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_FILENAME; }
- virtual bool IsSupportedFormat(wxDataFormat format) const
+
+ virtual bool IsSupportedFormat( wxDataFormat format ) const
{ return format == wxDF_FILENAME; }
+
virtual size_t GetDataSize() const
{ return m_files.Len(); } // no trailing '\0'
- virtual void GetDataHere(void *pBuf) const
- { memcpy(pBuf, m_files.c_str(), GetDataSize()); }
+
+ virtual void GetDataHere( void *data ) const
+ { memcpy(data, m_files.c_str(), GetDataSize()); }
private:
wxString m_files;
virtual void OnEnter() { }
virtual void OnLeave() { }
- virtual bool OnDrop( long x, long y, const void *pData ) = 0;
+ virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0;
- // implementation
-
- int m_size;
-
// Override these to indicate what kind of data you support:
virtual size_t GetFormatCount() const = 0;
virtual wxDataFormat GetFormat(size_t n) const = 0;
- void Drop( GdkEventDropDataAvailable *event, int x, int y );
+ // implementation
+
void RegisterWidget( GtkWidget *widget );
void UnregisterWidget( GtkWidget *widget );
};
public:
wxTextDropTarget() {};
- virtual bool OnDrop( long x, long y, const void *pData );
+ virtual bool OnDrop( long x, long y, const void *data, size_t size );
virtual bool OnDropText( long x, long y, const char *psz );
protected:
wxFileDropTarget() {};
- virtual bool OnDrop(long x, long y, const void *pData);
+ virtual bool OnDrop( long x, long y, const void *data, size_t size );
virtual bool OnDropFiles( long x, long y,
- size_t nFiles, const char * const aszFiles[]);
+ size_t nFiles, const char * const aszFiles[] );
protected:
// wxDropSource
//-------------------------------------------------------------------------
- enum wxDragResult
- {
- wxDragError, // error prevented the d&d operation from completing
- wxDragNone, // drag target didn't accept the data
- wxDragCopy, // the data was successfully copied
- wxDragMove, // the data was successfully moved
- wxDragCancel // the operation was cancelled by user (not an error)
- };
+enum wxDragResult
+{
+ wxDragError, // error prevented the d&d operation from completing
+ wxDragNone, // drag target didn't accept the data
+ wxDragCopy, // the data was successfully copied
+ wxDragMove, // the data was successfully moved
+ wxDragCancel // the operation was cancelled by user (not an error)
+};
class wxDropSource: public wxObject
{
wxDragResult DoDragDrop( bool bAllowMove = FALSE );
virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; };
-
- protected:
-
- friend void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source );
+ // implementation
+
void RegisterWindow(void);
void UnregisterWindow(void);
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: clipboard.h
+// Purpose:
+// Author: Robert Roebling
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef __GTKCLIPBOARDH__
+#define __GTKCLIPBOARDH__
+
+#ifdef __GNUG__
+#pragma interface
+#endif
+
+#include "wx/defs.h"
+#include "wx/object.h"
+#include "wx/list.h"
+#include "wx/control.h"
+#include "wx/dnd.h" // for wxDataObject
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class wxClipboard;
+
+//-----------------------------------------------------------------------------
+// global functions
+//-----------------------------------------------------------------------------
+
+void wxInitClipboard();
+void wxDoneClipboard();
+
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern wxClipboard* wxTheClipboard;
+
+//-----------------------------------------------------------------------------
+// wxClipboard
+//-----------------------------------------------------------------------------
+
+class wxClipboard: public wxObject
+{
+ DECLARE_DYNAMIC_CLASS(wxClipboard)
+
+public:
+
+ wxClipboard();
+ ~wxClipboard();
+
+ virtual void SetData( wxDataObject *data );
+ virtual void *GetData( wxDataFormat format, size_t *length );
+ virtual bool IsAvailable( wxDataFormat format );
+
+ // implementation
+
+ wxDataObject *m_data;
+ char *m_sentString,
+ *m_receivedString;
+ void *m_receivedTargets;
+ size_t m_receivedLength;
+ GtkWidget *m_clipboardWidget;
+};
+
+#endif
+ // __GTKCLIPBOARDH__
class wxDataObject: public wxObject
{
public:
- // all data formats (values are the same as in windows.h, do not change!)
- enum StdFormat
- {
- Invalid,
- Text,
- Bitmap,
- MetafilePict,
- Sylk,
- Dif,
- Tiff,
- OemText,
- Dib,
- Palette,
- Pendata,
- Riff,
- Wave,
- UnicodeText,
- EnhMetafile,
- Hdrop,
- Locale,
- Max
- };
-
- // function to return symbolic name of clipboard format (debug messages)
- static const char *GetFormatName(wxDataFormat format);
-
- // ctor & dtor
+
wxDataObject() {};
~wxDataObject() {};
- // pure virtuals to override
- // get the best suited format for our data
virtual wxDataFormat GetPreferredFormat() const = 0;
- // decide if we support this format (should be one of values of
- // StdFormat enumerations or a user-defined format)
- virtual bool IsSupportedFormat(wxDataFormat format) const = 0;
- // get the (total) size of data
+ virtual bool IsSupportedFormat( wxDataFormat format ) const = 0;
virtual size_t GetDataSize() const = 0;
- // copy raw data to provided pointer
- virtual void GetDataHere(void *pBuf) const = 0;
+ virtual void GetDataHere( void *data ) const = 0;
};
class wxTextDataObject : public wxDataObject
{
public:
- // ctors
+
wxTextDataObject() { }
wxTextDataObject(const wxString& strText) : m_strText(strText) { }
void Init(const wxString& strText) { m_strText = strText; }
- // implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_TEXT; }
+
virtual bool IsSupportedFormat(wxDataFormat format) const
{ return format == wxDF_TEXT; }
+
virtual size_t GetDataSize() const
- { return m_strText.Len() + 1; } // +1 for trailing '\0'of course
- virtual void GetDataHere(void *pBuf) const
- { memcpy(pBuf, m_strText.c_str(), GetDataSize()); }
+ { return m_strText.Len() + 1; } // +1 for trailing '\0'
+
+ virtual void GetDataHere( void *data ) const
+ { memcpy(data, m_strText.c_str(), GetDataSize()); }
private:
wxString m_strText;
void AddFile( const wxString &file )
{ m_files += file; m_files += '\0'; }
- // implement base class pure virtuals
virtual wxDataFormat GetPreferredFormat() const
{ return wxDF_FILENAME; }
- virtual bool IsSupportedFormat(wxDataFormat format) const
+
+ virtual bool IsSupportedFormat( wxDataFormat format ) const
{ return format == wxDF_FILENAME; }
+
virtual size_t GetDataSize() const
{ return m_files.Len(); } // no trailing '\0'
- virtual void GetDataHere(void *pBuf) const
- { memcpy(pBuf, m_files.c_str(), GetDataSize()); }
+
+ virtual void GetDataHere( void *data ) const
+ { memcpy(data, m_files.c_str(), GetDataSize()); }
private:
wxString m_files;
virtual void OnEnter() { }
virtual void OnLeave() { }
- virtual bool OnDrop( long x, long y, const void *pData ) = 0;
+ virtual bool OnDrop( long x, long y, const void *data, size_t size ) = 0;
- // implementation
-
- int m_size;
-
// Override these to indicate what kind of data you support:
virtual size_t GetFormatCount() const = 0;
virtual wxDataFormat GetFormat(size_t n) const = 0;
- void Drop( GdkEventDropDataAvailable *event, int x, int y );
+ // implementation
+
void RegisterWidget( GtkWidget *widget );
void UnregisterWidget( GtkWidget *widget );
};
public:
wxTextDropTarget() {};
- virtual bool OnDrop( long x, long y, const void *pData );
+ virtual bool OnDrop( long x, long y, const void *data, size_t size );
virtual bool OnDropText( long x, long y, const char *psz );
protected:
wxFileDropTarget() {};
- virtual bool OnDrop(long x, long y, const void *pData);
+ virtual bool OnDrop( long x, long y, const void *data, size_t size );
virtual bool OnDropFiles( long x, long y,
- size_t nFiles, const char * const aszFiles[]);
+ size_t nFiles, const char * const aszFiles[] );
protected:
// wxDropSource
//-------------------------------------------------------------------------
- enum wxDragResult
- {
- wxDragError, // error prevented the d&d operation from completing
- wxDragNone, // drag target didn't accept the data
- wxDragCopy, // the data was successfully copied
- wxDragMove, // the data was successfully moved
- wxDragCancel // the operation was cancelled by user (not an error)
- };
+enum wxDragResult
+{
+ wxDragError, // error prevented the d&d operation from completing
+ wxDragNone, // drag target didn't accept the data
+ wxDragCopy, // the data was successfully copied
+ wxDragMove, // the data was successfully moved
+ wxDragCancel // the operation was cancelled by user (not an error)
+};
class wxDropSource: public wxObject
{
wxDragResult DoDragDrop( bool bAllowMove = FALSE );
virtual bool GiveFeedback( wxDragResult WXUNUSED(effect), bool WXUNUSED(bScrolling) ) { return TRUE; };
-
- protected:
-
- friend void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDropSource *source );
+ // implementation
+
void RegisterWindow(void);
void UnregisterWindow(void);
wxImage image;
image.LoadFile( "../horse.png", wxBITMAP_TYPE_PNG );
my_horse = new wxBitmap( image );
+
+ wxBitmap bitmap( 100, 100 );
+
+ wxMemoryDC dc;
+ dc.SelectObject( bitmap );
+ dc.SetBrush( wxRED_BRUSH );
+ dc.SetPen( wxWHITE_PEN );
+ dc.DrawRectangle( 0, 0, 100, 100 );
+ dc.SelectObject( wxNullBitmap );
+
+ image = bitmap.ConvertToImage();
+ image.SaveFile( "../test.png", wxBITMAP_TYPE_PNG );
}
MyCanvas::~MyCanvas(void)
#include "wx/debug.h"
#include "wx/log.h"
#include "../png/png.h"
+#include "wx/filefn.h"
//-----------------------------------------------------------------------------
// wxImage
bool wxImage::LoadFile( const wxString& filename, long type )
{
UnRef();
+
+ if (!wxFileExists(filename))
+ {
+ wxLogWarning( "Image file does not exist." );
+
+ return FALSE;
+ }
m_refData = new wxImageRefData;
gtk/button.cpp \
gtk/checkbox.cpp \
gtk/choice.cpp \
+ gtk/clipbrd.cpp \
gtk/colour.cpp \
gtk/control.cpp \
gtk/combobox.cpp \
image.Create( M_BMPDATA->m_width, M_BMPDATA->m_height );
char unsigned *data = image.GetData();
+
+
+ GdkVisual *visual = gdk_window_get_visual( M_BMPDATA->m_pixmap );
+ if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
+ int bpp = visual->depth;
- int bpp = gdk_image->bpp;
GdkColormap *cmap = gtk_widget_get_default_colormap();
long pos = 0;
int pixel = gdk_image_get_pixel( gdk_image, i, j );
if (bpp <= 8)
{
+/*
+ int r = cmap->colors[pixel].red; // debug code
+ int g = cmap->colors[pixel].green;
+ int b = cmap->colors[pixel].blue;
+*/
data[pos] = cmap->colors[pixel].red >> 8;
data[pos+1] = cmap->colors[pixel].green >> 8;
data[pos+2] = cmap->colors[pixel].blue >> 8;
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: clipbrd.cpp
+// Purpose:
+// Author: Robert Roebling
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "clipbrd.h"
+#endif
+
+#include "wx/clipbrd.h"
+
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+wxClipboard *wxTheClipboard = (wxClipboard*) NULL;
+
+//-----------------------------------------------------------------------------
+// functions
+//-----------------------------------------------------------------------------
+
+void wxInitClipboard()
+{
+ if (wxTheClipboard) delete wxTheClipboard;
+ wxTheClipboard = new wxClipboard();
+}
+
+void wxDoneClipboard()
+{
+ if (wxTheClipboard) delete wxTheClipboard;
+ wxTheClipboard = (wxClipboard*) NULL;
+}
+
+//-----------------------------------------------------------------------------
+// "selection_received"
+//-----------------------------------------------------------------------------
+
+/*
+static void selection_received( GtkWidget *widget, GtkSelectionData *selection_data, gpointer data )
+{
+}
+*/
+
+//-----------------------------------------------------------------------------
+// wxClipboard
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
+
+wxClipboard::wxClipboard()
+{
+ m_data = (wxDataObject*)NULL;
+ m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
+ gtk_widget_realize( m_clipboardWidget );
+}
+
+wxClipboard::~wxClipboard()
+{
+ if (m_data) delete m_data;
+ if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
+}
+
+void wxClipboard::SetData( wxDataObject *data )
+{
+ if (m_data) delete m_data;
+ m_data = data;
+}
+
+void *wxClipboard::GetData( wxDataFormat format, size_t *length )
+{
+ if (!IsAvailable(format))
+ {
+ if (length) *length = 0;
+ return NULL;
+ }
+ return NULL;
+}
+
+bool wxClipboard::IsAvailable( wxDataFormat WXUNUSED(format) )
+{
+ return FALSE;
+}
wxDropTarget::wxDropTarget()
{
- m_size = 0;
}
wxDropTarget::~wxDropTarget()
{
}
-void wxDropTarget::Drop( GdkEventDropDataAvailable *event, int x, int y )
-{
- printf( "Drop data is of type %s.\n", event->data_type );
-
- OnDrop( x, y, (char *)event->data);
-}
-
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
{
if (!widget) return;
// wxTextDropTarget
// ----------------------------------------------------------------------------
-bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
+bool wxTextDropTarget::OnDrop( long x, long y, const void *data, size_t WXUNUSED(size) )
{
- OnDropText( x, y, (const char*)pData );
+ OnDropText( x, y, (const char*)data );
return TRUE;
}
return TRUE;
}
-bool wxFileDropTarget::OnDrop(long x, long y, const void *pData )
+bool wxFileDropTarget::OnDrop(long x, long y, const void *data, size_t size )
{
size_t number = 0;
- char *text = (char*) pData;
- for (int i = 0; i < m_size; i++)
+ char *text = (char*) data;
+ for (size_t i = 0; i < size; i++)
if (text[i] == 0) number++;
if (number == 0) return TRUE;
char **files = new char*[number];
- text = (char*) pData;
+ text = (char*) data;
for (size_t i = 0; i < number; i++)
{
files[i] = text;
text += len+1;
}
- bool ret = OnDropFiles(x, y, 1, files );
+ bool ret = OnDropFiles( x, y, 1, files );
free( files );
node = node->Next();
}
- wxLogDebug( "wxMenu::FindItem: item %d not found.", id);
-
+ // Not finding anything here can be correct
+ // when search the entire menu system for
+ // an entry -> no error message.
+
return (wxMenuItem *) NULL;
}
int x = 0;
int y = 0;
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
- win->GetDropTarget()->m_size = event->data_numbytes;
- win->GetDropTarget()->Drop( event, x, y );
+
+ printf( "Drop data is of type %s.\n", event->data_type );
+
+ win->GetDropTarget()->OnDrop( x, y, (const void*)event->data, (size_t)event->data_numbytes );
}
/*
// wxFrame and wxDialog as children aren't placed into the parents
- if (( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog) ) &&
- (!IS_KIND_OF(child,wxMDIChildFrame)))
+ if (( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog) ) /*&&
+ (!IS_KIND_OF(child,wxMDIChildFrame))*/)
{
m_children.Append( child );
}
}
}
-
+
// wxNotebook is very special, so it has a private AddChild()
if (IS_KIND_OF(this,wxNotebook))
image.Create( M_BMPDATA->m_width, M_BMPDATA->m_height );
char unsigned *data = image.GetData();
+
+
+ GdkVisual *visual = gdk_window_get_visual( M_BMPDATA->m_pixmap );
+ if (visual == NULL) visual = gdk_window_get_visual( (GdkWindow*) &gdk_root_parent );
+ int bpp = visual->depth;
- int bpp = gdk_image->bpp;
GdkColormap *cmap = gtk_widget_get_default_colormap();
long pos = 0;
int pixel = gdk_image_get_pixel( gdk_image, i, j );
if (bpp <= 8)
{
+/*
+ int r = cmap->colors[pixel].red; // debug code
+ int g = cmap->colors[pixel].green;
+ int b = cmap->colors[pixel].blue;
+*/
data[pos] = cmap->colors[pixel].red >> 8;
data[pos+1] = cmap->colors[pixel].green >> 8;
data[pos+2] = cmap->colors[pixel].blue >> 8;
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: clipbrd.cpp
+// Purpose:
+// Author: Robert Roebling
+// Id: $Id$
+// Copyright: (c) 1998 Robert Roebling
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "clipbrd.h"
+#endif
+
+#include "wx/clipbrd.h"
+
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+wxClipboard *wxTheClipboard = (wxClipboard*) NULL;
+
+//-----------------------------------------------------------------------------
+// functions
+//-----------------------------------------------------------------------------
+
+void wxInitClipboard()
+{
+ if (wxTheClipboard) delete wxTheClipboard;
+ wxTheClipboard = new wxClipboard();
+}
+
+void wxDoneClipboard()
+{
+ if (wxTheClipboard) delete wxTheClipboard;
+ wxTheClipboard = (wxClipboard*) NULL;
+}
+
+//-----------------------------------------------------------------------------
+// "selection_received"
+//-----------------------------------------------------------------------------
+
+/*
+static void selection_received( GtkWidget *widget, GtkSelectionData *selection_data, gpointer data )
+{
+}
+*/
+
+//-----------------------------------------------------------------------------
+// wxClipboard
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
+
+wxClipboard::wxClipboard()
+{
+ m_data = (wxDataObject*)NULL;
+ m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
+ gtk_widget_realize( m_clipboardWidget );
+}
+
+wxClipboard::~wxClipboard()
+{
+ if (m_data) delete m_data;
+ if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
+}
+
+void wxClipboard::SetData( wxDataObject *data )
+{
+ if (m_data) delete m_data;
+ m_data = data;
+}
+
+void *wxClipboard::GetData( wxDataFormat format, size_t *length )
+{
+ if (!IsAvailable(format))
+ {
+ if (length) *length = 0;
+ return NULL;
+ }
+ return NULL;
+}
+
+bool wxClipboard::IsAvailable( wxDataFormat WXUNUSED(format) )
+{
+ return FALSE;
+}
wxDropTarget::wxDropTarget()
{
- m_size = 0;
}
wxDropTarget::~wxDropTarget()
{
}
-void wxDropTarget::Drop( GdkEventDropDataAvailable *event, int x, int y )
-{
- printf( "Drop data is of type %s.\n", event->data_type );
-
- OnDrop( x, y, (char *)event->data);
-}
-
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
{
if (!widget) return;
// wxTextDropTarget
// ----------------------------------------------------------------------------
-bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
+bool wxTextDropTarget::OnDrop( long x, long y, const void *data, size_t WXUNUSED(size) )
{
- OnDropText( x, y, (const char*)pData );
+ OnDropText( x, y, (const char*)data );
return TRUE;
}
return TRUE;
}
-bool wxFileDropTarget::OnDrop(long x, long y, const void *pData )
+bool wxFileDropTarget::OnDrop(long x, long y, const void *data, size_t size )
{
size_t number = 0;
- char *text = (char*) pData;
- for (int i = 0; i < m_size; i++)
+ char *text = (char*) data;
+ for (size_t i = 0; i < size; i++)
if (text[i] == 0) number++;
if (number == 0) return TRUE;
char **files = new char*[number];
- text = (char*) pData;
+ text = (char*) data;
for (size_t i = 0; i < number; i++)
{
files[i] = text;
text += len+1;
}
- bool ret = OnDropFiles(x, y, 1, files );
+ bool ret = OnDropFiles( x, y, 1, files );
free( files );
node = node->Next();
}
- wxLogDebug( "wxMenu::FindItem: item %d not found.", id);
-
+ // Not finding anything here can be correct
+ // when search the entire menu system for
+ // an entry -> no error message.
+
return (wxMenuItem *) NULL;
}
int x = 0;
int y = 0;
gdk_window_get_pointer( widget->window, &x, &y, (GdkModifierType *) NULL );
- win->GetDropTarget()->m_size = event->data_numbytes;
- win->GetDropTarget()->Drop( event, x, y );
+
+ printf( "Drop data is of type %s.\n", event->data_type );
+
+ win->GetDropTarget()->OnDrop( x, y, (const void*)event->data, (size_t)event->data_numbytes );
}
/*
// wxFrame and wxDialog as children aren't placed into the parents
- if (( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog) ) &&
- (!IS_KIND_OF(child,wxMDIChildFrame)))
+ if (( IS_KIND_OF(child,wxFrame) || IS_KIND_OF(child,wxDialog) ) /*&&
+ (!IS_KIND_OF(child,wxMDIChildFrame))*/)
{
m_children.Append( child );
}
}
}
-
+
// wxNotebook is very special, so it has a private AddChild()
if (IS_KIND_OF(this,wxNotebook))