]>
Commit | Line | Data |
---|---|---|
ffecfa5a | 1 | ///////////////////////////////////////////////////////////////////////////// |
e2731512 | 2 | // Name: src/palmos/button.cpp |
ffecfa5a | 3 | // Purpose: wxButton |
e2731512 | 4 | // Author: William Osborne - minimal working wxPalmOS port |
db101bd3 | 5 | // Modified by: Wlodzimierz ABX Skiba - native wxButton implementation |
ffecfa5a | 6 | // Created: 10/13/04 |
e2731512 | 7 | // RCS-ID: $Id$ |
db101bd3 | 8 | // Copyright: (c) William Osborne, Wlodzimierz Skiba |
ffecfa5a JS |
9 | // Licence: wxWindows licence |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) | |
21 | #pragma implementation "button.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #if wxUSE_BUTTON | |
32 | ||
33 | #ifndef WX_PRECOMP | |
34 | #include "wx/app.h" | |
35 | #include "wx/button.h" | |
36 | #include "wx/brush.h" | |
37 | #include "wx/panel.h" | |
38 | #include "wx/bmpbuttn.h" | |
39 | #include "wx/settings.h" | |
40 | #include "wx/dcscreen.h" | |
41 | #endif | |
42 | ||
ffecfa5a JS |
43 | // ---------------------------------------------------------------------------- |
44 | // macros | |
45 | // ---------------------------------------------------------------------------- | |
46 | ||
47 | #if wxUSE_EXTENDED_RTTI | |
48 | ||
49 | WX_DEFINE_FLAGS( wxButtonStyle ) | |
50 | ||
51 | wxBEGIN_FLAGS( wxButtonStyle ) | |
52 | // new style border flags, we put them first to | |
53 | // use them for streaming out | |
54 | wxFLAGS_MEMBER(wxBORDER_SIMPLE) | |
55 | wxFLAGS_MEMBER(wxBORDER_SUNKEN) | |
56 | wxFLAGS_MEMBER(wxBORDER_DOUBLE) | |
57 | wxFLAGS_MEMBER(wxBORDER_RAISED) | |
58 | wxFLAGS_MEMBER(wxBORDER_STATIC) | |
59 | wxFLAGS_MEMBER(wxBORDER_NONE) | |
4055ed82 | 60 | |
ffecfa5a JS |
61 | // old style border flags |
62 | wxFLAGS_MEMBER(wxSIMPLE_BORDER) | |
63 | wxFLAGS_MEMBER(wxSUNKEN_BORDER) | |
64 | wxFLAGS_MEMBER(wxDOUBLE_BORDER) | |
65 | wxFLAGS_MEMBER(wxRAISED_BORDER) | |
66 | wxFLAGS_MEMBER(wxSTATIC_BORDER) | |
67 | wxFLAGS_MEMBER(wxBORDER) | |
68 | ||
69 | // standard window styles | |
70 | wxFLAGS_MEMBER(wxTAB_TRAVERSAL) | |
71 | wxFLAGS_MEMBER(wxCLIP_CHILDREN) | |
72 | wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW) | |
73 | wxFLAGS_MEMBER(wxWANTS_CHARS) | |
74 | wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE) | |
75 | wxFLAGS_MEMBER(wxALWAYS_SHOW_SB ) | |
76 | wxFLAGS_MEMBER(wxVSCROLL) | |
77 | wxFLAGS_MEMBER(wxHSCROLL) | |
78 | ||
79 | wxFLAGS_MEMBER(wxBU_LEFT) | |
80 | wxFLAGS_MEMBER(wxBU_RIGHT) | |
81 | wxFLAGS_MEMBER(wxBU_TOP) | |
82 | wxFLAGS_MEMBER(wxBU_BOTTOM) | |
83 | wxFLAGS_MEMBER(wxBU_EXACTFIT) | |
84 | wxEND_FLAGS( wxButtonStyle ) | |
85 | ||
86 | IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl,"wx/button.h") | |
87 | ||
88 | wxBEGIN_PROPERTIES_TABLE(wxButton) | |
89 | wxEVENT_PROPERTY( Click , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent) | |
90 | ||
91 | wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) | |
92 | wxPROPERTY( Label, wxString , SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") ) | |
93 | ||
94 | wxPROPERTY_FLAGS( WindowStyle , wxButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style | |
95 | ||
96 | wxEND_PROPERTIES_TABLE() | |
97 | ||
98 | wxBEGIN_HANDLERS_TABLE(wxButton) | |
99 | wxEND_HANDLERS_TABLE() | |
100 | ||
101 | wxCONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle ) | |
102 | ||
103 | ||
104 | #else | |
105 | IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl) | |
106 | #endif | |
107 | ||
108 | // this macro tries to adjust the default button height to a reasonable value | |
109 | // using the char height as the base | |
110 | #define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10) | |
111 | ||
112 | // ============================================================================ | |
113 | // implementation | |
114 | // ============================================================================ | |
115 | ||
116 | // ---------------------------------------------------------------------------- | |
117 | // creation/destruction | |
118 | // ---------------------------------------------------------------------------- | |
119 | ||
120 | bool wxButton::Create(wxWindow *parent, | |
121 | wxWindowID id, | |
122 | const wxString& label, | |
123 | const wxPoint& pos, | |
124 | const wxSize& size, | |
125 | long style, | |
126 | const wxValidator& validator, | |
127 | const wxString& name) | |
128 | { | |
db101bd3 WS |
129 | wxControl::PalmCreateControl(buttonCtl, parent, id, label, pos, size); |
130 | return true; | |
ffecfa5a JS |
131 | } |
132 | ||
133 | wxButton::~wxButton() | |
134 | { | |
135 | } | |
136 | ||
ffecfa5a JS |
137 | // ---------------------------------------------------------------------------- |
138 | // size management including autosizing | |
139 | // ---------------------------------------------------------------------------- | |
140 | ||
141 | wxSize wxButton::DoGetBestSize() const | |
142 | { | |
143 | return wxSize(0,0); | |
144 | } | |
145 | ||
146 | /* static */ | |
147 | wxSize wxButtonBase::GetDefaultSize() | |
148 | { | |
149 | return wxSize(0,0); | |
150 | } | |
151 | ||
152 | void wxButton::SetDefault() | |
153 | { | |
154 | } | |
155 | ||
156 | void wxButton::SetTmpDefault() | |
157 | { | |
158 | } | |
159 | ||
160 | void wxButton::UnsetTmpDefault() | |
161 | { | |
162 | } | |
163 | ||
164 | /* static */ | |
165 | void | |
166 | wxButton::SetDefaultStyle(wxButton *btn, bool on) | |
167 | { | |
168 | } | |
169 | ||
170 | // ---------------------------------------------------------------------------- | |
171 | // helpers | |
172 | // ---------------------------------------------------------------------------- | |
173 | ||
174 | bool wxButton::SendClickEvent() | |
175 | { | |
176 | return false; | |
177 | } | |
178 | ||
179 | void wxButton::Command(wxCommandEvent & event) | |
180 | { | |
181 | } | |
182 | ||
ffecfa5a JS |
183 | #endif // wxUSE_BUTTON |
184 |