]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | ///////////////////////////////////////////////////////////////////////////// |
e2731512 | 2 | // Name: src/palmos/radiobut.cpp |
ffecfa5a | 3 | // Purpose: wxRadioButton |
e2731512 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
808e3bce | 5 | // Modified by: Wlodzimierz ABX Skiba - native wxRadioButton implementation |
ffecfa5a | 6 | // Created: 10/13/04 |
e2731512 | 7 | // RCS-ID: $Id$ |
808e3bce | 8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
ffecfa5a JS |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
ffecfa5a JS |
20 | // For compilers that support precompilation, includes "wx.h". |
21 | #include "wx/wxprec.h" | |
22 | ||
23 | #ifdef __BORLANDC__ | |
24 | #pragma hdrstop | |
25 | #endif | |
26 | ||
27 | #if wxUSE_RADIOBTN | |
28 | ||
b0b5881a WS |
29 | #include "wx/radiobut.h" |
30 | ||
ffecfa5a | 31 | #ifndef WX_PRECOMP |
ffecfa5a JS |
32 | #include "wx/settings.h" |
33 | #include "wx/dcscreen.h" | |
34 | #endif | |
35 | ||
20bc5ad8 WS |
36 | #include <Control.h> |
37 | ||
ffecfa5a JS |
38 | // ============================================================================ |
39 | // wxRadioButton implementation | |
40 | // ============================================================================ | |
41 | ||
42 | // ---------------------------------------------------------------------------- | |
43 | // wxRadioButton creation | |
44 | // ---------------------------------------------------------------------------- | |
45 | ||
ffecfa5a JS |
46 | void wxRadioButton::Init() |
47 | { | |
a152561c | 48 | m_radioStyle = pushButtonCtl; |
8be10866 | 49 | m_groupID = 0; |
ffecfa5a JS |
50 | } |
51 | ||
52 | bool wxRadioButton::Create(wxWindow *parent, | |
53 | wxWindowID id, | |
54 | const wxString& label, | |
55 | const wxPoint& pos, | |
56 | const wxSize& size, | |
57 | long style, | |
58 | const wxValidator& validator, | |
59 | const wxString& name) | |
60 | { | |
9a727a3b | 61 | // replace native push button with native checkbox |
d79decb5 | 62 | if ( style & wxRB_USE_CHECKBOX ) |
9a727a3b WS |
63 | m_radioStyle = checkboxCtl; |
64 | ||
a152561c WS |
65 | if(!wxControl::Create(parent, id, pos, size, style, validator, name)) |
66 | return false; | |
67 | ||
68 | return wxControl::PalmCreateControl( | |
69 | // be sure only one of two possibilities was taken | |
70 | m_radioStyle == checkboxCtl ? checkboxCtl : pushButtonCtl, | |
71 | label, | |
72 | pos, | |
8be10866 WS |
73 | size, |
74 | m_groupID | |
a152561c | 75 | ); |
ffecfa5a JS |
76 | } |
77 | ||
8be10866 WS |
78 | void wxRadioButton::SetGroup(uint8_t group) |
79 | { | |
80 | m_groupID = group; | |
81 | } | |
82 | ||
ffecfa5a JS |
83 | // ---------------------------------------------------------------------------- |
84 | // wxRadioButton functions | |
85 | // ---------------------------------------------------------------------------- | |
86 | ||
87 | void wxRadioButton::SetValue(bool value) | |
88 | { | |
808e3bce | 89 | SetBoolValue(value); |
ffecfa5a JS |
90 | } |
91 | ||
92 | bool wxRadioButton::GetValue() const | |
93 | { | |
808e3bce | 94 | return GetBoolValue(); |
ffecfa5a JS |
95 | } |
96 | ||
97 | // ---------------------------------------------------------------------------- | |
98 | // wxRadioButton event processing | |
99 | // ---------------------------------------------------------------------------- | |
100 | ||
a152561c WS |
101 | bool wxRadioButton::SendClickEvent() |
102 | { | |
103 | wxCommandEvent event(wxEVT_COMMAND_RADIOBUTTON_SELECTED, GetId()); | |
104 | event.SetInt(GetValue()); | |
105 | event.SetEventObject(this); | |
106 | return ProcessCommand(event); | |
107 | } | |
108 | ||
ffecfa5a JS |
109 | void wxRadioButton::Command (wxCommandEvent& event) |
110 | { | |
111 | } | |
112 | ||
ffecfa5a JS |
113 | // ---------------------------------------------------------------------------- |
114 | // wxRadioButton geometry | |
115 | // ---------------------------------------------------------------------------- | |
116 | ||
117 | wxSize wxRadioButton::DoGetBestSize() const | |
118 | { | |
119 | return wxSize(0,0); | |
120 | } | |
121 | ||
122 | #endif // wxUSE_RADIOBTN | |
123 |