]> git.saurik.com Git - wxWidgets.git/blob - include/wx/osx/button.h
Fix wxConvAuto behaviour when it is used by wxTextInputStream.
[wxWidgets.git] / include / wx / osx / button.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: button.h
3 // Purpose: wxButton class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 1998-01-01
7 // RCS-ID: $Id$
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_OSX_BUTTON_H_
13 #define _WX_OSX_BUTTON_H_
14
15 #include "wx/control.h"
16 #include "wx/gdicmn.h"
17
18 // Pushbutton
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 static wxSize GetDefaultSize();
45
46 virtual void SetLabel(const wxString& label);
47 virtual wxWindow *SetDefault();
48 virtual void Command(wxCommandEvent& event);
49
50 // osx specific event handling common for all osx-ports
51
52 virtual bool OSXHandleClicked( double timestampsec );
53
54 protected:
55 virtual wxSize DoGetBestSize() const ;
56
57 void OnEnterWindow( wxMouseEvent& event);
58 void OnLeaveWindow( wxMouseEvent& event);
59
60 virtual wxBitmap DoGetBitmap(State which) const;
61 virtual void DoSetBitmap(const wxBitmap& bitmap, State which);
62 virtual void DoSetBitmapPosition(wxDirection dir);
63
64 virtual void DoSetBitmapMargins(int x, int y)
65 {
66 m_marginX = x;
67 m_marginY = y;
68 }
69
70 // the margins around the bitmap
71 int m_marginX;
72 int m_marginY;
73
74 // the bitmaps for the different state of the buttons, all of them may be
75 // invalid and the button only shows a bitmap at all if State_Normal bitmap
76 // is valid
77 wxBitmap m_bitmaps[State_Max];
78
79 DECLARE_DYNAMIC_CLASS(wxButton)
80 DECLARE_EVENT_TABLE()
81 };
82
83 // OS X specific class, not part of public wx API
84 class WXDLLIMPEXP_CORE wxDisclosureTriangle : public wxControl
85 {
86 public:
87 wxDisclosureTriangle(wxWindow *parent,
88 wxWindowID id,
89 const wxString& label = wxEmptyString,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
92 long style = wxBORDER_NONE,
93 const wxValidator& validator = wxDefaultValidator,
94 const wxString& name = wxButtonNameStr)
95 {
96 Create(parent, id, label, pos, size, style, validator, name);
97 }
98
99 bool Create(wxWindow *parent,
100 wxWindowID id,
101 const wxString& label = wxEmptyString,
102 const wxPoint& pos = wxDefaultPosition,
103 const wxSize& size = wxDefaultSize,
104 long style = wxBORDER_NONE,
105 const wxValidator& validator = wxDefaultValidator,
106 const wxString& name = wxButtonNameStr);
107
108 void SetOpen( bool open );
109 bool IsOpen() const;
110
111 // osx specific event handling common for all osx-ports
112
113 virtual bool OSXHandleClicked( double timestampsec );
114
115 protected:
116 virtual wxSize DoGetBestSize() const ;
117 };
118
119 #endif // _WX_OSX_BUTTON_H_