X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3502e687e29f46c747be16a58d39fe79e7b1c7bc..bbf7db28cbab49712d486679e4614479c04d0fbd:/src/gtk/button.cpp?ds=sidebyside diff --git a/src/gtk/button.cpp b/src/gtk/button.cpp index 42716b5b40..1347e6ddae 100644 --- a/src/gtk/button.cpp +++ b/src/gtk/button.cpp @@ -22,6 +22,13 @@ class wxButton; +//----------------------------------------------------------------------------- +// idle system +//----------------------------------------------------------------------------- + +extern void wxapp_install_idle_handler(); +extern bool g_isIdle; + //----------------------------------------------------------------------------- // data //----------------------------------------------------------------------------- @@ -34,12 +41,14 @@ extern bool g_blockEventsOnDrag; static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button ) { - if (!button->HasVMT()) return; - if (g_blockEventsOnDrag) return; + if (g_isIdle) wxapp_install_idle_handler(); + + if (!button->HasVMT()) return; + if (g_blockEventsOnDrag) return; - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); - event.SetEventObject(button); - button->GetEventHandler()->ProcessEvent(event); + wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); + event.SetEventObject(button); + button->GetEventHandler()->ProcessEvent(event); } //----------------------------------------------------------------------------- @@ -54,7 +63,7 @@ wxButton::wxButton() wxButton::~wxButton() { - if (m_clientData) delete m_clientData; + if (m_clientData) delete m_clientData; } bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, @@ -71,10 +80,10 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetValidator( validator ); - m_widget = gtk_button_new_with_label( m_label ); + m_widget = gtk_button_new_with_label( m_label.mbc_str() ); SetLabel(label); - if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label ); + if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label.mbc_str() ); if (newSize.y == -1) newSize.y = 26; SetSize( newSize.x, newSize.y ); @@ -89,6 +98,7 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, SetBackgroundColour( parent->GetBackgroundColour() ); SetForegroundColour( parent->GetForegroundColour() ); + SetFont( parent->GetFont() ); Show( TRUE ); @@ -105,16 +115,16 @@ void wxButton::SetDefault(void) void wxButton::SetLabel( const wxString &label ) { - wxCHECK_RET( m_widget != NULL, "invalid button" ); + wxCHECK_RET( m_widget != NULL, _T("invalid button") ); wxControl::SetLabel( label ); - gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel() ); + gtk_label_set( GTK_LABEL( GTK_BUTTON(m_widget)->child ), GetLabel().mbc_str() ); } void wxButton::Enable( bool enable ) { - wxCHECK_RET( m_widget != NULL, "invalid button" ); + wxCHECK_RET( m_widget != NULL, _T("invalid button") ); wxControl::Enable( enable ); @@ -127,5 +137,3 @@ void wxButton::ApplyWidgetStyle() gtk_widget_set_style( m_widget, m_widgetStyle ); gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle ); } - -