]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/button.cpp
fix for [ 1044879 ] wxMSW 2.5.3: memleaks in listctrl.cpp and bug in listctrl sample
[wxWidgets.git] / src / palmos / button.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: palmos/button.cpp
3 // Purpose: wxButton
4 // Author: William Osborne
5 // Modified by:
6 // Created: 10/13/04
7 // RCS-ID: $Id:
8 // Copyright: (c) William Osborne
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
43 #include "wx/palmos/private.h"
44
45 // ----------------------------------------------------------------------------
46 // macros
47 // ----------------------------------------------------------------------------
48
49 #if wxUSE_EXTENDED_RTTI
50
51 WX_DEFINE_FLAGS( wxButtonStyle )
52
53 wxBEGIN_FLAGS( wxButtonStyle )
54 // new style border flags, we put them first to
55 // use them for streaming out
56 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
57 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
58 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
59 wxFLAGS_MEMBER(wxBORDER_RAISED)
60 wxFLAGS_MEMBER(wxBORDER_STATIC)
61 wxFLAGS_MEMBER(wxBORDER_NONE)
62
63 // old style border flags
64 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
65 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
66 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
67 wxFLAGS_MEMBER(wxRAISED_BORDER)
68 wxFLAGS_MEMBER(wxSTATIC_BORDER)
69 wxFLAGS_MEMBER(wxBORDER)
70
71 // standard window styles
72 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
73 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
74 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
75 wxFLAGS_MEMBER(wxWANTS_CHARS)
76 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
77 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
78 wxFLAGS_MEMBER(wxVSCROLL)
79 wxFLAGS_MEMBER(wxHSCROLL)
80
81 wxFLAGS_MEMBER(wxBU_LEFT)
82 wxFLAGS_MEMBER(wxBU_RIGHT)
83 wxFLAGS_MEMBER(wxBU_TOP)
84 wxFLAGS_MEMBER(wxBU_BOTTOM)
85 wxFLAGS_MEMBER(wxBU_EXACTFIT)
86 wxEND_FLAGS( wxButtonStyle )
87
88 IMPLEMENT_DYNAMIC_CLASS_XTI(wxButton, wxControl,"wx/button.h")
89
90 wxBEGIN_PROPERTIES_TABLE(wxButton)
91 wxEVENT_PROPERTY( Click , wxEVT_COMMAND_BUTTON_CLICKED , wxCommandEvent)
92
93 wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
94 wxPROPERTY( Label, wxString , SetLabel, GetLabel, wxString(), 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
95
96 wxPROPERTY_FLAGS( WindowStyle , wxButtonStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
97
98 wxEND_PROPERTIES_TABLE()
99
100 wxBEGIN_HANDLERS_TABLE(wxButton)
101 wxEND_HANDLERS_TABLE()
102
103 wxCONSTRUCTOR_6( wxButton , wxWindow* , Parent , wxWindowID , Id , wxString , Label , wxPoint , Position , wxSize , Size , long , WindowStyle )
104
105
106 #else
107 IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
108 #endif
109
110 // this macro tries to adjust the default button height to a reasonable value
111 // using the char height as the base
112 #define BUTTON_HEIGHT_FROM_CHAR_HEIGHT(cy) (11*EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy)/10)
113
114 // ============================================================================
115 // implementation
116 // ============================================================================
117
118 // ----------------------------------------------------------------------------
119 // creation/destruction
120 // ----------------------------------------------------------------------------
121
122 bool wxButton::Create(wxWindow *parent,
123 wxWindowID id,
124 const wxString& label,
125 const wxPoint& pos,
126 const wxSize& size,
127 long style,
128 const wxValidator& validator,
129 const wxString& name)
130 {
131 return false;
132 }
133
134 wxButton::~wxButton()
135 {
136 }
137
138 // ----------------------------------------------------------------------------
139 // flags
140 // ----------------------------------------------------------------------------
141
142 WXDWORD wxButton::MSWGetStyle(long style, WXDWORD *exstyle) const
143 {
144 return 0;
145 }
146
147 // ----------------------------------------------------------------------------
148 // size management including autosizing
149 // ----------------------------------------------------------------------------
150
151 wxSize wxButton::DoGetBestSize() const
152 {
153 return wxSize(0,0);
154 }
155
156 /* static */
157 wxSize wxButtonBase::GetDefaultSize()
158 {
159 return wxSize(0,0);
160 }
161
162 void wxButton::SetDefault()
163 {
164 }
165
166 void wxButton::SetTmpDefault()
167 {
168 }
169
170 void wxButton::UnsetTmpDefault()
171 {
172 }
173
174 /* static */
175 void
176 wxButton::SetDefaultStyle(wxButton *btn, bool on)
177 {
178 }
179
180 // ----------------------------------------------------------------------------
181 // helpers
182 // ----------------------------------------------------------------------------
183
184 bool wxButton::SendClickEvent()
185 {
186 return false;
187 }
188
189 void wxButton::Command(wxCommandEvent & event)
190 {
191 }
192
193 // ----------------------------------------------------------------------------
194 // event/message handlers
195 // ----------------------------------------------------------------------------
196
197 bool wxButton::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
198 {
199 return false;
200 }
201
202 // ----------------------------------------------------------------------------
203 // owner-drawn buttons support
204 // ----------------------------------------------------------------------------
205
206 #ifdef __WIN32__
207
208 // drawing helpers
209
210 static void DrawButtonText(HDC hdc,
211 RECT *pRect,
212 const wxString& text,
213 COLORREF col)
214 {
215 }
216
217 static void DrawRect(HDC hdc, const RECT& r)
218 {
219 }
220
221 void wxButton::MakeOwnerDrawn()
222 {
223 }
224
225 bool wxButton::SetBackgroundColour(const wxColour &colour)
226 {
227 return false;
228 }
229
230 bool wxButton::SetForegroundColour(const wxColour &colour)
231 {
232 return false;
233 }
234
235 static void DrawButtonFrame(HDC hdc, const RECT& rectBtn,
236 bool selected, bool pushed)
237 {
238 }
239
240 bool wxButton::MSWOnDraw(WXDRAWITEMSTRUCT *wxdis)
241 {
242 return true;
243 }
244
245 #endif // __WIN32__
246
247 #endif // wxUSE_BUTTON
248