]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/tglbtn.h
Implement setFont on the iOS port of wxStaticText.
[wxWidgets.git] / interface / wx / tglbtn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tglbtn.h
3 // Purpose: interface of wxBitmapToggleButton, wxToggleButton
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8
9 wxEventType wxEVT_TOGGLEBUTTON;
10
11 /**
12 @class wxToggleButton
13
14 wxToggleButton is a button that stays pressed when clicked by the user.
15 In other words, it is similar to wxCheckBox in functionality but looks like a wxButton.
16
17 Since wxWidgets version 2.9.0 this control emits an update UI event.
18
19 You can see wxToggleButton in action in @ref page_samples_controls.
20
21 @beginEventEmissionTable{wxCommandEvent}
22 @event{EVT_TOGGLEBUTTON(id, func)}
23 Handles a wxEVT_TOGGLEBUTTON event.
24 @endEventTable
25
26 @library{wxcore}
27 @category{ctrl}
28 @appearance{togglebutton}
29
30 @see wxCheckBox, wxButton, wxBitmapToggleButton
31 */
32 class wxToggleButton : public wxAnyButton
33 {
34 public:
35 /**
36 Default constructor.
37 */
38 wxToggleButton();
39
40 /**
41 Constructor, creating and showing a toggle button.
42
43 @param parent
44 Parent window. Must not be @NULL.
45 @param id
46 Toggle button identifier. The value wxID_ANY indicates a default value.
47 @param label
48 Text to be displayed next to the toggle button.
49 @param pos
50 Toggle button position.
51 If ::wxDefaultPosition is specified then a default position is chosen.
52 @param size
53 Toggle button size.
54 If ::wxDefaultSize is specified then a default size is chosen.
55 @param style
56 Window style. See wxToggleButton.
57 @param val
58 Window validator.
59 @param name
60 Window name.
61
62 @see Create(), wxValidator
63 */
64 wxToggleButton(wxWindow* parent, wxWindowID id,
65 const wxString& label,
66 const wxPoint& pos = wxDefaultPosition,
67 const wxSize& size = wxDefaultSize,
68 long style = 0,
69 const wxValidator& val = wxDefaultValidator,
70 const wxString& name = wxCheckBoxNameStr);
71
72 /**
73 Destructor, destroying the toggle button.
74 */
75 virtual ~wxToggleButton();
76
77 /**
78 Creates the toggle button for two-step construction.
79 See wxToggleButton() for details.
80 */
81 bool Create(wxWindow* parent, wxWindowID id,
82 const wxString& label,
83 const wxPoint& pos = wxDefaultPosition,
84 const wxSize& size = wxDefaultSize,
85 long style = 0,
86 const wxValidator& val = wxDefaultValidator,
87 const wxString& name = wxCheckBoxNameStr);
88
89 /**
90 Gets the state of the toggle button.
91
92 @return Returns @true if it is pressed, @false otherwise.
93 */
94 virtual bool GetValue() const;
95
96 /**
97 Sets the toggle button to the given state.
98 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
99
100 @param state
101 If @true, the button is pressed.
102 */
103 virtual void SetValue(bool state);
104 };
105
106
107 /**
108 @class wxBitmapToggleButton
109
110 wxBitmapToggleButton is a wxToggleButton that contains a bitmap instead of
111 text.
112
113 This class is not available in all ports currently (although it is
114 available in the major ones), test for @c wxHAS_BITMAPTOGGLEBUTTON to
115 determine whether it can be used (in addition for possibly testing for
116 @c wxUSE_TOGGLEBTN which can be set to 0 to explicitly disable support for
117 this class and wxToggleButton).
118
119 This control emits an update UI event.
120
121 @beginEventEmissionTable{wxCommandEvent}
122 @event{EVT_TOGGLEBUTTON(id, func)}
123 Handles a wxEVT_TOGGLEBUTTON event.
124 @endEventTable
125
126 @library{wxcore}
127 @category{ctrl}
128 */
129 class wxBitmapToggleButton : public wxToggleButton
130 {
131 public:
132 /**
133 Default constructor.
134 */
135 wxBitmapToggleButton();
136
137 /**
138 Constructor, creating and showing a toggle button with the bitmap @e label.
139 Internally calls Create().
140 */
141 wxBitmapToggleButton(wxWindow* parent, wxWindowID id,
142 const wxBitmap& label,
143 const wxPoint& pos = wxDefaultPosition,
144 const wxSize& size = wxDefaultSize,
145 long style = 0,
146 const wxValidator& val = wxDefaultValidator,
147 const wxString& name = wxCheckBoxNameStr);
148
149 /**
150 Create method for two-step construction.
151 */
152 bool Create(wxWindow* parent, wxWindowID id,
153 const wxBitmap& label,
154 const wxPoint& pos = wxDefaultPosition,
155 const wxSize& size = wxDefaultSize,
156 long style = 0,
157 const wxValidator& val = wxDefaultValidator,
158 const wxString& name = wxCheckBoxNameStr);
159
160 /**
161 Gets the state of the toggle button.
162
163 @return Returns @true if it is pressed, @false otherwise.
164 */
165 virtual bool GetValue() const;
166
167 /**
168 Sets the toggle button to the given state.
169 This does not cause a @c EVT_TOGGLEBUTTON event to be emitted.
170
171 @param state
172 If @true, the button is pressed.
173 */
174 virtual void SetValue(bool state);
175 };
176