X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ffecfa5aeb540b54914739dbb8603edbbd4c00a0..4f33a4dd4c6e92ec613aa73737030e992f5d8c65:/src/palmos/tglbtn.cpp diff --git a/src/palmos/tglbtn.cpp b/src/palmos/tglbtn.cpp index ead4ee1eaa..3f75361d7e 100644 --- a/src/palmos/tglbtn.cpp +++ b/src/palmos/tglbtn.cpp @@ -2,11 +2,11 @@ // Name: src/palmos/tglbtn.cpp // Purpose: Definition of the wxToggleButton class, which implements a // toggle button. -// Author: William Osborne -// Modified by: +// Author: William Osborne - minimal working wxPalmOS port +// Modified by: Wlodzimierz ABX Skiba - native implementation // Created: 10/13/04 -// RCS-ID: $Id: -// Copyright: (c) William Osborne +// RCS-ID: $Id$ +// Copyright: (c) William Osborne, Wlodzimierz Skiba // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -24,10 +24,10 @@ #pragma hdrstop #endif -#include "wx/tglbtn.h" - #if wxUSE_TOGGLEBTN +#include "wx/tglbtn.h" + #ifndef WX_PRECOMP #include "wx/button.h" #include "wx/brush.h" @@ -37,7 +37,7 @@ #include "wx/log.h" #endif // WX_PRECOMP -#include "wx/palmos/private.h" +#include // ---------------------------------------------------------------------------- // macros @@ -46,8 +46,6 @@ IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl) DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) -#define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10) - // ============================================================================ // implementation // ============================================================================ @@ -56,15 +54,6 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) // wxToggleButton // ---------------------------------------------------------------------------- -bool wxToggleButton::MSWCommand(WXUINT WXUNUSED(param), WXWORD WXUNUSED(id)) -{ - wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, m_windowId); - event.SetInt(GetValue()); - event.SetEventObject(this); - ProcessCommand(event); - return TRUE; -} - // Single check box item bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, const wxString& label, @@ -73,7 +62,10 @@ bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, const wxValidator& validator, const wxString& name) { - return false; + if(!wxControl::Create(parent, id, pos, size, style, validator, name)) + return false; + + return wxControl::PalmCreateControl(pushButtonCtl, label, pos, size); } wxBorder wxToggleButton::GetDefaultBorder() const @@ -81,15 +73,6 @@ wxBorder wxToggleButton::GetDefaultBorder() const return wxBORDER_NONE; } -WXDWORD wxToggleButton::MSWGetStyle(long style, WXDWORD *exstyle) const -{ - return 0; -} - -void wxToggleButton::SetLabel(const wxString& label) -{ -} - wxSize wxToggleButton::DoGetBestSize() const { return wxSize(0,0); @@ -97,15 +80,20 @@ wxSize wxToggleButton::DoGetBestSize() const void wxToggleButton::SetValue(bool val) { + SetBoolValue(val); } -#ifndef BST_CHECKED -#define BST_CHECKED 0x0001 -#endif - 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) @@ -113,4 +101,3 @@ void wxToggleButton::Command(wxCommandEvent & event) } #endif // wxUSE_TOGGLEBTN -