]> git.saurik.com Git - wxWidgets.git/blame - src/palmos/listctrl.cpp
Applied #13763 from dghart, to use primary selections if available
[wxWidgets.git] / src / palmos / listctrl.cpp
CommitLineData
ffecfa5a
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/palmos/listctrl.cpp
3// Purpose: wxListCtrl
e2731512 4// Author: William Osborne - minimal working wxPalmOS port
ffecfa5a
JS
5// Modified by:
6// Created: 10/13/04
52f2ad08 7// RCS-ID: $Id$
ffecfa5a
JS
8// Copyright: (c) William Osborne
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
ffecfa5a
JS
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
52f2ad08 27#if wxUSE_LISTCTRL
ffecfa5a
JS
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"
ed4b0fdc 34 #include "wx/dcclient.h"
fec9cc08 35 #include "wx/textctrl.h"
ffecfa5a
JS
36#endif
37
ffecfa5a
JS
38#include "wx/imaglist.h"
39#include "wx/listctrl.h"
ffecfa5a 40
ffecfa5a
JS
41BEGIN_EVENT_TABLE(wxListCtrl, wxControl)
42 EVT_PAINT(wxListCtrl::OnPaint)
43END_EVENT_TABLE()
44
45// ============================================================================
46// implementation
47// ============================================================================
48
49// ----------------------------------------------------------------------------
50// wxListCtrl construction
51// ----------------------------------------------------------------------------
52
53void wxListCtrl::Init()
54{
55}
56
57bool 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
ffecfa5a
JS
68void wxListCtrl::UpdateStyle()
69{
70}
71
72void wxListCtrl::FreeAllInternalData()
73{
74}
75
76wxListCtrl::~wxListCtrl()
77{
78}
79
80// ----------------------------------------------------------------------------
81// set/get/change style
82// ----------------------------------------------------------------------------
83
84// Add or remove a single window style
85void wxListCtrl::SetSingleStyle(long style, bool add)
86{
87}
88
ffecfa5a
JS
89// ----------------------------------------------------------------------------
90// accessors
91// ----------------------------------------------------------------------------
92
52f2ad08 93/* static */ wxVisualAttributes wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
ffecfa5a
JS
94{
95 wxVisualAttributes attrs;
96
97 return attrs;
98}
99
100// Sets the foreground, i.e. text, colour
101bool wxListCtrl::SetForegroundColour(const wxColour& col)
102{
103 return false;
104}
105
106// Sets the background colour
107bool wxListCtrl::SetBackgroundColour(const wxColour& col)
108{
109 return false;
110}
111
112// Gets information about this column
113bool wxListCtrl::GetColumn(int col, wxListItem& item) const
114{
115 return false;
116}
117
118// Sets information about this column
119bool wxListCtrl::SetColumn(int col, wxListItem& item)
120{
121 return false;
122}
123
124// Gets the column width
125int wxListCtrl::GetColumnWidth(int col) const
126{
127 return 0;
128}
129
130// Sets the column width
131bool 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)
140int wxListCtrl::GetCountPerPage() const
141{
142 return 0;
143}
144
145// Gets the edit control for editing labels.
146wxTextCtrl* wxListCtrl::GetEditControl() const
147{
148 return NULL;
149}
150
151// Gets information about the item
152bool wxListCtrl::GetItem(wxListItem& info) const
153{
154 return false;
155}
156
157// Sets information about the item
158bool wxListCtrl::SetItem(wxListItem& info)
159{
160 return false;
161}
162
163long wxListCtrl::SetItem(long index, int col, const wxString& label, int imageId)
164{
165 return 0;
166}
167
168
169// Gets the item state
170int wxListCtrl::GetItemState(long item, long stateMask) const
171{
172 return 0;
173}
174
175// Sets the item state
176bool wxListCtrl::SetItemState(long item, long state, long stateMask)
177{
178 return false;
179}
180
181// Sets the item image
182bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage))
183{
184 return false;
185}
186
06db67bc
RD
187// Sets the item image
188bool wxListCtrl::SetItemColumnImage(long item, long column, int image)
189{
190 return false;
191}
192
ffecfa5a
JS
193// Gets the item text
194wxString wxListCtrl::GetItemText(long item) const
195{
196 wxListItem info;
197
198 return info.m_text;
199}
200
201// Sets the item text
202void wxListCtrl::SetItemText(long item, const wxString& str)
203{
204}
205
206// Gets the item data
207long wxListCtrl::GetItemData(long item) const
208{
209 return 0;
210}
211
212// Sets the item data
9fcd0bf7 213bool wxListCtrl::SetItemPtrData(long item, wxUIntPtr data)
ffecfa5a
JS
214{
215 return false;
216}
217
218wxRect wxListCtrl::GetViewRect() const
219{
220 wxRect rect;
221
222 return rect;
223}
224
225// Gets the item rectangle
226bool wxListCtrl::GetItemRect(long item, wxRect& rect, int code) const
227{
228 return false;
229}
230
231// Gets the item position
232bool wxListCtrl::GetItemPosition(long item, wxPoint& pos) const
233{
234 return false;
235}
236
237// Sets the item position.
238bool wxListCtrl::SetItemPosition(long item, const wxPoint& pos)
239{
240 return false;
241}
242
243// Gets the number of items in the list control
244int wxListCtrl::GetItemCount() const
245{
246 return 0;
247}
248
249wxSize wxListCtrl::GetItemSpacing() const
250{
251 return wxSize(0,0);
252}
253
254int wxListCtrl::GetItemSpacing(bool isSmall) const
255{
256 return 0;
257}
258
259void wxListCtrl::SetItemTextColour( long item, const wxColour &col )
260{
261}
262
263wxColour wxListCtrl::GetItemTextColour( long item ) const
264{
265 wxColour col;
266
267 return col;
268}
269
270void wxListCtrl::SetItemBackgroundColour( long item, const wxColour &col )
271{
272}
273
274wxColour 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
282int wxListCtrl::GetSelectedItemCount() const
283{
284 return 0;
285}
286
287// Gets the text colour of the listview
288wxColour wxListCtrl::GetTextColour() const
289{
290 wxColour col;
291 return col;
292}
293
294// Sets the text colour of the listview
295void wxListCtrl::SetTextColour(const wxColour& col)
296{
297}
298
299// Gets the index of the topmost visible item when in
300// list or report view
301long 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.
314long wxListCtrl::GetNextItem(long item, int geom, int state) const
315{
316 return 0;
317}
318
319
320wxImageList *wxListCtrl::GetImageList(int which) const
321{
322 return NULL;
323}
324
325void wxListCtrl::SetImageList(wxImageList *imageList, int which)
326{
327}
328
329void wxListCtrl::AssignImageList(wxImageList *imageList, int which)
330{
331}
332
333// ----------------------------------------------------------------------------
334// Operations
335// ----------------------------------------------------------------------------
336
337// Arranges the items
338bool wxListCtrl::Arrange(int flag)
339{
340 return false;
341}
342
343// Deletes an item
344bool wxListCtrl::DeleteItem(long item)
345{
346 return false;
347}
348
349// Deletes all items
350bool wxListCtrl::DeleteAllItems()
351{
352 return false;
353}
354
355// Deletes all items
356bool wxListCtrl::DeleteAllColumns()
357{
358 return false;
359}
360
361// Deletes a column
362bool wxListCtrl::DeleteColumn(int col)
363{
364 return false;
365}
366
367// Clears items, and columns if there are any.
368void wxListCtrl::ClearAll()
369{
370}
371
372wxTextCtrl* wxListCtrl::EditLabel(long item, wxClassInfo* textControlClass)
373{
374 return NULL;
375}
376
377// End label editing, optionally cancelling the edit
378bool wxListCtrl::EndEditLabel(bool WXUNUSED(cancel))
379{
5445a26c 380 return false;
ffecfa5a
JS
381}
382
383// Ensures this item is visible
384bool 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.
391long 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
401long wxListCtrl::FindItem(long start, long data)
402{
5445a26c 403 return wxNOT_FOUND;
ffecfa5a
JS
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.
408long wxListCtrl::FindItem(long start, const wxPoint& pt, int direction)
409{
5445a26c 410 return wxNOT_FOUND;
ffecfa5a
JS
411}
412
413// Determines which item (if any) is at the specified point,
414// giving details in 'flags' (see wxLIST_HITTEST_... flags above)
415long 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.
422long wxListCtrl::InsertItem(wxListItem& info)
423{
424 return 0;
425}
426
427long wxListCtrl::InsertItem(long index, const wxString& label)
428{
429 return 0;
430}
431
432// Inserts an image item
433long wxListCtrl::InsertItem(long index, int imageIndex)
434{
435 return 0;
436}
437
438// Inserts an image/string item
439long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex)
440{
441 return 0;
442}
443
444// For list view mode (only), inserts a column.
445long wxListCtrl::InsertColumn(long col, wxListItem& item)
446{
447 return 0;
448}
449
450long 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)
460bool wxListCtrl::ScrollList(int dx, int dy)
461{
5445a26c 462 return false;
ffecfa5a
JS
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
481struct wxInternalDataSort
482{
483 wxListCtrlCompare user_fn;
484 long data;
485};
486
487int 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
501bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data)
502{
5445a26c 503 return false;
ffecfa5a
JS
504}
505
506
507
508// ----------------------------------------------------------------------------
509// message processing
510// ----------------------------------------------------------------------------
511
ffecfa5a
JS
512// Necessary for drawing hrules and vrules, if specified
513void wxListCtrl::OnPaint(wxPaintEvent& event)
514{
515}
516
517// ----------------------------------------------------------------------------
518// virtual list controls
519// ----------------------------------------------------------------------------
520
521wxString wxListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const
522{
523 return wxEmptyString;
524}
525
526int wxListCtrl::OnGetItemImage(long WXUNUSED(item)) const
527{
528 return -1;
529}
530
208458a7
RD
531int wxListCtrl::OnGetItemColumnImage(long item, long column) const
532{
533 if (!column)
534 return OnGetItemImage(item);
535
536 return -1;
537}
538
ffecfa5a
JS
539wxListItemAttr *wxListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const
540{
541 // no attributes by default
542 return NULL;
543}
544
545void wxListCtrl::SetItemCount(long count)
546{
547}
548
549void wxListCtrl::RefreshItem(long item)
550{
551}
552
553void wxListCtrl::RefreshItems(long itemFrom, long itemTo)
554{
555}
556
557// ----------------------------------------------------------------------------
558// internal data stuff
559// ----------------------------------------------------------------------------
560
561static wxListItemInternalData *wxGetInternalData(HWND hwnd, long itemId)
562{
563 return NULL;
564};
565
52f2ad08 566static wxListItemInternalData *wxGetInternalData(const wxListCtrl *ctl, long itemId)
ffecfa5a
JS
567{
568 return wxGetInternalData(GetHwndOf(ctl), itemId);
569};
570
571static wxListItemAttr *wxGetInternalDataAttr(wxListCtrl *ctl, long itemId)
572{
573 return NULL;
574};
575
576static void wxDeleteInternalData(wxListCtrl* ctl, long itemId)
577{
578}
579
ffecfa5a 580#endif // wxUSE_LISTCTRL