class wxBitmapButton;
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxBitmapButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- wxBitmapButton *button = (wxBitmapButton*)data;
+ if (!button->HasVMT()) return;
+ if (g_blockEventsOnDrag) return;
+
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
- button->ProcessEvent(event);
+ button->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
wxBitmapButton::wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
- const long style, const wxString &name )
+ long style, const wxString &name )
{
Create( parent, id, bitmap, pos, size, style, name );
};
bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
- const long style, const wxString &name )
+ long style, const wxString &name )
{
m_needParent = TRUE;
gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
};
-
-
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
SetSize( newSize.x, newSize.y );
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
- GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
+ GTK_SIGNAL_FUNC(gtk_bmpbutton_clicked_callback), (gpointer*)this );
PostCreation();