]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/tglbtn.h
Use an enum for the colour/string conversion flags
[wxWidgets.git] / include / wx / gtk / tglbtn.h
CommitLineData
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
526954c5 10// Licence: wxWindows licence
1db8dc4a
VZ
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_GTK_TOGGLEBUTTON_H_
14#define _WX_GTK_TOGGLEBUTTON_H_
15
4f856067
RR
16#include "wx/bitmap.h"
17
1db8dc4a
VZ
18//-----------------------------------------------------------------------------
19// classes
20//-----------------------------------------------------------------------------
21
b5dbe15d
VS
22class WXDLLIMPEXP_FWD_CORE wxToggleButton;
23class WXDLLIMPEXP_FWD_CORE wxToggleBitmapButton;
1db8dc4a
VZ
24
25//-----------------------------------------------------------------------------
26// global data
27//-----------------------------------------------------------------------------
28
23318a53 29extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
1db8dc4a 30
4f856067 31//-----------------------------------------------------------------------------
10ff9c61 32// wxBitmapToggleButton
4f856067
RR
33//-----------------------------------------------------------------------------
34
10ff9c61 35class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
4f856067
RR
36{
37public:
38 // construction/destruction
10ff9c61
RR
39 wxBitmapToggleButton() {}
40 wxBitmapToggleButton(wxWindow *parent,
4f856067
RR
41 wxWindowID id,
42 const wxBitmap& label,
43 const wxPoint& pos = wxDefaultPosition,
44 const wxSize& size = wxDefaultSize,
45 long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxCheckBoxNameStr)
48 {
49 Create(parent, id, label, pos, size, style, validator, name);
50 }
51
52 // Create the control
53 bool Create(wxWindow *parent,
54 wxWindowID id,
55 const wxBitmap& label,
56 const wxPoint& pos = wxDefaultPosition,
57 const wxSize& size = wxDefaultSize, long style = 0,
58 const wxValidator& validator = wxDefaultValidator,
59 const wxString& name = wxCheckBoxNameStr);
60
61 // Get/set the value
62 void SetValue(bool state);
63 bool GetValue() const;
64
65 // Set the label
17a1ebd1
VZ
66 virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
67 virtual void SetLabel(const wxBitmap& label);
8e6efd1f 68 bool Enable(bool enable = true);
4f856067 69
9d522606
RD
70 static wxVisualAttributes
71 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
72
4f856067 73 // implementation
4f856067
RR
74 wxBitmap m_bitmap;
75
76 void OnSetBitmap();
6f02a879
VZ
77
78protected:
c71ab7c1
RR
79 void GTKDisableEvents();
80 void GTKEnableEvents();
23318a53 81
4f856067 82 virtual wxSize DoGetBestSize() const;
ef5c70f9
VZ
83 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
84 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
4f856067
RR
85
86private:
b545684e
PC
87 typedef wxToggleButtonBase base_type;
88
10ff9c61 89 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
4f856067 90};
9d522606 91
1db8dc4a
VZ
92//-----------------------------------------------------------------------------
93// wxToggleButton
94//-----------------------------------------------------------------------------
95
10ff9c61 96class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
1db8dc4a
VZ
97{
98public:
99 // construction/destruction
100 wxToggleButton() {}
101 wxToggleButton(wxWindow *parent,
102 wxWindowID id,
103 const wxString& label,
104 const wxPoint& pos = wxDefaultPosition,
105 const wxSize& size = wxDefaultSize,
106 long style = 0,
107 const wxValidator& validator = wxDefaultValidator,
108 const wxString& name = wxCheckBoxNameStr)
109 {
110 Create(parent, id, label, pos, size, style, validator, name);
111 }
112
113 // Create the control
114 bool Create(wxWindow *parent,
115 wxWindowID id,
116 const wxString& label,
117 const wxPoint& pos = wxDefaultPosition,
118 const wxSize& size = wxDefaultSize, long style = 0,
119 const wxValidator& validator = wxDefaultValidator,
120 const wxString& name = wxCheckBoxNameStr);
121
122 // Get/set the value
123 void SetValue(bool state);
124 bool GetValue() const;
125
126 // Set the label
127 void SetLabel(const wxString& label);
8e6efd1f 128 bool Enable(bool enable = true);
1db8dc4a 129
9d522606
RD
130 static wxVisualAttributes
131 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
23318a53 132
6f02a879 133protected:
c71ab7c1
RR
134 void GTKDisableEvents();
135 void GTKEnableEvents();
23318a53 136
1db8dc4a 137 virtual wxSize DoGetBestSize() const;
ef5c70f9
VZ
138 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
139 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
1db8dc4a
VZ
140
141private:
b545684e
PC
142 typedef wxToggleButtonBase base_type;
143
1db8dc4a
VZ
144 DECLARE_DYNAMIC_CLASS(wxToggleButton)
145};
146
147#endif // _WX_GTK_TOGGLEBUTTON_H_
148