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