]>
Commit | Line | Data |
---|---|---|
1db8dc4a VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/gtk/tglbtn.h | |
3 | // Purpose: Declaration of the wxToggleButton class, which implements a | |
4 | // toggle button under wxGTK. | |
5 | // Author: John Norris, minor changes by Axel Schlueter | |
6 | // Modified by: | |
7 | // Created: 08.02.01 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2000 Johnny C. Norris II | |
10 | // License: Rocketeer license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | #ifndef _WX_GTK_TOGGLEBUTTON_H_ | |
14 | #define _WX_GTK_TOGGLEBUTTON_H_ | |
15 | ||
16 | //----------------------------------------------------------------------------- | |
17 | // classes | |
18 | //----------------------------------------------------------------------------- | |
19 | ||
20 | class wxToggleButton; | |
21 | ||
22 | //----------------------------------------------------------------------------- | |
23 | // global data | |
24 | //----------------------------------------------------------------------------- | |
25 | ||
26 | extern const char *wxCheckBoxNameStr; | |
27 | ||
28 | //----------------------------------------------------------------------------- | |
29 | // wxToggleButton | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
32 | class wxToggleButton: public wxControl | |
33 | { | |
34 | public: | |
35 | // construction/destruction | |
36 | wxToggleButton() {} | |
37 | wxToggleButton(wxWindow *parent, | |
38 | wxWindowID id, | |
39 | const wxString& label, | |
40 | const wxPoint& pos = wxDefaultPosition, | |
41 | const wxSize& size = wxDefaultSize, | |
42 | long style = 0, | |
43 | const wxValidator& validator = wxDefaultValidator, | |
44 | const wxString& name = wxCheckBoxNameStr) | |
45 | { | |
46 | Create(parent, id, label, pos, size, style, validator, name); | |
47 | } | |
48 | ||
49 | // Create the control | |
50 | bool Create(wxWindow *parent, | |
51 | wxWindowID id, | |
52 | const wxString& label, | |
53 | const wxPoint& pos = wxDefaultPosition, | |
54 | const wxSize& size = wxDefaultSize, long style = 0, | |
55 | const wxValidator& validator = wxDefaultValidator, | |
56 | const wxString& name = wxCheckBoxNameStr); | |
57 | ||
58 | // Get/set the value | |
59 | void SetValue(bool state); | |
60 | bool GetValue() const; | |
61 | ||
62 | // Set the label | |
63 | void SetLabel(const wxString& label); | |
64 | bool Enable(bool enable = TRUE); | |
65 | ||
66 | protected: | |
67 | // Callback function given to gtk | |
68 | static void gtk_togglebutton_clicked_callback(GtkWidget *widget, | |
69 | wxToggleButton *win); | |
70 | ||
71 | // wx stuff | |
72 | void ApplyWidgetStyle(); | |
73 | bool IsOwnGtkWindow(GdkWindow *window); | |
74 | ||
75 | virtual void OnInternalIdle(); | |
76 | virtual wxSize DoGetBestSize() const; | |
77 | ||
78 | private: | |
79 | DECLARE_DYNAMIC_CLASS(wxToggleButton) | |
80 | }; | |
81 | ||
82 | #endif // _WX_GTK_TOGGLEBUTTON_H_ | |
83 |