]> git.saurik.com Git - wxWidgets.git/blob - src/palmos/listctrl.cpp
Fix the build system in gtk, plus a couple of compilation errors. wxWebView now succe...
[wxWidgets.git] / src / palmos / listctrl.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/palmos/listctrl.cpp
3 // Purpose: wxListCtrl
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 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #if wxUSE_LISTCTRL
28
29 #ifndef WX_PRECOMP
30 #include "wx/app.h"
31 #include "wx/intl.h"
32 #include "wx/log.h"
33 #include "wx/settings.h"
34 #include "wx/dcclient.h"
35 #include "wx/textctrl.h"
36 #endif
37
38 #include "wx/imaglist.h"
39 #include "wx/listctrl.h"
40
41 BEGIN_EVENT_TABLE(wxListCtrl, wxControl)
42 EVT_PAINT(wxListCtrl::OnPaint)
43 END_EVENT_TABLE()
44
45 // ============================================================================
46 // implementation
47 // ============================================================================
48
49 // ----------------------------------------------------------------------------
50 // wxListCtrl construction
51 // ----------------------------------------------------------------------------
52
53 void wxListCtrl::Init()
54 {
55 }
56
57 bool wxListCtrl::Create(wxWindow *parent,
58 wxWindowID id,
59 const wxPoint& pos,
60 const wxSize& size,
61 long style,
62 const wxValidator& validator,
63 const wxString& name)
64 {
65 return false;
66 }
67
68 void wxListCtrl::UpdateStyle()
69 {
70 }
71
72 void wxListCtrl::FreeAllInternalData()
73 {
74 }
75
76 wxListCtrl::~wxListCtrl()
77 {
78 }
79
80 // ----------------------------------------------------------------------------
81 // set/get/change style
82 // ----------------------------------------------------------------------------
83
84 // Add or remove a single window style
85 void wxListCtrl::SetSingleStyle(long style, bool add)
86 {
87 }
88
89 // ----------------------------------------------------------------------------
90 // accessors
91 // ----------------------------------------------------------------------------
92
93 /* static */ wxVisualAttributes wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
94 {
95 wxVisualAttributes attrs;
96
97 return attrs;
98 }
99
100 // Sets the foreground, i.e. text, colour
101 bool wxListCtrl::SetForegroundColour(const wxColour& col)
102 {
103 return false;
104 }
105
106 // Sets the background colour
107 bool wxListCtrl::SetBackgroundColour(const wxColour& col)
108 {
109 return false;
110 }
111
112 // Gets information about this column
113 bool wxListCtrl::GetColumn(int col, wxListItem& item) const
114 {
115 return false;
116 }
117
118 // Sets information about this column
119 bool wxListCtrl::SetColumn(int col, wxListItem& item)
120 {
121 return false;
122 }
123
124 // Gets the column width
125 int wxListCtrl::GetColumnWidth(int col) const
126 {
127 return 0;
128 }
129
130 // Sets the column width
131 bool wxListCtrl::SetColumnWidth(int col, int width)
132 {
133 return false;
134 }
135
136 // Gets the number of items that can fit vertically in the
137 // visible area of the list control (list or report view)
138 // or the total number of items in the list control (icon
139 // or small icon view)
140 int wxListCtrl::GetCountPerPage() const
141 {
142 return 0;
143 }
144
145 // Gets the edit control for editing labels.
146 wxTextCtrl* wxListCtrl::GetEditControl() const
147 {
148 return NULL;
149 }
150
151 // Gets information about the item
152 bool wxListCtrl::GetItem(wxListItem& info) const
153 {
154 return false;
155 }
156
157 // Sets information about the item
158 bool wxListCtrl::SetItem(wxListItem& info)
159 {
160 return false;
161 }
162
163 long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId)
164 {
165 return 0;
166 }
167
168
169 // Gets the item state
170 int wxListCtrl::GetItemState(long item, long stateMask) const
171 {
172 return 0;
173 }
174
175 // Sets the item state
176 bool wxListCtrl::SetItemState(long item, long state, long stateMask)
177 {
178 return false;
179 }
180
181 // Sets the item image
182 bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage))
183 {
184 return false;
185 }
186
187 // Sets the item image
188 bool wxListCtrl::SetItemColumnImage(long item, long column, int image)
189 {
190 return false;
191 }
192
193 // Gets the item text
194 wxString wxListCtrl::GetItemText(long item) const
195 {
196 wxListItem info;
197
198 return info.m_text;
199 }
200
201 // Sets the item text
202 void wxListCtrl::SetItemText(long item, const wxString& str)
203 {
204 }
205
206 // Gets the item data
207 long wxListCtrl::GetItemData(long item) const
208 {
209 return 0;
210 }
211
212 // Sets the item data
213 bool wxListCtrl::SetItemPtrData(long item, wxUIntPtr data)
214 {
215 return false;
216 }
217
218 wxRect wxListCtrl::GetViewRect() const
219 {
220 wxRect rect;
221
222 return rect;
223 }
224
225 // Gets the item rectangle
226 bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const
227 {
228 return false;
229 }
230
231 // Gets the item position
232 bool wxListCtrl::GetItemPosition(long item, wxPoint& pos) const
233 {
234 return false;
235 }
236
237 // Sets the item position.
238 bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos)
239 {
240 return false;
241 }
242
243 // Gets the number of items in the list control
244 int wxListCtrl::GetItemCount() const
245 {
246 return 0;
247 }
248
249 wxSize wxListCtrl::GetItemSpacing() const
250 {
251 return wxSize(0,0);
252 }
253
254 int wxListCtrl::GetItemSpacing(bool isSmall) const
255 {
256 return 0;
257 }
258
259 void wxListCtrl::SetItemTextColour( long item, const wxColour &col )
260 {
261 }
262
263 wxColour wxListCtrl::GetItemTextColour( long item ) const
264 {
265 wxColour col;
266
267 return col;
268 }
269
270 void wxListCtrl::SetItemBackgroundColour( long item, const wxColour &col )
271 {
272 }
273
274 wxColour wxListCtrl::GetItemBackgroundColour( long item ) const
275 {
276 wxColour col;
277
278 return col;
279 }
280
281 // Gets the number of selected items in the list control
282 int wxListCtrl::GetSelectedItemCount() const
283 {
284 return 0;
285 }
286
287 // Gets the text colour of the listview
288 wxColour wxListCtrl::GetTextColour() const
289 {
290 wxColour col;
291 return col;
292 }
293
294 // Sets the text colour of the listview
295 void wxListCtrl::SetTextColour(const wxColour& col)
296 {
297 }
298
299 // Gets the index of the topmost visible item when in
300 // list or report view
301 long wxListCtrl::GetTopItem() const
302 {
303 return 0;
304 }
305
306 // Searches for an item, starting from 'item'.
307 // 'geometry' is one of
308 // wxLIST_NEXT_ABOVE/ALL/BELOW/LEFT/RIGHT.
309 // 'state' is a state bit flag, one or more of
310 // wxLIST_STATE_DROPHILITED/FOCUSED/SELECTED/CUT.
311 // item can be -1 to find the first item that matches the
312 // specified flags.
313 // Returns the item or -1 if unsuccessful.
314 long wxListCtrl::GetNextItem(long item, int geom, int state) const
315 {
316 return 0;
317 }
318
319
320 wxImageList *wxListCtrl::GetImageList(int which) const
321 {
322 return NULL;
323 }
324
325 void wxListCtrl::SetImageList(wxImageList *imageList, int which)
326 {
327 }
328
329 void wxListCtrl::AssignImageList(wxImageList *imageList, int which)
330 {
331 }
332
333 // ----------------------------------------------------------------------------
334 // Operations
335 // ----------------------------------------------------------------------------
336
337 // Arranges the items
338 bool wxListCtrl::Arrange(int flag)
339 {
340 return false;
341 }
342
343 // Deletes an item
344 bool wxListCtrl::DeleteItem(long item)
345 {
346 return false;
347 }
348
349 // Deletes all items
350 bool wxListCtrl::DeleteAllItems()
351 {
352 return false;
353 }
354
355 // Deletes all items
356 bool wxListCtrl::DeleteAllColumns()
357 {
358 return false;
359 }
360
361 // Deletes a column
362 bool wxListCtrl::DeleteColumn(int col)
363 {
364 return false;
365 }
366
367 // Clears items, and columns if there are any.
368 void wxListCtrl::ClearAll()
369 {
370 }
371
372 wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass)
373 {
374 return NULL;
375 }
376
377 // End label editing, optionally cancelling the edit
378 bool wxListCtrl::EndEditLabel(bool WXUNUSED(cancel))
379 {
380 return false;
381 }
382
383 // Ensures this item is visible
384 bool wxListCtrl::EnsureVisible(long item)
385 {
386 return false;
387 }
388
389 // Find an item whose label matches this string, starting from the item after 'start'
390 // or the beginning if 'start' is -1.
391 long wxListCtrl::FindItem(long start, const wxString& str, bool partial)
392 {
393 return 0;
394 }
395
396 // Find an item whose data matches this data, starting from the item after 'start'
397 // or the beginning if 'start' is -1.
398 // NOTE : Lindsay Mathieson - 14-July-2002
399 // No longer use ListView_FindItem as the data attribute is now stored
400 // in a wxListItemInternalData structure refernced by the actual lParam
401 long wxListCtrl::FindItem(long start, long data)
402 {
403 return wxNOT_FOUND;
404 }
405
406 // Find an item nearest this position in the specified direction, starting from
407 // the item after 'start' or the beginning if 'start' is -1.
408 long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction)
409 {
410 return wxNOT_FOUND;
411 }
412
413 // Determines which item (if any) is at the specified point,
414 // giving details in 'flags' (see wxLIST_HITTEST_... flags above)
415 long wxListCtrl::HitTest(const wxPoint& point, int& flags)
416 {
417 return 0;
418 }
419
420 // Inserts an item, returning the index of the new item if successful,
421 // -1 otherwise.
422 long wxListCtrl::InsertItem(wxListItem& info)
423 {
424 return 0;
425 }
426
427 long wxListCtrl::InsertItem(long index, const wxString& label)
428 {
429 return 0;
430 }
431
432 // Inserts an image item
433 long wxListCtrl::InsertItem(long index, int imageIndex)
434 {
435 return 0;
436 }
437
438 // Inserts an image/string item
439 long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex)
440 {
441 return 0;
442 }
443
444 // For list view mode (only), inserts a column.
445 long wxListCtrl::InsertColumn(long col, wxListItem& item)
446 {
447 return 0;
448 }
449
450 long wxListCtrl::InsertColumn(long col,
451 const wxString& heading,
452 int format,
453 int width)
454 {
455 return 0;
456 }
457
458 // scroll the control by the given number of pixels (exception: in list view,
459 // dx is interpreted as number of columns)
460 bool wxListCtrl::ScrollList(int dx, int dy)
461 {
462 return false;
463 }
464
465 // Sort items.
466
467 // fn is a function which takes 3 long arguments: item1, item2, data.
468 // item1 is the long data associated with a first item (NOT the index).
469 // item2 is the long data associated with a second item (NOT the index).
470 // data is the same value as passed to SortItems.
471 // The return value is a negative number if the first item should precede the second
472 // item, a positive number of the second item should precede the first,
473 // or zero if the two items are equivalent.
474
475 // data is arbitrary data to be passed to the sort function.
476
477 // Internal structures for proxying the user compare function
478 // so that we can pass it the *real* user data
479
480 // translate lParam data and call user func
481 struct wxInternalDataSort
482 {
483 wxListCtrlCompare user_fn;
484 long data;
485 };
486
487 int CALLBACK wxInternalDataCompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
488 {
489 struct wxInternalDataSort *internalData = (struct wxInternalDataSort *) lParamSort;
490
491 wxListItemInternalData *data1 = (wxListItemInternalData *) lParam1;
492 wxListItemInternalData *data2 = (wxListItemInternalData *) lParam2;
493
494 long d1 = (data1 == NULL ? 0 : data1->lParam);
495 long d2 = (data2 == NULL ? 0 : data2->lParam);
496
497 return internalData->user_fn(d1, d2, internalData->data);
498
499 };
500
501 bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data)
502 {
503 return false;
504 }
505
506
507
508 // ----------------------------------------------------------------------------
509 // message processing
510 // ----------------------------------------------------------------------------
511
512 // Necessary for drawing hrules and vrules, if specified
513 void wxListCtrl::OnPaint(wxPaintEvent& event)
514 {
515 }
516
517 // ----------------------------------------------------------------------------
518 // virtual list controls
519 // ----------------------------------------------------------------------------
520
521 wxString wxListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const
522 {
523 return wxEmptyString;
524 }
525
526 int wxListCtrl::OnGetItemImage(long WXUNUSED(item)) const
527 {
528 return -1;
529 }
530
531 int wxListCtrl::OnGetItemColumnImage(long item, long column) const
532 {
533 if (!column)
534 return OnGetItemImage(item);
535
536 return -1;
537 }
538
539 wxListItemAttr *wxListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const
540 {
541 // no attributes by default
542 return NULL;
543 }
544
545 void wxListCtrl::SetItemCount(long count)
546 {
547 }
548
549 void wxListCtrl::RefreshItem(long item)
550 {
551 }
552
553 void wxListCtrl::RefreshItems(long itemFrom, long itemTo)
554 {
555 }
556
557 // ----------------------------------------------------------------------------
558 // internal data stuff
559 // ----------------------------------------------------------------------------
560
561 static wxListItemInternalData *wxGetInternalData(HWND hwnd, long itemId)
562 {
563 return NULL;
564 };
565
566 static wxListItemInternalData *wxGetInternalData(const wxListCtrl *ctl, long itemId)
567 {
568 return wxGetInternalData(GetHwndOf(ctl), itemId);
569 };
570
571 static wxListItemAttr *wxGetInternalDataAttr(wxListCtrl *ctl, long itemId)
572 {
573 return NULL;
574 };
575
576 static void wxDeleteInternalData(wxListCtrl* ctl, long itemId)
577 {
578 }
579
580 #endif // wxUSE_LISTCTRL