1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/button.h
3 // Purpose: wxButton class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 class WXDLLIMPEXP_CORE wxButton
: public wxButtonBase
22 wxButton() { m_imageData
= NULL
; }
23 wxButton(wxWindow
*parent
,
25 const wxString
& label
= wxEmptyString
,
26 const wxPoint
& pos
= wxDefaultPosition
,
27 const wxSize
& size
= wxDefaultSize
,
29 const wxValidator
& validator
= wxDefaultValidator
,
30 const wxString
& name
= wxButtonNameStr
)
34 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
37 bool Create(wxWindow
*parent
,
39 const wxString
& label
= wxEmptyString
,
40 const wxPoint
& pos
= wxDefaultPosition
,
41 const wxSize
& size
= wxDefaultSize
,
43 const wxValidator
& validator
= wxDefaultValidator
,
44 const wxString
& name
= wxButtonNameStr
);
48 virtual wxWindow
*SetDefault();
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
);
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
);
60 virtual bool MSWOnDraw(WXDRAWITEMSTRUCT
*item
);
61 virtual WXDWORD
MSWGetStyle(long style
, WXDWORD
*exstyle
) const;
63 // returns true if the platform should explicitly apply a theme border
64 virtual bool CanApplyThemeBorder() const { return false; }
67 void MakeOwnerDrawn();
70 // send a notification event, return true if processed
71 bool SendClickEvent();
73 // default button handling
75 void UnsetTmpDefault();
77 // set or unset BS_DEFPUSHBUTTON style
78 static void SetDefaultStyle(wxButton
*btn
, bool on
);
80 // usually overridden base class virtuals
81 virtual wxSize
DoGetBestSize() const;
83 virtual bool DoGetAuthNeeded() const;
84 virtual void DoSetAuthNeeded(bool show
);
85 virtual wxBitmap
DoGetBitmap(State which
) const;
86 virtual void DoSetBitmap(const wxBitmap
& bitmap
, State which
);
87 virtual wxSize
DoGetBitmapMargins() const;
88 virtual void DoSetBitmapMargins(wxCoord x
, wxCoord y
);
89 virtual void DoSetBitmapPosition(wxDirection dir
);
91 // Increases the passed in size to account for the button image.
93 // Should only be called if we do have a button, i.e. if m_imageData is
95 void AdjustForBitmapSize(wxSize
& size
) const;
97 class wxButtonImageData
*m_imageData
;
99 // true if the UAC symbol is shown
103 wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxButton
);
106 #endif // _WX_BUTTON_H_