]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/combobox.cpp
Fix for listbox problem, when created on invisible
[wxWidgets.git] / src / palmos / combobox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/combobox.cpp
3 // Purpose: wxComboBox class
4 // Author: William Osborne - minimal working wxPalmOS port
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 "combobox.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_COMBOBOX
32
33 #ifndef WX_PRECOMP
34 #include "wx/settings.h"
35 #include "wx/log.h"
36 // for wxEVT_COMMAND_TEXT_ENTER
37 #include "wx/textctrl.h"
38 #endif
39
40 #include "wx/combobox.h"
41 #include "wx/brush.h"
42 #include "wx/clipbrd.h"
43 #include "wx/palmos/private.h"
44
45 #if wxUSE_TOOLTIPS
46 #if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__)
47 #include <commctrl.h>
48 #endif
49 #include "wx/tooltip.h"
50 #endif // wxUSE_TOOLTIPS
51
52 // ----------------------------------------------------------------------------
53 // wxWin macros
54 // ----------------------------------------------------------------------------
55
56 #if wxUSE_EXTENDED_RTTI
57 WX_DEFINE_FLAGS( wxComboBoxStyle )
58
59 wxBEGIN_FLAGS( wxComboBoxStyle )
60 // new style border flags, we put them first to
61 // use them for streaming out
62 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
63 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
64 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
65 wxFLAGS_MEMBER(wxBORDER_RAISED)
66 wxFLAGS_MEMBER(wxBORDER_STATIC)
67 wxFLAGS_MEMBER(wxBORDER_NONE)
68
69 // old style border flags
70 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
71 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
72 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
73 wxFLAGS_MEMBER(wxRAISED_BORDER)
74 wxFLAGS_MEMBER(wxSTATIC_BORDER)
75 wxFLAGS_MEMBER(wxBORDER)
76
77 // standard window styles
78 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
79 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
80 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
81 wxFLAGS_MEMBER(wxWANTS_CHARS)
82 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
83 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
84 wxFLAGS_MEMBER(wxVSCROLL)
85 wxFLAGS_MEMBER(wxHSCROLL)
86
87 wxFLAGS_MEMBER(wxCB_SIMPLE)
88 wxFLAGS_MEMBER(wxCB_SORT)
89 wxFLAGS_MEMBER(wxCB_READONLY)
90 wxFLAGS_MEMBER(wxCB_DROPDOWN)
91
92 wxEND_FLAGS( wxComboBoxStyle )
93
94 IMPLEMENT_DYNAMIC_CLASS_XTI(wxComboBox, wxControl,"wx/combobox.h")
95
96 wxBEGIN_PROPERTIES_TABLE(wxComboBox)
97 wxEVENT_PROPERTY( Select , wxEVT_COMMAND_COMBOBOX_SELECTED , wxCommandEvent )
98 wxEVENT_PROPERTY( TextEnter , wxEVT_COMMAND_TEXT_ENTER , wxCommandEvent )
99
100 // TODO DELEGATES
101 wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
102 wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
103 wxPROPERTY( Value ,wxString, SetValue, GetValue, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
104 wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
105 wxPROPERTY_FLAGS( WindowStyle , wxComboBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
106 wxEND_PROPERTIES_TABLE()
107
108 wxBEGIN_HANDLERS_TABLE(wxComboBox)
109 wxEND_HANDLERS_TABLE()
110
111 wxCONSTRUCTOR_5( wxComboBox , wxWindow* , Parent , wxWindowID , Id , wxString , Value , wxPoint , Position , wxSize , Size )
112 #else
113 IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
114 #endif
115
116 // ----------------------------------------------------------------------------
117 // function prototypes
118 // ----------------------------------------------------------------------------
119
120 // ---------------------------------------------------------------------------
121 // global vars
122 // ---------------------------------------------------------------------------
123
124 // the pointer to standard radio button wnd proc
125 static WNDPROC gs_wndprocEdit = (WNDPROC)NULL;
126
127 // ============================================================================
128 // implementation
129 // ============================================================================
130
131 WXHBRUSH wxComboBox::OnCtlColor(WXHDC pDC,
132 WXHWND WXUNUSED(pWnd),
133 WXUINT WXUNUSED(nCtlColor),
134 WXUINT WXUNUSED(message),
135 WXWPARAM WXUNUSED(wParam),
136 WXLPARAM WXUNUSED(lParam))
137 {
138 HDC hdc = (HDC)pDC;
139 wxColour colBack = GetBackgroundColour();
140
141 if (!IsEnabled())
142 colBack = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
143
144 ::SetBkColor(hdc, wxColourToRGB(colBack));
145 ::SetTextColor(hdc, wxColourToRGB(GetForegroundColour()));
146
147 wxBrush *brush = wxTheBrushList->FindOrCreateBrush(colBack, wxSOLID);
148
149 return (WXHBRUSH)brush->GetResourceHandle();
150 }
151
152 // ----------------------------------------------------------------------------
153 // wxComboBox callbacks
154 // ----------------------------------------------------------------------------
155
156 WXLRESULT wxComboBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
157 {
158 return 0;
159 }
160
161 bool wxComboBox::MSWProcessEditMsg(WXUINT msg, WXWPARAM wParam, WXLPARAM lParam)
162 {
163 return false;
164 }
165
166 bool wxComboBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
167 {
168 return false;
169 }
170
171 WXHWND wxComboBox::GetEditHWND() const
172 {
173 return (WXHWND)0;
174 }
175
176 // ----------------------------------------------------------------------------
177 // wxComboBox creation
178 // ----------------------------------------------------------------------------
179
180 bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
181 const wxString& value,
182 const wxPoint& pos,
183 const wxSize& size,
184 int n, const wxString choices[],
185 long style,
186 const wxValidator& validator,
187 const wxString& name)
188 {
189 return false;
190 }
191
192 bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
193 const wxString& value,
194 const wxPoint& pos,
195 const wxSize& size,
196 const wxArrayString& choices,
197 long style,
198 const wxValidator& validator,
199 const wxString& name)
200 {
201 return false;
202 }
203
204 WXDWORD wxComboBox::MSWGetStyle(long style, WXDWORD *exstyle) const
205 {
206 return 0;
207 }
208
209 // ----------------------------------------------------------------------------
210 // wxComboBox text control-like methods
211 // ----------------------------------------------------------------------------
212
213 void wxComboBox::SetValue(const wxString& value)
214 {
215 }
216
217 // Clipboard operations
218 void wxComboBox::Copy()
219 {
220 }
221
222 void wxComboBox::Cut()
223 {
224 }
225
226 void wxComboBox::Paste()
227 {
228 }
229
230 void wxComboBox::SetEditable(bool WXUNUSED(editable))
231 {
232 }
233
234 void wxComboBox::SetInsertionPoint(long pos)
235 {
236 }
237
238 void wxComboBox::SetInsertionPointEnd()
239 {
240 }
241
242 long wxComboBox::GetInsertionPoint() const
243 {
244 return 0;
245 }
246
247 wxTextPos wxComboBox::GetLastPosition() const
248 {
249 return 0;
250 }
251
252 void wxComboBox::Replace(long from, long to, const wxString& value)
253 {
254 }
255
256 void wxComboBox::Remove(long from, long to)
257 {
258 }
259
260 void wxComboBox::SetSelection(long from, long to)
261 {
262 }
263
264 bool wxComboBox::IsEditable() const
265 {
266 return false;
267 }
268
269 void wxComboBox::Undo()
270 {
271 }
272
273 void wxComboBox::Redo()
274 {
275 }
276
277 void wxComboBox::SelectAll()
278 {
279 }
280
281 bool wxComboBox::CanCopy() const
282 {
283 return false;
284 }
285
286 bool wxComboBox::CanCut() const
287 {
288 return false;
289 }
290
291 bool wxComboBox::CanPaste() const
292 {
293 return false;
294 }
295
296 bool wxComboBox::CanUndo() const
297 {
298 return false;
299 }
300
301 bool wxComboBox::CanRedo() const
302 {
303 return false;
304 }
305
306
307 #endif // wxUSE_COMBOBOX
308