]>
Commit | Line | Data |
---|---|---|
1 | /////////////////////////////////////////////////////////////////////////////// | |
2 | // Name: src/palmos/listbox.cpp | |
3 | // Purpose: wxListBox | |
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 | // 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 | ||
21 | #include "wx/listbox.h" | |
22 | ||
23 | #ifndef WX_PRECOMP | |
24 | #include "wx/dynarray.h" | |
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" | |
30 | #include "wx/log.h" | |
31 | #include "wx/window.h" | |
32 | #endif | |
33 | ||
34 | #include "wx/palmos/private.h" | |
35 | ||
36 | #if wxUSE_OWNER_DRAWN | |
37 | #include "wx/ownerdrw.h" | |
38 | #endif | |
39 | ||
40 | // ============================================================================ | |
41 | // list box item declaration and implementation | |
42 | // ============================================================================ | |
43 | ||
44 | #if wxUSE_OWNER_DRAWN | |
45 | ||
46 | class wxListBoxItem : public wxOwnerDrawn | |
47 | { | |
48 | public: | |
49 | wxListBoxItem(const wxString& str = wxEmptyString); | |
50 | }; | |
51 | ||
52 | wxListBoxItem::wxListBoxItem(const wxString& str) : wxOwnerDrawn(str, false) | |
53 | { | |
54 | // no bitmaps/checkmarks | |
55 | SetMarginWidth(0); | |
56 | } | |
57 | ||
58 | wxOwnerDrawn *wxListBox::CreateLboxItem(size_t WXUNUSED(n)) | |
59 | { | |
60 | return new wxListBoxItem(); | |
61 | } | |
62 | ||
63 | #endif //USE_OWNER_DRAWN | |
64 | ||
65 | // ============================================================================ | |
66 | // list box control implementation | |
67 | // ============================================================================ | |
68 | ||
69 | // ---------------------------------------------------------------------------- | |
70 | // creation | |
71 | // ---------------------------------------------------------------------------- | |
72 | ||
73 | // Listbox item | |
74 | wxListBox::wxListBox() | |
75 | { | |
76 | } | |
77 | ||
78 | bool wxListBox::Create(wxWindow *parent, | |
79 | wxWindowID id, | |
80 | const wxPoint& pos, | |
81 | const wxSize& size, | |
82 | int n, const wxString choices[], | |
83 | long style, | |
84 | const wxValidator& validator, | |
85 | const wxString& name) | |
86 | { | |
87 | return false; | |
88 | } | |
89 | ||
90 | bool wxListBox::Create(wxWindow *parent, | |
91 | wxWindowID id, | |
92 | const wxPoint& pos, | |
93 | const wxSize& size, | |
94 | const wxArrayString& choices, | |
95 | long style, | |
96 | const wxValidator& validator, | |
97 | const wxString& name) | |
98 | { | |
99 | return false; | |
100 | } | |
101 | ||
102 | wxListBox::~wxListBox() | |
103 | { | |
104 | } | |
105 | ||
106 | WXDWORD wxListBox::MSWGetStyle(long style, WXDWORD *exstyle) const | |
107 | { | |
108 | return 0; | |
109 | } | |
110 | ||
111 | // ---------------------------------------------------------------------------- | |
112 | // implementation of wxListBoxBase methods | |
113 | // ---------------------------------------------------------------------------- | |
114 | ||
115 | void wxListBox::DoSetFirstItem(int N) | |
116 | { | |
117 | } | |
118 | ||
119 | void wxListBox::DoDeleteOneItem(unsigned int n) | |
120 | { | |
121 | } | |
122 | ||
123 | void wxListBox::DoClear() | |
124 | { | |
125 | } | |
126 | ||
127 | void wxListBox::Free() | |
128 | { | |
129 | } | |
130 | ||
131 | void wxListBox::DoSetSelection(int N, bool select) | |
132 | { | |
133 | } | |
134 | ||
135 | bool wxListBox::IsSelected(int N) const | |
136 | { | |
137 | return false; | |
138 | } | |
139 | ||
140 | void *wxListBox::DoGetItemClientData(unsigned int n) const | |
141 | { | |
142 | return NULL; | |
143 | } | |
144 | ||
145 | void wxListBox::DoSetItemClientData(unsigned int n, void *clientData) | |
146 | { | |
147 | } | |
148 | ||
149 | // Return number of selections and an array of selected integers | |
150 | int wxListBox::GetSelections(wxArrayInt& aSelections) const | |
151 | { | |
152 | return 0; | |
153 | } | |
154 | ||
155 | // Get single selection, for single choice list items | |
156 | int wxListBox::GetSelection() const | |
157 | { | |
158 | return 0; | |
159 | } | |
160 | ||
161 | // Find string for position | |
162 | wxString wxListBox::GetString(unsigned int n) const | |
163 | { | |
164 | return wxEmptyString; | |
165 | } | |
166 | ||
167 | int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items, | |
168 | unsigned int pos, | |
169 | void **clientData, | |
170 | wxClientDataType type) | |
171 | { | |
172 | return 0; | |
173 | } | |
174 | void wxListBox::SetString(unsigned int n, const wxString& s) | |
175 | { | |
176 | } | |
177 | ||
178 | unsigned int wxListBox::GetCount() const | |
179 | { | |
180 | return 0; | |
181 | } | |
182 | ||
183 | // ---------------------------------------------------------------------------- | |
184 | // helpers | |
185 | // ---------------------------------------------------------------------------- | |
186 | ||
187 | void wxListBox::SetHorizontalExtent(const wxString& s) | |
188 | { | |
189 | } | |
190 | ||
191 | wxSize wxListBox::DoGetBestSize() const | |
192 | { | |
193 | return wxSize(0,0); | |
194 | } | |
195 | ||
196 | // ---------------------------------------------------------------------------- | |
197 | // callbacks | |
198 | // ---------------------------------------------------------------------------- | |
199 | ||
200 | bool wxListBox::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) | |
201 | { | |
202 | return false; | |
203 | } | |
204 | ||
205 | // ---------------------------------------------------------------------------- | |
206 | // wxCheckListBox support | |
207 | // ---------------------------------------------------------------------------- | |
208 | ||
209 | #if wxUSE_OWNER_DRAWN | |
210 | ||
211 | // drawing | |
212 | // ------- | |
213 | ||
214 | // space beneath/above each row in pixels | |
215 | // "standard" checklistbox use 1 here, some might prefer 2. 0 is ugly. | |
216 | #define OWNER_DRAWN_LISTBOX_EXTRA_SPACE (1) | |
217 | ||
218 | // the height is the same for all items | |
219 | // TODO should be changed for LBS_OWNERDRAWVARIABLE style listboxes | |
220 | ||
221 | // NB: can't forward this to wxListBoxItem because LB_SETITEMDATA | |
222 | // message is not yet sent when we get here! | |
223 | bool wxListBox::MSWOnMeasure(WXMEASUREITEMSTRUCT *item) | |
224 | { | |
225 | return true; | |
226 | } | |
227 | ||
228 | // forward the message to the appropriate item | |
229 | bool wxListBox::MSWOnDraw(WXDRAWITEMSTRUCT *item) | |
230 | { | |
231 | return true; | |
232 | } | |
233 | ||
234 | #endif // wxUSE_OWNER_DRAWN | |
235 | ||
236 | #endif // wxUSE_LISTBOX |