]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/tglbtn.h
Suppress 'unused argument' warnings
[wxWidgets.git] / include / wx / msw / tglbtn.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/tglbtn.h
3 // Purpose: Declaration of the wxToggleButton class, which implements a
4 // toggle button under wxMSW.
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
10 // License: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
12
13 #ifndef _WX_TOGGLEBUTTON_H_
14 #define _WX_TOGGLEBUTTON_H_
15
16 #include "wx/bitmap.h"
17
18 extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
19
20 //-----------------------------------------------------------------------------
21 // wxBitmapToggleButton
22 //-----------------------------------------------------------------------------
23
24
25 class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
26 {
27 public:
28 // construction/destruction
29 wxBitmapToggleButton() { Init(); }
30 wxBitmapToggleButton(wxWindow *parent,
31 wxWindowID id,
32 const wxBitmap& label,
33 const wxPoint& pos = wxDefaultPosition,
34 const wxSize& size = wxDefaultSize,
35 long style = 0,
36 const wxValidator& validator = wxDefaultValidator,
37 const wxString& name = wxCheckBoxNameStr)
38 {
39 Create(parent, id, label, pos, size, style, validator, name);
40 }
41
42 // Create the control
43 bool Create(wxWindow *parent,
44 wxWindowID id,
45 const wxBitmap& label,
46 const wxPoint& pos = wxDefaultPosition,
47 const wxSize& size = wxDefaultSize, long style = 0,
48 const wxValidator& validator = wxDefaultValidator,
49 const wxString& name = wxCheckBoxNameStr);
50
51 // Get/set the value
52 void SetValue(bool state);
53 bool GetValue() const;
54
55 // Set the label
56 virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
57 virtual void SetLabel(const wxBitmap& label);
58 bool Enable(bool enable = true);
59
60 protected:
61 void Init();
62
63 wxBitmap m_bitmap;
64 wxBitmap m_disabledBitmap;
65 bool m_capturing;
66 bool m_depressed,m_oldValue;
67
68 void OnPaint(wxPaintEvent &event);
69 void OnMouse(wxMouseEvent &event);
70 void OnChar(wxKeyEvent &event);
71 void OnSize(wxSizeEvent &event);
72
73 virtual wxSize DoGetBestSize() const;
74
75 private:
76 DECLARE_EVENT_TABLE()
77 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
78 };
79
80 // Checkbox item (single checkbox)
81 class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
82 {
83 public:
84 wxToggleButton() {}
85 wxToggleButton(wxWindow *parent,
86 wxWindowID id,
87 const wxString& label,
88 const wxPoint& pos = wxDefaultPosition,
89 const wxSize& size = wxDefaultSize,
90 long style = 0,
91 const wxValidator& validator = wxDefaultValidator,
92 const wxString& name = wxCheckBoxNameStr)
93 {
94 Create(parent, id, label, pos, size, style, validator, name);
95 }
96
97 bool Create(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 virtual void SetValue(bool value);
107 virtual bool GetValue() const ;
108
109 virtual void SetLabel(const wxString& label);
110
111 virtual bool MSWCommand(WXUINT param, WXWORD id);
112 virtual void Command(wxCommandEvent& event);
113
114 // returns true if the platform should explicitly apply a theme border
115 virtual bool CanApplyThemeBorder() const { return false; }
116
117 protected:
118 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
119 virtual wxSize DoGetBestSize() const;
120
121 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
122
123 private:
124 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
125 };
126
127 #endif // _WX_TOGGLEBUTTON_H_
128