]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/listbox.cpp
fixing wrong constant
[wxWidgets.git] / src / palmos / listbox.cpp
CommitLineData
ffecfa5a
JS
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/palmos/listbox.cpp
3// Purpose: wxListBox
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
e2731512 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
ffecfa5a
JS
12// For compilers that support precompilation, includes "wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16 #pragma hdrstop
17#endif
18
19#if wxUSE_LISTBOX
20
e4db172a
WS
21#include "wx/listbox.h"
22
ffecfa5a 23#ifndef WX_PRECOMP
ad9835c9 24 #include "wx/dynarray.h"
ad9835c9
WS
25 #include "wx/settings.h"
26 #include "wx/brush.h"
27 #include "wx/font.h"
28 #include "wx/dc.h"
29 #include "wx/utils.h"
e4db172a 30 #include "wx/log.h"
cdccdfab 31 #include "wx/window.h"
ffecfa5a
JS
32#endif
33
ffecfa5a
JS
34#include "wx/palmos/private.h"
35
ffecfa5a
JS
36#if wxUSE_OWNER_DRAWN
37 #include "wx/ownerdrw.h"
38#endif
39
40#if wxUSE_EXTENDED_RTTI
41WX_DEFINE_FLAGS( wxListBoxStyle )
42
43wxBEGIN_FLAGS( wxListBoxStyle )
44 // new style border flags, we put them first to
45 // use them for streaming out
46 wxFLAGS_MEMBER(wxBORDER_SIMPLE)
47 wxFLAGS_MEMBER(wxBORDER_SUNKEN)
48 wxFLAGS_MEMBER(wxBORDER_DOUBLE)
49 wxFLAGS_MEMBER(wxBORDER_RAISED)
50 wxFLAGS_MEMBER(wxBORDER_STATIC)
51 wxFLAGS_MEMBER(wxBORDER_NONE)
52
53 // old style border flags
54 wxFLAGS_MEMBER(wxSIMPLE_BORDER)
55 wxFLAGS_MEMBER(wxSUNKEN_BORDER)
56 wxFLAGS_MEMBER(wxDOUBLE_BORDER)
57 wxFLAGS_MEMBER(wxRAISED_BORDER)
58 wxFLAGS_MEMBER(wxSTATIC_BORDER)
59 wxFLAGS_MEMBER(wxBORDER)
60
61 // standard window styles
62 wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
63 wxFLAGS_MEMBER(wxCLIP_CHILDREN)
64 wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
65 wxFLAGS_MEMBER(wxWANTS_CHARS)
66 wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
67 wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
68 wxFLAGS_MEMBER(wxVSCROLL)
69 wxFLAGS_MEMBER(wxHSCROLL)
70
71 wxFLAGS_MEMBER(wxLB_SINGLE)
72 wxFLAGS_MEMBER(wxLB_MULTIPLE)
73 wxFLAGS_MEMBER(wxLB_EXTENDED)
74 wxFLAGS_MEMBER(wxLB_HSCROLL)
75 wxFLAGS_MEMBER(wxLB_ALWAYS_SB)
76 wxFLAGS_MEMBER(wxLB_NEEDED_SB)
77 wxFLAGS_MEMBER(wxLB_SORT)
78
79wxEND_FLAGS( wxListBoxStyle )
80
81IMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl,"wx/listbox.h")
82
83wxBEGIN_PROPERTIES_TABLE(wxListBox)
84 wxEVENT_PROPERTY( Select , wxEVT_COMMAND_LISTBOX_SELECTED , wxCommandEvent )
85 wxEVENT_PROPERTY( DoubleClick , wxEVT_COMMAND_LISTBOX_DOUBLECLICKED , wxCommandEvent )
86
87 wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
88 wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
89 wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
90 wxPROPERTY_FLAGS( WindowStyle , wxListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
91wxEND_PROPERTIES_TABLE()
92
93wxBEGIN_HANDLERS_TABLE(wxListBox)
94wxEND_HANDLERS_TABLE()
95
96wxCONSTRUCTOR_4( wxListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
97#else
b1294ada 98IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControlWithItems)
ffecfa5a
JS
99#endif
100
101// ============================================================================
102// list box item declaration and implementation
103// ============================================================================
104
105#if wxUSE_OWNER_DRAWN
106
107class wxListBoxItem : public wxOwnerDrawn
108{
109public:
110 wxListBoxItem(const wxString& str = wxEmptyString);
111};
112
8228b893 113wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, false)
ffecfa5a
JS
114{
115 // no bitmaps/checkmarks
116 SetMarginWidth(0);
117}
118
119wxOwnerDrawn *wxListBox::CreateLboxItem(size_t WXUNUSED(n))
120{
121 return new wxListBoxItem();
122}
123
124#endif //USE_OWNER_DRAWN
125
126// ============================================================================
127// list box control implementation
128// ============================================================================
129
130// ----------------------------------------------------------------------------
131// creation
132// ----------------------------------------------------------------------------
133
134// Listbox item
135wxListBox::wxListBox()
136{
137}
138
139bool wxListBox::Create(wxWindow *parent,
140 wxWindowID id,
141 const wxPoint& pos,
142 const wxSize& size,
143 int n, const wxString choices[],
144 long style,
145 const wxValidator& validator,
146 const wxString& name)
147{
148 return false;
149}
150
151bool wxListBox::Create(wxWindow *parent,
152 wxWindowID id,
153 const wxPoint& pos,
154 const wxSize& size,
155 const wxArrayString& choices,
156 long style,
157 const wxValidator& validator,
158 const wxString& name)
159{
160 return false;
161}
162
163wxListBox::~wxListBox()
164{
165}
166
167WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const
168{
169 return 0;
170}
171
172// ----------------------------------------------------------------------------
173// implementation of wxListBoxBase methods
174// ----------------------------------------------------------------------------
175
176void wxListBox::DoSetFirstItem(int N)
177{
178}
179
a236aa20 180void wxListBox::DoDeleteOneItem(unsigned int n)
ffecfa5a
JS
181{
182}
183
a236aa20 184void wxListBox::DoClear()
ffecfa5a
JS
185{
186}
187
188void wxListBox::Free()
189{
190}
191
c6179a84 192void wxListBox::DoSetSelection(int N, bool select)
ffecfa5a
JS
193{
194}
195
196bool wxListBox::IsSelected(int N) const
197{
198 return false;
199}
200
aa61d352 201void *wxListBox::DoGetItemClientData(unsigned int n) const
ffecfa5a
JS
202{
203 return (void *)NULL;
204}
205
aa61d352 206void wxListBox::DoSetItemClientData(unsigned int n, void *clientData)
ffecfa5a
JS
207{
208}
209
210// Return number of selections and an array of selected integers
211int wxListBox::GetSelections(wxArrayInt& aSelections) const
212{
213 return 0;
214}
215
216// Get single selection, for single choice list items
217int wxListBox::GetSelection() const
218{
219 return 0;
220}
221
222// Find string for position
aa61d352 223wxString wxListBox::GetString(unsigned int n) const
ffecfa5a 224{
aa61d352 225 return wxEmptyString;
ffecfa5a
JS
226}
227
a236aa20
VZ
228int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items,
229 unsigned int pos,
230 void **clientData,
231 wxClientDataType type)
ffecfa5a 232{
a236aa20 233 return 0;
ffecfa5a 234}
aa61d352 235void wxListBox::SetString(unsigned int n, const wxString& s)
ffecfa5a
JS
236{
237}
238
aa61d352 239unsigned int wxListBox::GetCount() const
ffecfa5a 240{
8228b893 241 return 0;
ffecfa5a
JS
242}
243
244// ----------------------------------------------------------------------------
245// helpers
246// ----------------------------------------------------------------------------
247
248void wxListBox::SetHorizontalExtent(const wxString& s)
249{
250}
251
252wxSize wxListBox::DoGetBestSize() const
253{
254 return wxSize(0,0);
255}
256
257// ----------------------------------------------------------------------------
258// callbacks
259// ----------------------------------------------------------------------------
260
261bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id))
262{
263 return false;
264}
265
266// ----------------------------------------------------------------------------
267// wxCheckListBox support
268// ----------------------------------------------------------------------------
269
270#if wxUSE_OWNER_DRAWN
271
272// drawing
273// -------
274
275// space beneath/above each row in pixels
276// "standard" checklistbox use 1 here, some might prefer 2. 0 is ugly.
277#define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1)
278
279// the height is the same for all items
280// TODO should be changed for LBS_OWNERDRAWVARIABLE style listboxes
281
282// NB: can't forward this to wxListBoxItem because LB_SETITEMDATA
283// message is not yet sent when we get here!
284bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item)
285{
286 return true;
287}
288
289// forward the message to the appropriate item
290bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item)
291{
292 return true;
293}
294
295#endif // wxUSE_OWNER_DRAWN
296
297#endif // wxUSE_LISTBOX