]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/tglbtn.h
Added a wxRichTextCtrl-specific caret implementation in case of need
[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
706fb893 10// License: 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
f36e602b 29extern WXDLLIMPEXP_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);
4f856067
RR
68 bool Enable(bool enable = TRUE);
69
9d522606
RD
70 static wxVisualAttributes
71 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
72
4f856067
RR
73 // implementation
74 bool m_blockEvent;
75 wxBitmap m_bitmap;
76
77 void OnSetBitmap();
6f02a879
VZ
78
79protected:
4f856067 80 virtual wxSize DoGetBestSize() const;
ef5c70f9
VZ
81 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
82 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
4f856067
RR
83
84private:
10ff9c61 85 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
4f856067 86};
9d522606 87
1db8dc4a
VZ
88//-----------------------------------------------------------------------------
89// wxToggleButton
90//-----------------------------------------------------------------------------
91
10ff9c61 92class WXDLLIMPEXP_CORE wxToggleButton: public wxToggleButtonBase
1db8dc4a
VZ
93{
94public:
95 // construction/destruction
96 wxToggleButton() {}
97 wxToggleButton(wxWindow *parent,
98 wxWindowID id,
99 const wxString& label,
100 const wxPoint& pos = wxDefaultPosition,
101 const wxSize& size = wxDefaultSize,
102 long style = 0,
103 const wxValidator& validator = wxDefaultValidator,
104 const wxString& name = wxCheckBoxNameStr)
105 {
106 Create(parent, id, label, pos, size, style, validator, name);
107 }
108
109 // Create the control
110 bool Create(wxWindow *parent,
111 wxWindowID id,
112 const wxString& label,
113 const wxPoint& pos = wxDefaultPosition,
114 const wxSize& size = wxDefaultSize, long style = 0,
115 const wxValidator& validator = wxDefaultValidator,
116 const wxString& name = wxCheckBoxNameStr);
117
118 // Get/set the value
119 void SetValue(bool state);
120 bool GetValue() const;
121
122 // Set the label
123 void SetLabel(const wxString& label);
124 bool Enable(bool enable = TRUE);
125
9d522606
RD
126 static wxVisualAttributes
127 GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
9864c56d
RR
128
129 // implementation
130 bool m_blockEvent;
1db8dc4a 131
6f02a879 132protected:
1db8dc4a 133 virtual wxSize DoGetBestSize() const;
ef5c70f9
VZ
134 virtual void DoApplyWidgetStyle(GtkRcStyle *style);
135 virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
1db8dc4a
VZ
136
137private:
138 DECLARE_DYNAMIC_CLASS(wxToggleButton)
139};
140
141#endif // _WX_GTK_TOGGLEBUTTON_H_
142