]>
Commit | Line | Data |
---|---|---|
6762286d SC |
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 | ||
e5d05b90 VZ |
12 | #ifndef _WX_OSX_BUTTON_H_ |
13 | #define _WX_OSX_BUTTON_H_ | |
6762286d SC |
14 | |
15 | #include "wx/control.h" | |
16 | #include "wx/gdicmn.h" | |
17 | ||
6762286d | 18 | // Pushbutton |
e5d05b90 | 19 | class WXDLLIMPEXP_CORE wxButton : public wxButtonBase |
6762286d SC |
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 | ||
85284ca4 | 46 | virtual void SetLabel(const wxString& label); |
6762286d SC |
47 | virtual wxWindow *SetDefault(); |
48 | virtual void Command(wxCommandEvent& event); | |
49 | ||
50 | // osx specific event handling common for all osx-ports | |
e5d05b90 | 51 | |
12b5f4b4 | 52 | virtual bool OSXHandleClicked( double timestampsec ); |
6762286d SC |
53 | |
54 | protected: | |
55 | virtual wxSize DoGetBestSize() const ; | |
56 | ||
b38dc31f SC |
57 | void OnEnterWindow( wxMouseEvent& event); |
58 | void OnLeaveWindow( wxMouseEvent& event); | |
ce00f59b | 59 | |
e5d05b90 VZ |
60 | virtual wxBitmap DoGetBitmap(State which) const; |
61 | virtual void DoSetBitmap(const wxBitmap& bitmap, State which); | |
62 | virtual void DoSetBitmapPosition(wxDirection dir); | |
e5d05b90 | 63 | |
b38dc31f SC |
64 | virtual void DoSetBitmapMargins(int x, int y) |
65 | { | |
66 | m_marginX = x; | |
67 | m_marginY = y; | |
06bb8d92 | 68 | InvalidateBestSize(); |
b38dc31f | 69 | } |
ce00f59b | 70 | |
f672c969 VZ |
71 | #if wxUSE_MARKUP && wxOSX_USE_COCOA |
72 | virtual bool DoSetLabelMarkup(const wxString& markup); | |
73 | #endif // wxUSE_MARKUP && wxOSX_USE_COCOA | |
74 | ||
75 | ||
b38dc31f SC |
76 | // the margins around the bitmap |
77 | int m_marginX; | |
78 | int m_marginY; | |
79 | ||
80 | // the bitmaps for the different state of the buttons, all of them may be | |
81 | // invalid and the button only shows a bitmap at all if State_Normal bitmap | |
82 | // is valid | |
ce00f59b VZ |
83 | wxBitmap m_bitmaps[State_Max]; |
84 | ||
6762286d | 85 | DECLARE_DYNAMIC_CLASS(wxButton) |
b38dc31f | 86 | DECLARE_EVENT_TABLE() |
6762286d SC |
87 | }; |
88 | ||
e5d05b90 VZ |
89 | // OS X specific class, not part of public wx API |
90 | class WXDLLIMPEXP_CORE wxDisclosureTriangle : public wxControl | |
6762286d SC |
91 | { |
92 | public: | |
93 | wxDisclosureTriangle(wxWindow *parent, | |
94 | wxWindowID id, | |
95 | const wxString& label = wxEmptyString, | |
96 | const wxPoint& pos = wxDefaultPosition, | |
97 | const wxSize& size = wxDefaultSize, | |
73b1b996 | 98 | long style = wxBORDER_NONE, |
6762286d SC |
99 | const wxValidator& validator = wxDefaultValidator, |
100 | const wxString& name = wxButtonNameStr) | |
101 | { | |
102 | Create(parent, id, label, pos, size, style, validator, name); | |
103 | } | |
104 | ||
105 | bool Create(wxWindow *parent, | |
106 | wxWindowID id, | |
107 | const wxString& label = wxEmptyString, | |
108 | const wxPoint& pos = wxDefaultPosition, | |
109 | const wxSize& size = wxDefaultSize, | |
73b1b996 | 110 | long style = wxBORDER_NONE, |
6762286d SC |
111 | const wxValidator& validator = wxDefaultValidator, |
112 | const wxString& name = wxButtonNameStr); | |
113 | ||
114 | void SetOpen( bool open ); | |
115 | bool IsOpen() const; | |
116 | ||
117 | // osx specific event handling common for all osx-ports | |
e5d05b90 | 118 | |
12b5f4b4 | 119 | virtual bool OSXHandleClicked( double timestampsec ); |
6762286d SC |
120 | |
121 | protected: | |
122 | virtual wxSize DoGetBestSize() const ; | |
6762286d SC |
123 | }; |
124 | ||
e5d05b90 | 125 | #endif // _WX_OSX_BUTTON_H_ |