]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/tglbtn.h
Application of the most recent wxWebView patch, the only changes were so tab to space...
[wxWidgets.git] / include / wx / msw / tglbtn.h
CommitLineData
1db8dc4a
VZ
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
526954c5 10// Licence: wxWindows licence
1db8dc4a
VZ
11/////////////////////////////////////////////////////////////////////////////
12
13#ifndef _WX_TOGGLEBUTTON_H_
14#define _WX_TOGGLEBUTTON_H_
15
76c13f8f
RR
16#include "wx/bitmap.h"
17
76c13f8f
RR
18//-----------------------------------------------------------------------------
19// wxBitmapToggleButton
20//-----------------------------------------------------------------------------
21
22
23class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
24{
25public:
26 // construction/destruction
27 wxBitmapToggleButton() { Init(); }
28 wxBitmapToggleButton(wxWindow *parent,
29 wxWindowID id,
30 const wxBitmap& label,
31 const wxPoint& pos = wxDefaultPosition,
32 const wxSize& size = wxDefaultSize,
33 long style = 0,
34 const wxValidator& validator = wxDefaultValidator,
35 const wxString& name = wxCheckBoxNameStr)
36 {
37 Create(parent, id, label, pos, size, style, validator, name);
38 }
39
40 // Create the control
41 bool Create(wxWindow *parent,
42 wxWindowID id,
43 const wxBitmap& label,
44 const wxPoint& pos = wxDefaultPosition,
45 const wxSize& size = wxDefaultSize, long style = 0,
46 const wxValidator& validator = wxDefaultValidator,
47 const wxString& name = wxCheckBoxNameStr);
48
49 // Get/set the value
50 void SetValue(bool state);
51 bool GetValue() const;
52
53 // Set the label
54 virtual void SetLabel(const wxString& label) { wxControl::SetLabel(label); }
55 virtual void SetLabel(const wxBitmap& label);
8e6efd1f 56 bool Enable(bool enable = true);
76c13f8f
RR
57
58protected:
59 void Init();
03647350 60
76c13f8f
RR
61 wxBitmap m_bitmap;
62 wxBitmap m_disabledBitmap;
63 bool m_capturing;
64 bool m_depressed,m_oldValue;
03647350 65
76c13f8f
RR
66 void OnPaint(wxPaintEvent &event);
67 void OnMouse(wxMouseEvent &event);
68 void OnChar(wxKeyEvent &event);
69 void OnSize(wxSizeEvent &event);
70
71 virtual wxSize DoGetBestSize() const;
72
73private:
74 DECLARE_EVENT_TABLE()
75 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
76};
77
1db8dc4a 78// Checkbox item (single checkbox)
53a2db12 79class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
1db8dc4a
VZ
80{
81public:
82 wxToggleButton() {}
83 wxToggleButton(wxWindow *parent,
84 wxWindowID id,
85 const wxString& label,
86 const wxPoint& pos = wxDefaultPosition,
87 const wxSize& size = wxDefaultSize,
88 long style = 0,
89 const wxValidator& validator = wxDefaultValidator,
90 const wxString& name = wxCheckBoxNameStr)
91 {
92 Create(parent, id, label, pos, size, style, validator, name);
93 }
94
95 bool Create(wxWindow *parent,
96 wxWindowID id,
97 const wxString& label,
98 const wxPoint& pos = wxDefaultPosition,
99 const wxSize& size = wxDefaultSize,
100 long style = 0,
101 const wxValidator& validator = wxDefaultValidator,
102 const wxString& name = wxCheckBoxNameStr);
103
104 virtual void SetValue(bool value);
105 virtual bool GetValue() const ;
106
9016f3ad
VZ
107 virtual void SetLabel(const wxString& label);
108
1db8dc4a 109 virtual bool MSWCommand(WXUINT param, WXWORD id);
1db8dc4a
VZ
110 virtual void Command(wxCommandEvent& event);
111
a047aff2
JS
112 // returns true if the platform should explicitly apply a theme border
113 virtual bool CanApplyThemeBorder() const { return false; }
114
1db8dc4a 115protected:
dc797d8e 116 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
1db8dc4a
VZ
117 virtual wxSize DoGetBestSize() const;
118
9016f3ad
VZ
119 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
120
1db8dc4a 121private:
2eb10e2a 122 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
1db8dc4a
VZ
123};
124
125#endif // _WX_TOGGLEBUTTON_H_
126