]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/tglbtn.h
Corrected problem of wrong paragraph receiving style in formatting dialog.
[wxWidgets.git] / interface / wx / tglbtn.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: tglbtn.h
e54c96f1 3// Purpose: interface of wxBitmapToggleButton
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
e54c96f1 9
23324ae1
FM
10/**
11 @class wxToggleButton
7c913512 12
23324ae1
FM
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.
7c913512 16
23324ae1 17 Since wxWidgets version 2.9.0 this control emits an update UI event.
7c913512 18
23324ae1 19 You can see wxToggleButton in action in the sixth page of the
e54c96f1 20 controls() sample.
7c913512 21
1f1d2182 22 @beginEventTable{wxCommandEvent}
8c6791e4 23 @event{EVT_TOGGLEBUTTON(id, func)}
23324ae1
FM
24 Handles a toggle button click event.
25 @endEventTable
7c913512 26
23324ae1
FM
27 @library{wxcore}
28 @category{ctrl}
0c7fe6f2 29 <!-- @appearance{togglebutton.png} -->
7c913512 30
e54c96f1 31 @see wxCheckBox, wxButton, wxBitmapToggleButton
23324ae1
FM
32*/
33class wxToggleButton : public wxControl
34{
35public:
36 //@{
37 /**
38 Constructor, creating and showing a toggle button.
3c4f71cc 39
7c913512 40 @param parent
4cc4bfaf 41 Parent window. Must not be @NULL.
7c913512 42 @param id
4cc4bfaf 43 Toggle button identifier. The value wxID_ANY indicates a default value.
7c913512 44 @param label
4cc4bfaf 45 Text to be displayed next to the toggle button.
7c913512 46 @param pos
4cc4bfaf
FM
47 Toggle button position. If wxDefaultPosition is specified then a
48 default position is chosen.
7c913512 49 @param size
4cc4bfaf
FM
50 Toggle button size. If wxDefaultSize is specified then a
51 default size is chosen.
7c913512 52 @param style
4cc4bfaf 53 Window style. See wxToggleButton.
7c913512 54 @param validator
4cc4bfaf 55 Window validator.
7c913512 56 @param name
4cc4bfaf 57 Window name.
3c4f71cc 58
4cc4bfaf 59 @see Create(), wxValidator
23324ae1
FM
60 */
61 wxToggleButton();
7c913512
FM
62 wxToggleButton(wxWindow* parent, wxWindowID id,
63 const wxString& label,
64 const wxPoint& pos = wxDefaultPosition,
65 const wxSize& size = wxDefaultSize,
66 long style = 0,
a6052817 67 const wxValidator& val = wxDefaultValidator,
7c913512 68 const wxString& name = "checkBox");
23324ae1
FM
69 //@}
70
71 /**
72 Destructor, destroying the toggle button.
73 */
a6052817 74 virtual ~wxToggleButton();
23324ae1
FM
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,
a6052817 85 const wxValidator& val = wxDefaultValidator,
23324ae1
FM
86 const wxString& name = "checkBox");
87
88 /**
89 Gets the state of the toggle button.
3c4f71cc 90
d29a9a8a 91 @return Returns @true if it is pressed, @false otherwise.
23324ae1 92 */
328f5751 93 bool GetValue() const;
23324ae1
FM
94
95 /**
96 Sets the toggle button to the given state. This does not cause a
97 @c EVT_TOGGLEBUTTON event to be emitted.
3c4f71cc 98
7c913512 99 @param state
4cc4bfaf 100 If @true, the button is pressed.
23324ae1
FM
101 */
102 void SetValue(bool state);
103};
e54c96f1 104
a6052817
FM
105
106/**
107 @class wxBitmapToggleButton
a6052817
FM
108
109 wxBitmapToggleButton is a wxToggleButton
110 that contains a bitmap instead of text.
111
112 This control emits an update UI event.
113
1f1d2182 114 @beginEventTable{wxCommandEvent}
8c6791e4 115 @event{EVT_TOGGLEBUTTON(id, func)}
a6052817
FM
116 Handles a toggle button click event.
117 @endEventTable
118
119 @library{wxcore}
120 @category{ctrl}
0c7fe6f2 121 <!-- @appearance{bitmaptogglebutton.png} -->
a6052817
FM
122*/
123class wxBitmapToggleButton : public wxControl
124{
125public:
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
d29a9a8a 155 @return Returns @true if it is pressed, @false otherwise.
a6052817
FM
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