]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/button.h
Add the correct dll export macros
[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() { Init(); }
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 Init();
33
34 Create(parent, id, label, pos, size, style, validator, name);
35 }
36
37 bool Create(wxWindow *parent,
38 wxWindowID id,
39 const wxString& label = wxEmptyString,
40 const wxPoint& pos = wxDefaultPosition,
41 const wxSize& size = wxDefaultSize,
42 long style = 0,
43 const wxValidator& validator = wxDefaultValidator,
44 const wxString& name = wxButtonNameStr);
45
46 virtual ~wxButton();
47
48 virtual wxWindow *SetDefault();
49
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
55 // implementation from now on
56 virtual void Command(wxCommandEvent& event);
57 virtual WXLRESULT MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
58 virtual bool MSWCommand(WXUINT param, WXWORD id);
59
60 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT *item);
61 virtual WXDWORD MSWGetStyle(long style, WXDWORD *exstyle) const;
62
63 // returns true if the platform should explicitly apply a theme border
64 virtual bool CanApplyThemeBorder() const { return false; }
65
66 protected:
67 // send a notification event, return true if processed
68 bool SendClickEvent();
69
70 // default button handling
71 void SetTmpDefault();
72 void UnsetTmpDefault();
73
74 // set or unset BS_DEFPUSHBUTTON style
75 static void SetDefaultStyle(wxButton *btn, bool on);
76
77 // usually overridden base class virtuals
78 virtual wxSize DoGetBestSize() const;
79
80 virtual bool DoGetAuthNeeded() const;
81 virtual void DoSetAuthNeeded(bool show);
82 virtual wxBitmap DoGetBitmap(State which) const;
83 virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
84 virtual wxSize DoGetBitmapMargins() const;
85 virtual void DoSetBitmapMargins(wxCoord x, wxCoord y);
86 virtual void DoSetBitmapPosition(wxDirection dir);
87
88 #if wxUSE_MARKUP
89 virtual bool DoSetLabelMarkup(const wxString& markup);
90 #endif // wxUSE_MARKUP
91
92 // Increases the passed in size to account for the button image.
93 //
94 // Should only be called if we do have a button, i.e. if m_imageData is
95 // non-NULL.
96 void AdjustForBitmapSize(wxSize& size) const;
97
98 class wxButtonImageData *m_imageData;
99
100 #if wxUSE_MARKUP
101 class wxMarkupText *m_markupText;
102 #endif // wxUSE_MARKUP
103
104 // true if the UAC symbol is shown
105 bool m_authNeeded;
106
107 private:
108 void Init()
109 {
110 m_imageData = NULL;
111 #if wxUSE_MARKUP
112 m_markupText = NULL;
113 #endif // wxUSE_MARKUP
114 m_authNeeded = false;
115 }
116
117 // Switches button into owner-drawn mode: this is used if we need to draw
118 // something not supported by the native control, such as using non default
119 // colours or a bitmap on pre-XP systems.
120 void MakeOwnerDrawn();
121
122 wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton);
123 };
124
125 #endif // _WX_BUTTON_H_