]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
1e6feb95 | 2 | // Name: wx/msw/button.h |
2bda0e17 KB |
3 | // Purpose: wxButton class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
7 | // RCS-ID: $Id$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_BUTTON_H_ |
13 | #define _WX_BUTTON_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
2bda0e17 KB |
16 | #pragma interface "button.h" |
17 | #endif | |
18 | ||
edccf428 | 19 | // ---------------------------------------------------------------------------- |
2bda0e17 | 20 | // Pushbutton |
edccf428 VZ |
21 | // ---------------------------------------------------------------------------- |
22 | ||
1e6feb95 | 23 | class WXDLLEXPORT wxButton : public wxButtonBase |
2bda0e17 | 24 | { |
bfc6fde4 VZ |
25 | public: |
26 | wxButton() { } | |
1e6feb95 VZ |
27 | wxButton(wxWindow *parent, |
28 | wxWindowID id, | |
5f7bcb48 | 29 | const wxString& label = wxEmptyString, |
1e6feb95 VZ |
30 | const wxPoint& pos = wxDefaultPosition, |
31 | const wxSize& size = wxDefaultSize, | |
32 | long style = 0, | |
33 | const wxValidator& validator = wxDefaultValidator, | |
34 | const wxString& name = wxButtonNameStr) | |
bfc6fde4 VZ |
35 | { |
36 | Create(parent, id, label, pos, size, style, validator, name); | |
37 | } | |
fcf90ee1 | 38 | |
1e6feb95 VZ |
39 | bool Create(wxWindow *parent, |
40 | wxWindowID id, | |
5f7bcb48 | 41 | const wxString& label = wxEmptyString, |
1e6feb95 VZ |
42 | const wxPoint& pos = wxDefaultPosition, |
43 | const wxSize& size = wxDefaultSize, | |
44 | long style = 0, | |
45 | const wxValidator& validator = wxDefaultValidator, | |
46 | const wxString& name = wxButtonNameStr); | |
bfc6fde4 | 47 | |
edccf428 VZ |
48 | virtual ~wxButton(); |
49 | ||
bfc6fde4 | 50 | virtual void SetDefault(); |
edccf428 VZ |
51 | |
52 | // implementation from now on | |
bfc6fde4 | 53 | virtual void Command(wxCommandEvent& event); |
c140b7e7 | 54 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
bfc6fde4 | 55 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
bfc6fde4 | 56 | |
cc0bffac RD |
57 | virtual void ApplyParentThemeBackground(const wxColour& bg) |
58 | { | |
59 | // avoide switching into owner-drawn mode | |
60 | wxControl::SetBackgroundColour(bg); | |
61 | } | |
fcf90ee1 | 62 | |
cd0b1709 VZ |
63 | #ifdef __WIN32__ |
64 | // coloured buttons support | |
65 | virtual bool SetBackgroundColour(const wxColour &colour); | |
66 | virtual bool SetForegroundColour(const wxColour &colour); | |
67 | ||
68 | virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); | |
69 | ||
70 | private: | |
71 | void MakeOwnerDrawn(); | |
72 | #endif // __WIN32__ | |
73 | ||
bfc6fde4 | 74 | protected: |
fcf90ee1 | 75 | // send a notification event, return true if processed |
edccf428 VZ |
76 | bool SendClickEvent(); |
77 | ||
036da5e3 VZ |
78 | // default button handling |
79 | void SetTmpDefault(); | |
80 | void UnsetTmpDefault(); | |
81 | ||
7fb1b2b4 VZ |
82 | // set or unset BS_DEFPUSHBUTTON style |
83 | static void SetDefaultStyle(wxButton *btn, bool on); | |
036da5e3 | 84 | |
5b2f31eb | 85 | // usually overridden base class virtuals |
f68586e5 | 86 | virtual wxSize DoGetBestSize() const; |
fe3d9123 | 87 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const ; |
1e6feb95 VZ |
88 | |
89 | private: | |
fc7a2a60 | 90 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton) |
2bda0e17 KB |
91 | }; |
92 | ||
93 | #endif | |
bbcdf8bc | 94 | // _WX_BUTTON_H_ |