]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/tglbtn.h
fix parsing of IP literals in URIs, added test for it
[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 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. If wxDefaultPosition is specified then a
52 default position is chosen.
53 @param size
54 Toggle button size. If wxDefaultSize is specified then a
55 default size is chosen.
56 @param style
57 Window style. See wxToggleButton.
58 @param validator
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. See wxToggleButton()
80 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 bool GetValue() const;
96
97 /**
98 Sets the toggle button to the given state. This does not cause a
99 @c EVT_TOGGLEBUTTON event to be emitted.
100
101 @param state
102 If @true, the button is pressed.
103 */
104 void SetValue(bool state);
105 };
106
107
108 /**
109 @class wxBitmapToggleButton
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 Default constructor.
130 */
131 wxBitmapToggleButton();
132
133 /**
134 Constructor, creating and showing a toggle button with the bitmap @e label.
135 Internally calls Create().
136 */
137 wxBitmapToggleButton(wxWindow* parent, wxWindowID id,
138 const wxBitmap& label,
139 const wxPoint& pos = wxDefaultPosition,
140 const wxSize& size = wxDefaultSize,
141 long style = 0,
142 const wxValidator& val = wxDefaultValidator,
143 const wxString& name = wxCheckBoxNameStr);
144
145 /**
146 Create method for two-step construction.
147 */
148 bool Create(wxWindow* parent, wxWindowID id,
149 const wxBitmap& label,
150 const wxPoint& pos = wxDefaultPosition,
151 const wxSize& size = wxDefaultSize,
152 long style = 0,
153 const wxValidator& val = wxDefaultValidator,
154 const wxString& name = wxCheckBoxNameStr);
155
156 /**
157 Gets the state of the toggle button.
158
159 @return Returns @true if it is pressed, @false otherwise.
160 */
161 virtual bool GetValue() const;
162
163 /**
164 Sets the toggle button to the given state. This does not cause a
165 @c EVT_TOGGLEBUTTON event to be emitted.
166
167 @param state
168 If @true, the button is pressed.
169 */
170 virtual void SetValue(bool state);
171 };
172