]> git.saurik.com Git - wxWidgets.git/blame - include/wx/univ/button.h
Define __MINGW64_TOOLCHAIN__ and __MINGW32_TOOLCHAIN__ symbols.
[wxWidgets.git] / include / wx / univ / button.h
CommitLineData
1e6feb95
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/univ/button.h
3// Purpose: wxButton for wxUniversal
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 15.08.00
442b35b5 7// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
65571936 8// Licence: wxWindows licence
1e6feb95
VZ
9///////////////////////////////////////////////////////////////////////////////
10
11#ifndef _WX_UNIV_BUTTON_H_
12#define _WX_UNIV_BUTTON_H_
13
b5dbe15d 14class WXDLLIMPEXP_FWD_CORE wxInputHandler;
1e6feb95
VZ
15
16#include "wx/bitmap.h"
17
18// ----------------------------------------------------------------------------
19// the actions supported by this control
20// ----------------------------------------------------------------------------
21
9a83f860
VZ
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
1e6feb95
VZ
26
27// ----------------------------------------------------------------------------
28// wxButton: a push button
29// ----------------------------------------------------------------------------
30
53a2db12 31class WXDLLIMPEXP_CORE wxButton : public wxButtonBase
1e6feb95
VZ
32{
33public:
6463b9f5 34 wxButton() { Init(); }
1e6feb95
VZ
35 wxButton(wxWindow *parent,
36 wxWindowID id,
37 const wxBitmap& bitmap,
5f7bcb48 38 const wxString& label = wxEmptyString,
1e6feb95
VZ
39 const wxPoint& pos = wxDefaultPosition,
40 const wxSize& size = wxDefaultSize,
41 long style = 0,
42 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
43 const wxString& name = wxButtonNameStr)
44 {
45 Init();
46
47 Create(parent, id, bitmap, label, pos, size, style, validator, name);
48 }
9467bdb7 49
1e6feb95
VZ
50 wxButton(wxWindow *parent,
51 wxWindowID id,
5f7bcb48 52 const wxString& label = wxEmptyString,
1e6feb95
VZ
53 const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize,
55 long style = 0,
56 const wxValidator& validator = wxDefaultValidator,
6463b9f5
JS
57 const wxString& name = wxButtonNameStr)
58 {
59 Init();
60
61 Create(parent, id, label, pos, size, style, validator, name);
62 }
1e6feb95
VZ
63
64 bool Create(wxWindow *parent,
65 wxWindowID id,
5f7bcb48 66 const wxString& label = wxEmptyString,
1e6feb95
VZ
67 const wxPoint& pos = wxDefaultPosition,
68 const wxSize& size = wxDefaultSize,
69 long style = 0,
70 const wxValidator& validator = wxDefaultValidator,
71 const wxString& name = wxButtonNameStr)
72 {
73 return Create(parent, id, wxNullBitmap, label,
74 pos, size, style, validator, name);
75 }
9467bdb7 76
1e6feb95
VZ
77 bool Create(wxWindow *parent,
78 wxWindowID id,
79 const wxBitmap& bitmap,
5f7bcb48 80 const wxString& label = wxEmptyString,
1e6feb95
VZ
81 const wxPoint& pos = wxDefaultPosition,
82 const wxSize& size = wxDefaultSize,
83 long style = 0,
84 const wxValidator& validator = wxDefaultValidator,
85 const wxString& name = wxButtonNameStr);
86
87 virtual ~wxButton();
88
94aff5ff 89 virtual wxWindow *SetDefault();
1e6feb95
VZ
90
91 virtual bool IsPressed() const { return m_isPressed; }
92 virtual bool IsDefault() const { return m_isDefault; }
93
94 // wxButton actions
bd88c1fa 95 virtual void Toggle();
1e6feb95
VZ
96 virtual void Press();
97 virtual void Release();
98 virtual void Click();
99
1e6feb95
VZ
100 virtual bool PerformAction(const wxControlAction& action,
101 long numArg = -1,
102 const wxString& strArg = wxEmptyString);
6f02a879
VZ
103
104 virtual bool CanBeHighlighted() const { return true; }
105
9467bdb7
VZ
106 static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
107 virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
108 {
109 return GetStdInputHandler(handlerDef);
110 }
111
112
6f02a879 113protected:
1e6feb95 114 virtual wxSize DoGetBestClientSize() const;
9467bdb7 115
193e19cf 116 virtual bool DoDrawBackground(wxDC& dc);
1e6feb95
VZ
117 virtual void DoDraw(wxControlRenderer *renderer);
118
2352862a
VZ
119 virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
120 virtual void DoSetBitmapMargins(wxCoord x, wxCoord y);
121
1e6feb95
VZ
122 // common part of all ctors
123 void Init();
124
125 // current state
126 bool m_isPressed,
127 m_isDefault;
128
129 // the (optional) image to show and the margins around it
130 wxBitmap m_bitmap;
131 wxCoord m_marginBmpX,
132 m_marginBmpY;
133
134private:
135 DECLARE_DYNAMIC_CLASS(wxButton)
136};
137
1e6feb95
VZ
138#endif // _WX_UNIV_BUTTON_H_
139