]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/button.cpp
one more minor wxLogWindow fix (I try to get it really right...)
[wxWidgets.git] / src / gtk / button.cpp
index 2201232c15fe35fc7801b18f8b180c4d062281f7..6588daad60de53fcd677662b5d5a5eb1bb3325a8 100644 (file)
 
 class wxButton;
 
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool   g_blockEventsOnDrag;
+
 //-----------------------------------------------------------------------------
 // wxButton
 //-----------------------------------------------------------------------------
 
 IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
 
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
 {
-  wxButton *button = (wxButton*)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);
 };
 
 //-----------------------------------------------------------------------------
@@ -57,8 +65,8 @@ bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
 
   PreCreation( parent, id, pos, newSize, style, name );
 
-  SetLabel(label);
   m_widget = gtk_button_new_with_label( m_label );
+  SetLabel(label);
 
   if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label );
   if (newSize.y == -1) newSize.y = 26;
@@ -81,9 +89,8 @@ void wxButton::SetDefault(void)
 void wxButton::SetLabel( const wxString &label )
 {
   wxControl::SetLabel( label );
+  GtkButton *bin = GTK_BUTTON( m_widget );
+  GtkLabel *g_label = GTK_LABEL( bin->child );
+  gtk_label_set( g_label, GetLabel() );
 };
 
-wxString wxButton::GetLabel(void) const
-{
-  return wxControl::GetLabel();
-};