/*
* wxSpinButton flags
*/
-#define wxSP_VERTICAL 0x0004
-#define wxSP_HORIZONTAL 0x0008
-#define wxSP_ARROW_KEYS 0x0010
-#define wxSP_WRAP 0x0020
+#define wxSP_HORIZONTAL wxHORIZONTAL // 4
+#define wxSP_VERTICAL wxVERTICAL // 8
+#define wxSP_ARROW_KEYS 0x0010
+#define wxSP_WRAP 0x0020
/*
* wxSplitterWindow flags
*/
-#define wxSP_NOBORDER 0x0000
-#define wxSP_3D 0x0004
-#define wxSP_BORDER 0x0008
-#define wxSP_PERMIT_UNSPLIT 0x0010
-#define wxSP_LIVE_UPDATE 0x0020
+#define wxSP_NOBORDER 0x0000
+#define wxSP_3D 0x0010
+#define wxSP_BORDER 0x0020
+#define wxSP_PERMIT_UNSPLIT 0x0040
+#define wxSP_LIVE_UPDATE 0x0080
/*
* wxFrame extra flags
* wxTabCtrl flags
*/
#define wxTC_MULTILINE 0x0000
-#define wxTC_RIGHTJUSTIFY 0x0004
-#define wxTC_FIXEDWIDTH 0x0008
-#define wxTC_OWNERDRAW 0x0010
+#define wxTC_RIGHTJUSTIFY 0x0010
+#define wxTC_FIXEDWIDTH 0x0020
+#define wxTC_OWNERDRAW 0x0040
/*
* wxNotebook flags
*/
-#define wxNB_FIXEDWIDTH 0x0008
+#define wxNB_FIXEDWIDTH 0x0010
#define wxNB_LEFT 0x0020
#define wxNB_RIGHT 0x0040
#define wxNB_BOTTOM 0x0080
/*
* wxStatusBar95 flags
*/
-#define wxST_SIZEGRIP 0x0002
+#define wxST_SIZEGRIP 0x0010
/*
* wxStaticLine flags
/* 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 );
wxTextDropTarget() {}
- virtual bool OnMove( long x, long y );
- virtual bool OnDrop( long x, long y );
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; }
};
//-------------------------------------------------------------------------
wxFileDropTarget() {}
- virtual bool OnMove( long x, long y );
- virtual bool OnDrop( long x, long y );
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; }
};
//-------------------------------------------------------------------------
/* 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 );
wxTextDropTarget() {}
- virtual bool OnMove( long x, long y );
- virtual bool OnDrop( long x, long y );
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; }
};
//-------------------------------------------------------------------------
wxFileDropTarget() {}
- virtual bool OnMove( long x, long y );
- virtual bool OnDrop( long x, long y );
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; }
};
//-------------------------------------------------------------------------
bool DnDShapeDialog::TransferDataToWindow()
{
+
if ( m_shape )
{
m_radio->SetSelection(m_shape->GetKind());
BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_PAINT( MyCanvas::OnPaint)
- EVT_LEFT_DOWN( MyCanvas::OnMouseDown)
+ EVT_MOUSE_EVENTS( MyCanvas::OnMouseDown)
EVT_BUTTON( ID_QUERYPOS, MyCanvas::OnQueryPosition)
EVT_BUTTON( ID_ADDBUTTON, MyCanvas::OnAddButton)
EVT_BUTTON( ID_DELBUTTON, MyCanvas::OnDeleteButton)
void MyCanvas::OnMouseDown( wxMouseEvent &event )
{
- wxPoint pt( event.GetPosition() );
- int x,y;
- CalcUnscrolledPosition( pt.x, pt.y, &x, &y );
- wxLogMessage( "Mouse down event at: %d %d, scrolled: %d %d", pt.x, pt.y, x, y );
+ if (event.LeftDown())
+ {
+ wxPoint pt( event.GetPosition() );
+ int x,y;
+ CalcUnscrolledPosition( pt.x, pt.y, &x, &y );
+ wxLogMessage( "Mouse down event at: %d %d, scrolled: %d %d", pt.x, pt.y, x, y );
+ }
+
+ if (event.LeftIsDown() &&
+ event.LeftDown())
+ {
+ wxLogMessage( "Error: both LeftDown() and LeftIsDown() are TRUE!" );
+ }
}
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )
/* Owen Taylor: "call gtk_drag_finish() with
success == TRUE" */
-// printf( "data received.\n" );
if ((data->length <= 0) || (data->format != 8))
{
qualifies for junk */
gtk_drag_finish (context, FALSE, FALSE, time);
-// printf( "no data.\n" );
-
return;
}
+ wxLogDebug( wxT( "Drop target: data received") );
+
/* inform the wxDropTarget about the current GtkSelectionData.
this is only valid for the duration of this call */
drop_target->SetDragData( data );
bool wxDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
{
- return TRUE;
+ if (GetFormatCount() == 0)
+ return FALSE;
+
+ for (size_t i = 0; i < GetFormatCount(); i++)
+ {
+ if (IsSupported( GetFormat(i) ))
+ return TRUE;
+ }
+
+ return FALSE;
}
bool wxDropTarget::OnDrop( long WXUNUSED(x), long WXUNUSED(y) )
{
+ if (GetFormatCount() == 0)
+ return FALSE;
+
+ for (size_t i = 0; i < GetFormatCount(); i++)
+ {
+ if (IsSupported( GetFormat(i) ))
+ {
+ RequestData( GetFormat(i) );
+ return TRUE;
+ }
+ }
+
return FALSE;
}
{
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
-// char *name = gdk_atom_name( formatAtom );
-// if (name) printf( "Format available: %s.\n", name );
+#ifdef __WXDEBUG__
+ char *name = gdk_atom_name( formatAtom );
+ if (name) wxLogDebug( "Drop target: drag has format: %s", name );
+#endif
if (formatAtom == format) return TRUE;
child = child->next;
// wxTextDropTarget
//-------------------------------------------------------------------------
-bool wxTextDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
-{
- return IsSupported( wxDF_TEXT );
-}
-
-bool wxTextDropTarget::OnDrop( long WXUNUSED(x), long WXUNUSED(y) )
-{
- if (IsSupported( wxDF_TEXT ))
- {
- RequestData( wxDF_TEXT );
- return TRUE;
- }
-
- return FALSE;
-}
-
bool wxTextDropTarget::OnData( long x, long y )
{
wxTextDataObject data;
// A drop target which accepts files (dragged from File Manager or Explorer)
//----------------------------------------------------------------------------
-bool wxFileDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
-{
- return IsSupported( wxDF_FILENAME );
-}
-
-bool wxFileDropTarget::OnDrop( long x, long y )
-{
- if (IsSupported( wxDF_FILENAME ))
- {
- RequestData( wxDF_FILENAME );
- return TRUE;
- }
-
- return FALSE;
-}
-
bool wxFileDropTarget::OnData( long x, long y )
{
wxFileDataObject data;
{
if (g_isIdle) wxapp_install_idle_handler();
-// printf( "Provide data!\n" );
-
-// char *name = gdk_atom_name( selection_data->target );
-// if (name) printf( "Format requested: %s.\n", name );
+#ifdef __WXDEBUG__
+ char *name = gdk_atom_name( selection_data->target );
+ if (name) wxLogDebug( wxT("Drop source: format requested: %s"), name );
+#endif
drop_source->m_retValue = wxDragCancel;
{
wxASSERT_MSG( m_data, wxT("wxDragSource: no data") );
- if (!m_data) return (wxDragResult) wxDragNone;
+ if (!m_data)
+ return (wxDragResult) wxDragNone;
+ if (m_data->GetFormatCount() == 0)
+ return (wxDragResult) wxDragNone;
+
g_blockEventsOnDrag = TRUE;
RegisterWindow();
m_waiting = TRUE;
- GdkAtom atom = gdk_atom_intern( "STRING", FALSE );
-// printf( "atom id: %d.\n", (int)atom );
-
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
- gtk_target_list_add( target_list, atom, 0, 0 );
+
+ wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
+ m_data->GetAllFormats( array, TRUE );
+ for (size_t i = 0; i < m_data->GetFormatCount(); i++)
+ {
+ GdkAtom atom = array[i];
+ wxLogDebug( wxT("Supported atom %s"), gdk_atom_name( atom ) );
+ gtk_target_list_add( target_list, atom, 0, 0 );
+ }
+ delete[] array;
GdkEventMotion event;
event.window = m_widget->window;
/* Owen Taylor: "call gtk_drag_finish() with
success == TRUE" */
-// printf( "data received.\n" );
if ((data->length <= 0) || (data->format != 8))
{
qualifies for junk */
gtk_drag_finish (context, FALSE, FALSE, time);
-// printf( "no data.\n" );
-
return;
}
+ wxLogDebug( wxT( "Drop target: data received") );
+
/* inform the wxDropTarget about the current GtkSelectionData.
this is only valid for the duration of this call */
drop_target->SetDragData( data );
bool wxDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
{
- return TRUE;
+ if (GetFormatCount() == 0)
+ return FALSE;
+
+ for (size_t i = 0; i < GetFormatCount(); i++)
+ {
+ if (IsSupported( GetFormat(i) ))
+ return TRUE;
+ }
+
+ return FALSE;
}
bool wxDropTarget::OnDrop( long WXUNUSED(x), long WXUNUSED(y) )
{
+ if (GetFormatCount() == 0)
+ return FALSE;
+
+ for (size_t i = 0; i < GetFormatCount(); i++)
+ {
+ if (IsSupported( GetFormat(i) ))
+ {
+ RequestData( GetFormat(i) );
+ return TRUE;
+ }
+ }
+
return FALSE;
}
{
GdkAtom formatAtom = (GdkAtom) GPOINTER_TO_INT(child->data);
-// char *name = gdk_atom_name( formatAtom );
-// if (name) printf( "Format available: %s.\n", name );
+#ifdef __WXDEBUG__
+ char *name = gdk_atom_name( formatAtom );
+ if (name) wxLogDebug( "Drop target: drag has format: %s", name );
+#endif
if (formatAtom == format) return TRUE;
child = child->next;
// wxTextDropTarget
//-------------------------------------------------------------------------
-bool wxTextDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
-{
- return IsSupported( wxDF_TEXT );
-}
-
-bool wxTextDropTarget::OnDrop( long WXUNUSED(x), long WXUNUSED(y) )
-{
- if (IsSupported( wxDF_TEXT ))
- {
- RequestData( wxDF_TEXT );
- return TRUE;
- }
-
- return FALSE;
-}
-
bool wxTextDropTarget::OnData( long x, long y )
{
wxTextDataObject data;
// A drop target which accepts files (dragged from File Manager or Explorer)
//----------------------------------------------------------------------------
-bool wxFileDropTarget::OnMove( long WXUNUSED(x), long WXUNUSED(y) )
-{
- return IsSupported( wxDF_FILENAME );
-}
-
-bool wxFileDropTarget::OnDrop( long x, long y )
-{
- if (IsSupported( wxDF_FILENAME ))
- {
- RequestData( wxDF_FILENAME );
- return TRUE;
- }
-
- return FALSE;
-}
-
bool wxFileDropTarget::OnData( long x, long y )
{
wxFileDataObject data;
{
if (g_isIdle) wxapp_install_idle_handler();
-// printf( "Provide data!\n" );
-
-// char *name = gdk_atom_name( selection_data->target );
-// if (name) printf( "Format requested: %s.\n", name );
+#ifdef __WXDEBUG__
+ char *name = gdk_atom_name( selection_data->target );
+ if (name) wxLogDebug( wxT("Drop source: format requested: %s"), name );
+#endif
drop_source->m_retValue = wxDragCancel;
{
wxASSERT_MSG( m_data, wxT("wxDragSource: no data") );
- if (!m_data) return (wxDragResult) wxDragNone;
+ if (!m_data)
+ return (wxDragResult) wxDragNone;
+ if (m_data->GetFormatCount() == 0)
+ return (wxDragResult) wxDragNone;
+
g_blockEventsOnDrag = TRUE;
RegisterWindow();
m_waiting = TRUE;
- GdkAtom atom = gdk_atom_intern( "STRING", FALSE );
-// printf( "atom id: %d.\n", (int)atom );
-
GtkTargetList *target_list = gtk_target_list_new( (GtkTargetEntry*) NULL, 0 );
- gtk_target_list_add( target_list, atom, 0, 0 );
+
+ wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
+ m_data->GetAllFormats( array, TRUE );
+ for (size_t i = 0; i < m_data->GetFormatCount(); i++)
+ {
+ GdkAtom atom = array[i];
+ wxLogDebug( wxT("Supported atom %s"), gdk_atom_name( atom ) );
+ gtk_target_list_add( target_list, atom, 0, 0 );
+ }
+ delete[] array;
GdkEventMotion event;
event.window = m_widget->window;