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