1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/checkbox.h
3 // Purpose: wxCheckBox class
4 // Author: Julian Smart
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_CHECKBOX_H_
12 #define _WX_CHECKBOX_H_
14 // Checkbox item (single checkbox)
15 class WXDLLIMPEXP_CORE wxCheckBox
: public wxCheckBoxBase
19 wxCheckBox(wxWindow
*parent
,
21 const wxString
& label
,
22 const wxPoint
& pos
= wxDefaultPosition
,
23 const wxSize
& size
= wxDefaultSize
,
25 const wxValidator
& validator
= wxDefaultValidator
,
26 const wxString
& name
= wxCheckBoxNameStr
)
28 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
31 bool Create(wxWindow
*parent
,
33 const wxString
& label
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
,
37 const wxValidator
& validator
= wxDefaultValidator
,
38 const wxString
& name
= wxCheckBoxNameStr
);
40 virtual void SetValue(bool value
);
41 virtual bool GetValue() const;
43 // override some base class virtuals
44 virtual void SetLabel(const wxString
& label
);
46 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
47 virtual void Command(wxCommandEvent
& event
);
48 virtual bool SetForegroundColour(const wxColour
& colour
);
49 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
51 // returns true if the platform should explicitly apply a theme border
52 virtual bool CanApplyThemeBorder() const { return false; }
54 // make the checkbox owner drawn or reset it to normal style
55 void MSWMakeOwnerDrawn(bool ownerDrawn
);
57 // implementation only from now on
58 virtual WXDWORD
MSWGetStyle(long flags
, WXDWORD
*exstyle
= NULL
) const;
61 virtual wxSize
DoGetBestClientSize() const;
63 virtual void DoSet3StateValue(wxCheckBoxState value
);
64 virtual wxCheckBoxState
DoGet3StateValue() const;
66 // return true if this checkbox is owner drawn
67 bool IsOwnerDrawn() const;
70 // common part of all ctors
73 // event handlers used by owner-drawn checkbox
74 void OnMouseEnterOrLeave(wxMouseEvent
& event
);
75 void OnMouseLeft(wxMouseEvent
& event
);
76 void OnFocus(wxFocusEvent
& event
);
79 // current state of the checkbox
80 wxCheckBoxState m_state
;
82 // true if the checkbox is currently pressed
85 // true if mouse is currently over the control
89 DECLARE_DYNAMIC_CLASS_NO_COPY(wxCheckBox
)