]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/gtk/tglbtn.h
Don't define __STRICT_ANSI__, we should build both with and without it.
[wxWidgets.git] / include / wx / gtk / tglbtn.h
... / ...
CommitLineData
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// Copyright: (c) 2000 Johnny C. Norris II
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_GTK_TOGGLEBUTTON_H_
13#define _WX_GTK_TOGGLEBUTTON_H_
14
15#include "wx/bitmap.h"
16
17//-----------------------------------------------------------------------------
18// wxToggleButton
19//-----------------------------------------------------------------------------
20
21class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
22{
23public:
24 // construction/destruction
25 wxToggleButton() {}
26 wxToggleButton(wxWindow *parent,
27 wxWindowID id,
28 const wxString& label,
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,
41 const wxString& label,
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
52 void SetLabel(const wxString& label);
53
54 static wxVisualAttributes
55 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
56
57protected:
58 void GTKDisableEvents();
59 void GTKEnableEvents();
60
61 virtual wxSize DoGetBestSize() const;
62 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
63
64#if wxUSE_MARKUP
65 virtual bool DoSetLabelMarkup(const wxString& markup);
66#endif // wxUSE_MARKUP
67
68private:
69 typedef wxToggleButtonBase base_type;
70
71 // Return the GtkLabel used by this toggle button.
72 GtkLabel *GTKGetLabel() const;
73
74 DECLARE_DYNAMIC_CLASS(wxToggleButton)
75};
76
77//-----------------------------------------------------------------------------
78// wxBitmapToggleButton
79//-----------------------------------------------------------------------------
80
81class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButton
82{
83public:
84 // construction/destruction
85 wxBitmapToggleButton() {}
86 wxBitmapToggleButton(wxWindow *parent,
87 wxWindowID id,
88 const wxBitmap& label,
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,
101 const wxBitmap& label,
102 const wxPoint& pos = wxDefaultPosition,
103 const wxSize& size = wxDefaultSize, long style = 0,
104 const wxValidator& validator = wxDefaultValidator,
105 const wxString& name = wxCheckBoxNameStr);
106
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); }
112
113private:
114 typedef wxToggleButtonBase base_type;
115
116 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
117};
118
119#endif // _WX_GTK_TOGGLEBUTTON_H_
120