]>
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 | |
edccf428 | 15 | // ---------------------------------------------------------------------------- |
2bda0e17 | 16 | // Pushbutton |
edccf428 VZ |
17 | // ---------------------------------------------------------------------------- |
18 | ||
53a2db12 | 19 | class WXDLLIMPEXP_CORE wxButton : public wxButtonBase |
2bda0e17 | 20 | { |
bfc6fde4 | 21 | public: |
233f10bf | 22 | wxButton() { m_imageData = NULL; } |
1e6feb95 VZ |
23 | wxButton(wxWindow *parent, |
24 | wxWindowID id, | |
5f7bcb48 | 25 | const wxString& label = wxEmptyString, |
1e6feb95 VZ |
26 | const wxPoint& pos = wxDefaultPosition, |
27 | const wxSize& size = wxDefaultSize, | |
28 | long style = 0, | |
29 | const wxValidator& validator = wxDefaultValidator, | |
30 | const wxString& name = wxButtonNameStr) | |
bfc6fde4 | 31 | { |
233f10bf VZ |
32 | m_imageData = NULL; |
33 | ||
bfc6fde4 VZ |
34 | Create(parent, id, label, pos, size, style, validator, name); |
35 | } | |
fcf90ee1 | 36 | |
1e6feb95 VZ |
37 | bool Create(wxWindow *parent, |
38 | wxWindowID id, | |
5f7bcb48 | 39 | const wxString& label = wxEmptyString, |
1e6feb95 VZ |
40 | const wxPoint& pos = wxDefaultPosition, |
41 | const wxSize& size = wxDefaultSize, | |
42 | long style = 0, | |
43 | const wxValidator& validator = wxDefaultValidator, | |
44 | const wxString& name = wxButtonNameStr); | |
bfc6fde4 | 45 | |
edccf428 VZ |
46 | virtual ~wxButton(); |
47 | ||
94aff5ff | 48 | virtual wxWindow *SetDefault(); |
edccf428 | 49 | |
d94de683 VZ |
50 | // overridden base class methods |
51 | virtual void SetLabel(const wxString& label); | |
52 | virtual bool SetBackgroundColour(const wxColour &colour); | |
53 | virtual bool SetForegroundColour(const wxColour &colour); | |
54 | ||
edccf428 | 55 | // implementation from now on |
bfc6fde4 | 56 | virtual void Command(wxCommandEvent& event); |
c140b7e7 | 57 | virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam); |
bfc6fde4 | 58 | virtual bool MSWCommand(WXUINT param, WXWORD id); |
bfc6fde4 | 59 | |
cd0b1709 | 60 | virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item); |
6f02a879 | 61 | virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const; |
cd0b1709 | 62 | |
a047aff2 JS |
63 | // returns true if the platform should explicitly apply a theme border |
64 | virtual bool CanApplyThemeBorder() const { return false; } | |
65 | ||
cd0b1709 VZ |
66 | private: |
67 | void MakeOwnerDrawn(); | |
cd0b1709 | 68 | |
bfc6fde4 | 69 | protected: |
fcf90ee1 | 70 | // send a notification event, return true if processed |
edccf428 VZ |
71 | bool SendClickEvent(); |
72 | ||
036da5e3 VZ |
73 | // default button handling |
74 | void SetTmpDefault(); | |
75 | void UnsetTmpDefault(); | |
76 | ||
7fb1b2b4 VZ |
77 | // set or unset BS_DEFPUSHBUTTON style |
78 | static void SetDefaultStyle(wxButton *btn, bool on); | |
036da5e3 | 79 | |
5b2f31eb | 80 | // usually overridden base class virtuals |
f68586e5 | 81 | virtual wxSize DoGetBestSize() const; |
1e6feb95 | 82 | |
f2d7fdf7 VZ |
83 | virtual bool DoGetAuthNeeded() const; |
84 | virtual void DoSetAuthNeeded(bool show); | |
233f10bf VZ |
85 | virtual wxBitmap DoGetBitmap(State which) const; |
86 | virtual void DoSetBitmap(const wxBitmap& bitmap, State which); | |
a6fd73d3 | 87 | virtual wxSize DoGetBitmapMargins() const; |
233f10bf VZ |
88 | virtual void DoSetBitmapMargins(wxCoord x, wxCoord y); |
89 | virtual void DoSetBitmapPosition(wxDirection dir); | |
90 | ||
65034d07 VZ |
91 | // Increases the passed in size to account for the button image. |
92 | // | |
93 | // Should only be called if we do have a button, i.e. if m_imageData is | |
94 | // non-NULL. | |
3571e1ad VZ |
95 | void AdjustForBitmapSize(wxSize& size) const; |
96 | ||
233f10bf VZ |
97 | class wxButtonImageData *m_imageData; |
98 | ||
f2d7fdf7 VZ |
99 | // true if the UAC symbol is shown |
100 | bool m_authNeeded; | |
101 | ||
1e6feb95 | 102 | private: |
3571e1ad | 103 | wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton); |
2bda0e17 KB |
104 | }; |
105 | ||
d94de683 | 106 | #endif // _WX_BUTTON_H_ |