]> git.saurik.com Git - wxWidgets.git/blob - interface/tglbtn.h
add handling of wxWrapSizer flags (part of ticket 9468)
[wxWidgets.git] / interface / tglbtn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: tglbtn.h
3 // Purpose: interface of wxBitmapToggleButton
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 /**
11 @class wxToggleButton
12 @wxheader{tglbtn.h}
13
14 wxToggleButton is a button that stays pressed when clicked by the user. In
15 other words, it is similar to wxCheckBox in
16 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 the sixth page of the
21 controls() sample.
22
23 @beginEventTable{wxCommandEvent}
24 @event{EVT_TOGGLEBUTTON(id, func)}
25 Handles a toggle button click event.
26 @endEventTable
27
28 @library{wxcore}
29 @category{ctrl}
30 <!-- @appearance{togglebutton.png} -->
31
32 @see wxCheckBox, wxButton, wxBitmapToggleButton
33 */
34 class wxToggleButton : public wxControl
35 {
36 public:
37 //@{
38 /**
39 Constructor, creating and showing a toggle button.
40
41 @param parent
42 Parent window. Must not be @NULL.
43 @param id
44 Toggle button identifier. The value wxID_ANY indicates a default value.
45 @param label
46 Text to be displayed next to the toggle button.
47 @param pos
48 Toggle button position. If wxDefaultPosition is specified then a
49 default position is chosen.
50 @param size
51 Toggle button size. If wxDefaultSize is specified then a
52 default size is chosen.
53 @param style
54 Window style. See wxToggleButton.
55 @param validator
56 Window validator.
57 @param name
58 Window name.
59
60 @see Create(), wxValidator
61 */
62 wxToggleButton();
63 wxToggleButton(wxWindow* parent, wxWindowID id,
64 const wxString& label,
65 const wxPoint& pos = wxDefaultPosition,
66 const wxSize& size = wxDefaultSize,
67 long style = 0,
68 const wxValidator& val = wxDefaultValidator,
69 const wxString& name = "checkBox");
70 //@}
71
72 /**
73 Destructor, destroying the toggle button.
74 */
75 virtual ~wxToggleButton();
76
77 /**
78 Creates the toggle button for two-step construction. See wxToggleButton()
79 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 = "checkBox");
88
89 /**
90 Gets the state of the toggle button.
91
92 @return Returns @true if it is pressed, @false otherwise.
93 */
94 bool GetValue() const;
95
96 /**
97 Sets the toggle button to the given state. This does not cause a
98 @c EVT_TOGGLEBUTTON event to be emitted.
99
100 @param state
101 If @true, the button is pressed.
102 */
103 void SetValue(bool state);
104 };
105
106
107 /**
108 @class wxBitmapToggleButton
109 @wxheader{tglbtn.h}
110
111 wxBitmapToggleButton is a wxToggleButton
112 that contains a bitmap instead of text.
113
114 This control emits an update UI event.
115
116 @beginEventTable{wxCommandEvent}
117 @event{EVT_TOGGLEBUTTON(id, func)}
118 Handles a toggle button click event.
119 @endEventTable
120
121 @library{wxcore}
122 @category{ctrl}
123 <!-- @appearance{bitmaptogglebutton.png} -->
124 */
125 class wxBitmapToggleButton : public wxControl
126 {
127 public:
128 //@{
129 /**
130 Constructor, creating and showing a toggle button with the bitmap @e label.
131 Internally calls Create().
132 */
133 wxBitmapToggleButton();
134 wxBitmapToggleButton(wxWindow* parent, wxWindowID id,
135 const wxBitmap& label,
136 const wxPoint& pos = wxDefaultPosition,
137 const wxSize& size = wxDefaultSize,
138 long style = 0,
139 const wxValidator& val = wxDefaultValidator,
140 const wxString& name = "checkBox");
141 //@}
142
143 /**
144 Create method for two-step construction.
145 */
146 bool Create(wxWindow* parent, wxWindowID id,
147 const wxBitmap& label,
148 const wxPoint& pos = wxDefaultPosition,
149 const wxSize& size = wxDefaultSize,
150 long style = 0,
151 const wxValidator& val = wxDefaultValidator,
152 const wxString& name = "checkBox");
153
154 /**
155 Gets the state of the toggle button.
156
157 @return Returns @true if it is pressed, @false otherwise.
158 */
159 virtual bool GetValue() const;
160
161 /**
162 Sets the toggle button to the given state. This does not cause a
163 @c EVT_TOGGLEBUTTON event to be emitted.
164
165 @param state
166 If @true, the button is pressed.
167 */
168 virtual void SetValue(bool state);
169 };
170