]>
Commit | Line | Data |
---|---|---|
ffecfa5a JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: src/palmos/tglbtn.cpp | |
3 | // Purpose: Definition of the wxToggleButton class, which implements a | |
4 | // toggle button. | |
e2731512 | 5 | // Author: William Osborne - minimal working wxPalmOS port |
bdb54365 | 6 | // Modified by: Wlodzimierz ABX Skiba - native implementation |
ffecfa5a | 7 | // Created: 10/13/04 |
e2731512 | 8 | // RCS-ID: $Id$ |
bdb54365 | 9 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
ffecfa5a JS |
10 | // Licence: wxWindows licence |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // ============================================================================ | |
14 | // declatations | |
15 | // ============================================================================ | |
16 | ||
17 | // ---------------------------------------------------------------------------- | |
18 | // headers | |
19 | // ---------------------------------------------------------------------------- | |
20 | ||
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
ffecfa5a JS |
27 | #if wxUSE_TOGGLEBTN |
28 | ||
29 | #ifndef WX_PRECOMP | |
30 | #include "wx/button.h" | |
31 | #include "wx/brush.h" | |
32 | #include "wx/dcscreen.h" | |
33 | #include "wx/settings.h" | |
34 | ||
35 | #include "wx/log.h" | |
36 | #endif // WX_PRECOMP | |
37 | ||
bdb54365 | 38 | #include "wx/tglbtn.h" |
ffecfa5a JS |
39 | |
40 | // ---------------------------------------------------------------------------- | |
41 | // macros | |
42 | // ---------------------------------------------------------------------------- | |
43 | ||
44 | IMPLEMENT_DYNAMIC_CLASS(wxToggleButton, wxControl) | |
45 | DEFINE_EVENT_TYPE(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED) | |
46 | ||
ffecfa5a JS |
47 | // ============================================================================ |
48 | // implementation | |
49 | // ============================================================================ | |
50 | ||
51 | // ---------------------------------------------------------------------------- | |
52 | // wxToggleButton | |
53 | // ---------------------------------------------------------------------------- | |
54 | ||
ffecfa5a JS |
55 | // Single check box item |
56 | bool wxToggleButton::Create(wxWindow *parent, wxWindowID id, | |
57 | const wxString& label, | |
58 | const wxPoint& pos, | |
59 | const wxSize& size, long style, | |
60 | const wxValidator& validator, | |
61 | const wxString& name) | |
62 | { | |
a152561c WS |
63 | if(!wxControl::Create(parent, id, pos, size, style, validator, name)) |
64 | return false; | |
65 | ||
66 | return wxControl::PalmCreateControl(pushButtonCtl, label, pos, size); | |
ffecfa5a JS |
67 | } |
68 | ||
69 | wxBorder wxToggleButton::GetDefaultBorder() const | |
70 | { | |
71 | return wxBORDER_NONE; | |
72 | } | |
73 | ||
ffecfa5a JS |
74 | wxSize wxToggleButton::DoGetBestSize() const |
75 | { | |
76 | return wxSize(0,0); | |
77 | } | |
78 | ||
79 | void wxToggleButton::SetValue(bool val) | |
80 | { | |
ba889513 | 81 | SetBoolValue(val); |
ffecfa5a JS |
82 | } |
83 | ||
ffecfa5a JS |
84 | bool wxToggleButton::GetValue() const |
85 | { | |
ba889513 | 86 | return GetBoolValue(); |
ffecfa5a JS |
87 | } |
88 | ||
a152561c WS |
89 | bool wxToggleButton::SendClickEvent() |
90 | { | |
91 | wxCommandEvent event(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, GetId()); | |
92 | event.SetInt(GetValue()); | |
93 | event.SetEventObject(this); | |
94 | return ProcessCommand(event); | |
95 | } | |
96 | ||
ffecfa5a JS |
97 | void wxToggleButton::Command(wxCommandEvent & event) |
98 | { | |
99 | } | |
100 | ||
101 | #endif // wxUSE_TOGGLEBTN | |
102 |