X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/47908e25f992135fbc8c9573870784c62654e9e9..2f2aa6287bd281037a8c329c65219324f81c613c:/src/gtk1/checkbox.cpp?ds=inline diff --git a/src/gtk1/checkbox.cpp b/src/gtk1/checkbox.cpp index b4c8a447ff..036a1dbcde 100644 --- a/src/gtk1/checkbox.cpp +++ b/src/gtk1/checkbox.cpp @@ -15,17 +15,26 @@ #include "wx/checkbox.h" +//----------------------------------------------------------------------------- +// data +//----------------------------------------------------------------------------- + +extern bool g_blockEventsOnDrag; + //----------------------------------------------------------------------------- // wxCheckBox //----------------------------------------------------------------------------- -void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) +static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb ) { + if (!cb->HasVMT()) return; + if (g_blockEventsOnDrag) return; + wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId()); event.SetInt( cb->GetValue() ); event.SetEventObject(cb); cb->GetEventHandler()->ProcessEvent(event); -}; +} //----------------------------------------------------------------------------- @@ -33,24 +42,21 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl) wxCheckBox::wxCheckBox(void) { -}; - -wxCheckBox::wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label, - const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) -{ - Create( parent, id, label, pos, size, style, name ); -}; +} bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) + long style, const wxValidator& validator, const wxString &name ) { m_needParent = TRUE; PreCreation( parent, id, pos, size, style, name ); - m_widget = gtk_check_button_new_with_label( label ); + SetValidator( validator ); + + SetLabel( label ); + + m_widget = gtk_check_button_new_with_label( m_label ); wxSize newSize = size; if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label ); @@ -65,7 +71,7 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label Show( TRUE ); return TRUE; -}; +} void wxCheckBox::SetValue( bool state ) { @@ -73,11 +79,11 @@ void wxCheckBox::SetValue( bool state ) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE ); else gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL ); -}; +} bool wxCheckBox::GetValue(void) const { GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget); return tb->active; -}; +}