]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/tglbtn.h
synchronize GTK2 minimum version in docs
[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 24
4f856067 25//-----------------------------------------------------------------------------
b4354db1 26// wxToggleButton
4f856067
RR
27//-----------------------------------------------------------------------------
28
b4354db1 29class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
4f856067
RR
30{
31public:
32 // construction/destruction
b4354db1
VZ
33 wxToggleButton() {}
34 wxToggleButton(wxWindow *parent,
4f856067 35 wxWindowID id,
b4354db1 36 const wxString& label,
4f856067
RR
37 const wxPoint& pos = wxDefaultPosition,
38 const wxSize& size = wxDefaultSize,
39 long style = 0,
40 const wxValidator& validator = wxDefaultValidator,
41 const wxString& name = wxCheckBoxNameStr)
42 {
43 Create(parent, id, label, pos, size, style, validator, name);
44 }
45
46 // Create the control
47 bool Create(wxWindow *parent,
48 wxWindowID id,
b4354db1 49 const wxString& label,
4f856067
RR
50 const wxPoint& pos = wxDefaultPosition,
51 const wxSize& size = wxDefaultSize, long style = 0,
52 const wxValidator& validator = wxDefaultValidator,
53 const wxString& name = wxCheckBoxNameStr);
54
55 // Get/set the value
56 void SetValue(bool state);
57 bool GetValue() const;
58
59 // Set the label
b4354db1 60 void SetLabel(const wxString& label);
4f856067 61
9d522606
RD
62 static wxVisualAttributes
63 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
64
6f02a879 65protected:
c71ab7c1
RR
66 void GTKDisableEvents();
67 void GTKEnableEvents();
23318a53 68
4f856067 69 virtual wxSize DoGetBestSize() const;
ef5c70f9 70 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
b4354db1
VZ
71
72#if wxUSE_MARKUP
73 virtual bool DoSetLabelMarkup(const wxString& markup);
74#endif // wxUSE_MARKUP
4f856067
RR
75
76private:
b545684e
PC
77 typedef wxToggleButtonBase base_type;
78
b4354db1
VZ
79 // Return the GtkLabel used by this toggle button.
80 GtkLabel *GTKGetLabel() const;
81
82 DECLARE_DYNAMIC_CLASS(wxToggleButton)
4f856067 83};
9d522606 84
1db8dc4a 85//-----------------------------------------------------------------------------
b4354db1 86// wxBitmapToggleButton
1db8dc4a
VZ
87//-----------------------------------------------------------------------------
88
b4354db1 89class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
1db8dc4a
VZ
90{
91public:
92 // construction/destruction
b4354db1
VZ
93 wxBitmapToggleButton() {}
94 wxBitmapToggleButton(wxWindow *parent,
1db8dc4a 95 wxWindowID id,
b4354db1 96 const wxBitmap& label,
1db8dc4a
VZ
97 const wxPoint& pos = wxDefaultPosition,
98 const wxSize& size = wxDefaultSize,
99 long style = 0,
100 const wxValidator& validator = wxDefaultValidator,
101 const wxString& name = wxCheckBoxNameStr)
102 {
103 Create(parent, id, label, pos, size, style, validator, name);
104 }
105
106 // Create the control
107 bool Create(wxWindow *parent,
108 wxWindowID id,
b4354db1 109 const wxBitmap& label,
1db8dc4a
VZ
110 const wxPoint& pos = wxDefaultPosition,
111 const wxSize& size = wxDefaultSize, long style = 0,
112 const wxValidator& validator = wxDefaultValidator,
113 const wxString& name = wxCheckBoxNameStr);
114
b4354db1
VZ
115 // deprecated synonym for SetBitmapLabel()
116 wxDEPRECATED_INLINE( void SetLabel(const wxBitmap& bitmap),
117 SetBitmapLabel(bitmap); )
118 // prevent virtual function hiding
119 virtual void SetLabel(const wxString& label) { wxToggleButton::SetLabel(label); }
1db8dc4a
VZ
120
121private:
b545684e
PC
122 typedef wxToggleButtonBase base_type;
123
b4354db1 124 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
1db8dc4a
VZ
125};
126
127#endif // _WX_GTK_TOGGLEBUTTON_H_
128