X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bdb5436554c910fe850db1470514ee83ded76db3..74a8f67d96591cec101def2a7d47c64072aff7fd:/src/palmos/tglbtn.cpp diff --git a/src/palmos/tglbtn.cpp b/src/palmos/tglbtn.cpp index 9e69fc4b82..856b13d77e 100644 --- a/src/palmos/tglbtn.cpp +++ b/src/palmos/tglbtn.cpp @@ -26,6 +26,8 @@ #if wxUSE_TOGGLEBTN +#include "wx/tglbtn.h" + #ifndef WX_PRECOMP #include "wx/button.h" #include "wx/brush.h" @@ -35,14 +37,14 @@ #include "wx/log.h" #endif // WX_PRECOMP -#include "wx/tglbtn.h" +#include // ---------------------------------------------------------------------------- // macros // ---------------------------------------------------------------------------- IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl) -DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) +wxDEFINE_EVENT( wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEvent ); // ============================================================================ // implementation @@ -60,8 +62,10 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - wxControl::PalmCreateControl(pushButtonCtl, parent, id, label, pos, size); - return true; + if(!wxControl::Create(parent, id, pos, size, style, validator, name)) + return false; + + return wxControl::PalmCreateControl(pushButtonCtl, label, pos, size); } wxBorder wxToggleButton::GetDefaultBorder() const @@ -76,11 +80,20 @@ wxSize wxToggleButton::DoGetBestSize() const void wxToggleButton::SetValue(bool val) { + SetBoolValue(val); } bool wxToggleButton::GetValue() const { - return false; + return GetBoolValue(); +} + +bool wxToggleButton::SendClickEvent() +{ + wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, GetId()); + event.SetInt(GetValue()); + event.SetEventObject(this); + return ProcessCommand(event); } void wxToggleButton::Command(wxCommandEvent & event) @@ -88,4 +101,3 @@ void wxToggleButton::Command(wxCommandEvent & event) } #endif // wxUSE_TOGGLEBTN -