Source cleaning: whitespaces,-1/wxID_ANY,TRUE/true,FALSE/false.
[wxWidgets.git] / include / wx / msw / button.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/button.h
3 // Purpose: wxButton 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_BUTTON_H_
13 #define _WX_BUTTON_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "button.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // Pushbutton
21 // ----------------------------------------------------------------------------
22
23 class WXDLLEXPORT wxButton : public wxButtonBase
24 {
25 public:
26 wxButton() { }
27 wxButton(wxWindow *parent,
28 wxWindowID id,
29 const wxString& label,
30 const wxPoint& pos = wxDefaultPosition,
31 const wxSize& size = wxDefaultSize,
32 long style = 0,
33 const wxValidator& validator = wxDefaultValidator,
34 const wxString& name = wxButtonNameStr)
35 {
36 Create(parent, id, label, pos, size, style, validator, name);
37 }
38
39 wxButton(wxWindow *parent, wxWindowID id, wxStockItemID stock,
40 const wxString& descriptiveLabel = wxEmptyString,
41 const wxPoint& pos = wxDefaultPosition,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxButtonNameStr)
45 {
46 Create(parent, id, stock, descriptiveLabel, pos, style, validator, name);
47 }
48
49 bool Create(wxWindow *parent, wxWindowID id, wxStockItemID stock,
50 const wxString& descriptiveLabel = wxEmptyString,
51 const wxPoint& pos = wxDefaultPosition,
52 long style = 0,
53 const wxValidator& validator = wxDefaultValidator,
54 const wxString& name = wxButtonNameStr)
55 {
56 return CreateStock(parent, id, stock, descriptiveLabel,
57 pos, style, validator, name);
58 }
59
60 bool Create(wxWindow *parent,
61 wxWindowID id,
62 const wxString& label,
63 const wxPoint& pos = wxDefaultPosition,
64 const wxSize& size = wxDefaultSize,
65 long style = 0,
66 const wxValidator& validator = wxDefaultValidator,
67 const wxString& name = wxButtonNameStr);
68
69 virtual ~wxButton();
70
71 virtual void SetDefault();
72
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);
77
78 virtual void ApplyParentThemeBackground(const wxColour& bg)
79 {
80 // avoide switching into owner-drawn mode
81 wxControl::SetBackgroundColour(bg);
82 }
83
84 #ifdef __WIN32__
85 // coloured buttons support
86 virtual bool SetBackgroundColour(const wxColour &colour);
87 virtual bool SetForegroundColour(const wxColour &colour);
88
89 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
90
91 private:
92 void MakeOwnerDrawn();
93 #endif // __WIN32__
94
95 protected:
96 // send a notification event, return true if processed
97 bool SendClickEvent();
98
99 // default button handling
100 void SetTmpDefault();
101 void UnsetTmpDefault();
102
103 // set or unset BS_DEFPUSHBUTTON style
104 static void SetDefaultStyle(wxButton *btn, bool on);
105
106 // usually overridden base class virtuals
107 virtual wxSize DoGetBestSize() const;
108 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const ;
109
110 private:
111 DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton)
112 };
113
114 #endif
115 // _WX_BUTTON_H_