]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/checkbox.h
Revert HasModifiers() change in behaviour, add HasAnyModifiers().
[wxWidgets.git] / include / wx / msw / checkbox.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/checkbox.h
3 // Purpose: wxCheckBox class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_CHECKBOX_H_
13 #define _WX_CHECKBOX_H_
14
15 // Checkbox item (single checkbox)
16 class WXDLLIMPEXP_CORE wxCheckBox : public wxCheckBoxBase
17 {
18 public:
19 wxCheckBox() { }
20 wxCheckBox(wxWindow *parent,
21 wxWindowID id,
22 const wxString& label,
23 const wxPoint& pos = wxDefaultPosition,
24 const wxSize& size = wxDefaultSize,
25 long style = 0,
26 const wxValidator& validator = wxDefaultValidator,
27 const wxString& name = wxCheckBoxNameStr)
28 {
29 Create(parent, id, label, pos, size, style, validator, name);
30 }
31
32 bool Create(wxWindow *parent,
33 wxWindowID id,
34 const wxString& label,
35 const wxPoint& pos = wxDefaultPosition,
36 const wxSize& size = wxDefaultSize,
37 long style = 0,
38 const wxValidator& validator = wxDefaultValidator,
39 const wxString& name = wxCheckBoxNameStr);
40
41 virtual void SetValue(bool value);
42 virtual bool GetValue() const;
43
44 // override some base class virtuals
45 virtual void SetLabel(const wxString& label);
46
47 virtual bool MSWCommand(WXUINT param, WXWORD id);
48 virtual void Command(wxCommandEvent& event);
49 virtual bool SetForegroundColour(const wxColour& colour);
50 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
51
52 // returns true if the platform should explicitly apply a theme border
53 virtual bool CanApplyThemeBorder() const { return false; }
54
55 protected:
56 virtual wxSize DoGetBestSize() const;
57
58 virtual void DoSet3StateValue(wxCheckBoxState value);
59 virtual wxCheckBoxState DoGet3StateValue() const;
60
61 // make the checkbox owner drawn or reset it to normal style
62 void MakeOwnerDrawn(bool ownerDrawn);
63
64 // return true if this checkbox is owner drawn
65 bool IsOwnerDrawn() const;
66
67 private:
68 // common part of all ctors
69 void Init();
70
71 // event handlers used by owner-drawn checkbox
72 void OnMouseEnterOrLeave(wxMouseEvent& event);
73 void OnMouseLeft(wxMouseEvent& event);
74 void OnFocus(wxFocusEvent& event);
75
76
77 // current state of the checkbox
78 wxCheckBoxState m_state;
79
80 // true if the checkbox is currently pressed
81 bool m_isPressed;
82
83 // true if mouse is currently over the control
84 bool m_isHot;
85
86
87 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox)
88 };
89
90 #endif
91 // _WX_CHECKBOX_H_