]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/button.h
split wxControl::Ellipsize() in two functions for better readability of the code...
[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 // ----------------------------------------------------------------------------
16 // Pushbutton
17 // ----------------------------------------------------------------------------
18
19 class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
20 {
21 public:
22 wxButton() { }
23 wxButton(wxWindow *parent,
24 wxWindowID id,
25 const wxString& label = wxEmptyString,
26 const wxPoint& pos = wxDefaultPosition,
27 const wxSize& size = wxDefaultSize,
28 long style = 0,
29 const wxValidator& validator = wxDefaultValidator,
30 const wxString& name = wxButtonNameStr)
31 {
32 Create(parent, id, label, pos, size, style, validator, name);
33 }
34
35 bool Create(wxWindow *parent,
36 wxWindowID id,
37 const wxString& label = wxEmptyString,
38 const wxPoint& pos = wxDefaultPosition,
39 const wxSize& size = wxDefaultSize,
40 long style = 0,
41 const wxValidator& validator = wxDefaultValidator,
42 const wxString& name = wxButtonNameStr);
43
44 virtual ~wxButton();
45
46 virtual wxWindow *SetDefault();
47
48 // overridden base class methods
49 virtual void SetLabel(const wxString& label);
50 virtual bool SetBackgroundColour(const wxColour &colour);
51 virtual bool SetForegroundColour(const wxColour &colour);
52
53 // implementation from now on
54 virtual void Command(wxCommandEvent& event);
55 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
56 virtual bool MSWCommand(WXUINT param, WXWORD id);
57
58 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
59 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
60
61 // returns true if the platform should explicitly apply a theme border
62 virtual bool CanApplyThemeBorder() const { return false; }
63
64 private:
65 void MakeOwnerDrawn();
66
67 protected:
68 // send a notification event, return true if processed
69 bool SendClickEvent();
70
71 // default button handling
72 void SetTmpDefault();
73 void UnsetTmpDefault();
74
75 // set or unset BS_DEFPUSHBUTTON style
76 static void SetDefaultStyle(wxButton *btn, bool on);
77
78 // usually overridden base class virtuals
79 virtual wxSize DoGetBestSize() const;
80
81 private:
82 DECLARE_DYNAMIC_CLASS_NO_COPY(wxButton)
83 };
84
85 #endif // _WX_BUTTON_H_