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