1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/univ/button.h
3 // Purpose: wxButton for wxUniversal
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_UNIV_BUTTON_H_
12 #define _WX_UNIV_BUTTON_H_
14 class WXDLLIMPEXP_FWD_CORE wxInputHandler
;
16 #include "wx/bitmap.h"
18 // ----------------------------------------------------------------------------
19 // the actions supported by this control
20 // ----------------------------------------------------------------------------
22 #define wxACTION_BUTTON_TOGGLE wxT("toggle") // press/release the button
23 #define wxACTION_BUTTON_PRESS wxT("press") // press the button
24 #define wxACTION_BUTTON_RELEASE wxT("release") // release the button
25 #define wxACTION_BUTTON_CLICK wxT("click") // generate button click event
27 // ----------------------------------------------------------------------------
28 // wxButton: a push button
29 // ----------------------------------------------------------------------------
31 class WXDLLIMPEXP_CORE wxButton
: public wxButtonBase
34 wxButton() { Init(); }
35 wxButton(wxWindow
*parent
,
37 const wxBitmap
& bitmap
,
38 const wxString
& label
= wxEmptyString
,
39 const wxPoint
& pos
= wxDefaultPosition
,
40 const wxSize
& size
= wxDefaultSize
,
42 const wxValidator
& validator
= wxDefaultValidator
,
43 const wxString
& name
= wxButtonNameStr
)
47 Create(parent
, id
, bitmap
, label
, pos
, size
, style
, validator
, name
);
50 wxButton(wxWindow
*parent
,
52 const wxString
& label
= wxEmptyString
,
53 const wxPoint
& pos
= wxDefaultPosition
,
54 const wxSize
& size
= wxDefaultSize
,
56 const wxValidator
& validator
= wxDefaultValidator
,
57 const wxString
& name
= wxButtonNameStr
)
61 Create(parent
, id
, label
, pos
, size
, style
, validator
, name
);
64 bool Create(wxWindow
*parent
,
66 const wxString
& label
= wxEmptyString
,
67 const wxPoint
& pos
= wxDefaultPosition
,
68 const wxSize
& size
= wxDefaultSize
,
70 const wxValidator
& validator
= wxDefaultValidator
,
71 const wxString
& name
= wxButtonNameStr
)
73 return Create(parent
, id
, wxNullBitmap
, label
,
74 pos
, size
, style
, validator
, name
);
77 bool Create(wxWindow
*parent
,
79 const wxBitmap
& bitmap
,
80 const wxString
& label
= wxEmptyString
,
81 const wxPoint
& pos
= wxDefaultPosition
,
82 const wxSize
& size
= wxDefaultSize
,
84 const wxValidator
& validator
= wxDefaultValidator
,
85 const wxString
& name
= wxButtonNameStr
);
89 virtual wxWindow
*SetDefault();
91 virtual bool IsPressed() const { return m_isPressed
; }
92 virtual bool IsDefault() const { return m_isDefault
; }
95 virtual void Toggle();
97 virtual void Release();
100 virtual bool PerformAction(const wxControlAction
& action
,
102 const wxString
& strArg
= wxEmptyString
);
104 virtual bool CanBeHighlighted() const { return true; }
106 static wxInputHandler
*GetStdInputHandler(wxInputHandler
*handlerDef
);
107 virtual wxInputHandler
*DoGetStdInputHandler(wxInputHandler
*handlerDef
)
109 return GetStdInputHandler(handlerDef
);
114 virtual wxSize
DoGetBestClientSize() const;
116 virtual bool DoDrawBackground(wxDC
& dc
);
117 virtual void DoDraw(wxControlRenderer
*renderer
);
119 virtual void DoSetBitmap(const wxBitmap
& bitmap
, State which
);
120 virtual void DoSetBitmapMargins(wxCoord x
, wxCoord y
);
122 // common part of all ctors
129 // the (optional) image to show and the margins around it
131 wxCoord m_marginBmpX
,
135 DECLARE_DYNAMIC_CLASS(wxButton
)
138 #endif // _WX_UNIV_BUTTON_H_