]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/tglbtn.h
Added wxMSW wxBitmapComboBox::DoGetBestSize(), which takes bitmap size into account.
[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
706fb893 10// License: 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
53a2db12 18extern WXDLLIMPEXP_DATA_CORE(const char) wxCheckBoxNameStr[];
1db8dc4a 19
76c13f8f
RR
20//-----------------------------------------------------------------------------
21// wxBitmapToggleButton
22//-----------------------------------------------------------------------------
23
24
25class WXDLLIMPEXP_CORE wxBitmapToggleButton: public wxToggleButtonBase
26{
27public:
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
60protected:
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
75private:
76 DECLARE_EVENT_TABLE()
77 DECLARE_DYNAMIC_CLASS(wxBitmapToggleButton)
78};
79
1db8dc4a 80// Checkbox item (single checkbox)
53a2db12 81class WXDLLIMPEXP_CORE wxToggleButton : public wxToggleButtonBase
1db8dc4a
VZ
82{
83public:
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
9016f3ad
VZ
109 virtual void SetLabel(const wxString& label);
110
1db8dc4a 111 virtual bool MSWCommand(WXUINT param, WXWORD id);
1db8dc4a
VZ
112 virtual void Command(wxCommandEvent& event);
113
a047aff2
JS
114 // returns true if the platform should explicitly apply a theme border
115 virtual bool CanApplyThemeBorder() const { return false; }
116
1db8dc4a 117protected:
dc797d8e 118 virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
1db8dc4a
VZ
119 virtual wxSize DoGetBestSize() const;
120
9016f3ad
VZ
121 virtual WXDWORD MSWGetStyle(long flags, WXDWORD *exstyle = NULL) const;
122
1db8dc4a 123private:
2eb10e2a 124 DECLARE_DYNAMIC_CLASS_NO_COPY(wxToggleButton)
1db8dc4a
VZ
125};
126
127#endif // _WX_TOGGLEBUTTON_H_
128