]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/button.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/button.h
3 // Purpose: wxButton class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "button.h"
19 // ----------------------------------------------------------------------------
21 // ----------------------------------------------------------------------------
23 class WXDLLEXPORT wxButton
: public wxButtonBase
27 wxButton(wxWindow
*parent
,
29 const wxString
& label
,
30 const wxPoint
& pos
= wxDefaultPosition
,
31 const wxSize
& size
= wxDefaultSize
,
33 const wxValidator
& validator
= wxDefaultValidator
,
34 const wxString
& name
= wxButtonNameStr
)
36 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
39 wxButton(wxWindow
*parent
, wxWindowID id
, wxStockItemID stock
,
40 const wxString
& descriptiveLabel
= wxEmptyString
,
41 const wxPoint
& pos
= wxDefaultPosition
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxButtonNameStr
)
46 Create(parent
, id
, stock
, descriptiveLabel
, pos
, style
, validator
, name
);
49 bool Create(wxWindow
*parent
, wxWindowID id
, wxStockItemID stock
,
50 const wxString
& descriptiveLabel
= wxEmptyString
,
51 const wxPoint
& pos
= wxDefaultPosition
,
53 const wxValidator
& validator
= wxDefaultValidator
,
54 const wxString
& name
= wxButtonNameStr
)
56 return CreateStock(parent
, id
, stock
, descriptiveLabel
,
57 pos
, style
, validator
, name
);
60 bool Create(wxWindow
*parent
,
62 const wxString
& label
,
63 const wxPoint
& pos
= wxDefaultPosition
,
64 const wxSize
& size
= wxDefaultSize
,
66 const wxValidator
& validator
= wxDefaultValidator
,
67 const wxString
& name
= wxButtonNameStr
);
71 virtual void SetDefault();
73 // implementation from now on
74 virtual void Command(wxCommandEvent
& event
);
75 virtual WXLRESULT
MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
);
76 virtual bool MSWCommand(WXUINT param
, WXWORD id
);
78 virtual void ApplyParentThemeBackground(const wxColour
& bg
)
80 // avoide switching into owner-drawn mode
81 wxControl::SetBackgroundColour(bg
);
85 // coloured buttons support
86 virtual bool SetBackgroundColour(const wxColour
&colour
);
87 virtual bool SetForegroundColour(const wxColour
&colour
);
89 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
92 void MakeOwnerDrawn();
96 // send a notification event, return true if processed
97 bool SendClickEvent();
99 // default button handling
100 void SetTmpDefault();
101 void UnsetTmpDefault();
103 // set or unset BS_DEFPUSHBUTTON style
104 static void SetDefaultStyle(wxButton
*btn
, bool on
);
106 // usually overridden base class virtuals
107 virtual wxSize
DoGetBestSize() const;
108 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const ;
111 DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton
)