]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/listctrl.h
wxSize/wxPoint/wxRect versions of functions added to wxMSW, wxMotif;
[wxWidgets.git] / include / wx / generic / listctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: listctrl.h
3 // Purpose: Generic list control
4 // Author: Robert Roebling
5 // Created: 01/02/97
6 // Id:
7 // Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef __LISTCTRLH_G__
12 #define __LISTCTRLH_G__
13
14 #ifdef __GNUG__
15 #pragma interface "listctrl.h"
16 #endif
17
18 #include "wx/defs.h"
19 #include "wx/object.h"
20 #include "wx/imaglist.h"
21 #include "wx/control.h"
22 #include "wx/timer.h"
23 #include "wx/textctrl.h"
24 #include "wx/dcclient.h"
25 #include "wx/scrolwin.h"
26 #include "wx/settings.h"
27
28 //-----------------------------------------------------------------------------
29 // classes
30 //-----------------------------------------------------------------------------
31
32 class wxListItem;
33 class wxListEvent;
34 class wxListCtrl;
35
36 //-----------------------------------------------------------------------------
37 // internal classes
38 //-----------------------------------------------------------------------------
39
40 class wxListHeaderData;
41 class wxListItemData;
42 class wxListLineData;
43
44 class wxListHeaderWindow;
45 class wxListMainWindow;
46
47 class wxListRenameTimer;
48 //class wxListTextCtrl;
49
50 //-----------------------------------------------------------------------------
51 // types
52 //-----------------------------------------------------------------------------
53
54 // type of compare function for wxListCtrl sort operation
55 typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData);
56
57 //-----------------------------------------------------------------------------
58 // wxListCtrl flags
59 //-----------------------------------------------------------------------------
60
61 #define wxLC_ICON 0x0004
62 #define wxLC_SMALL_ICON 0x0008
63 #define wxLC_LIST 0x0010
64 #define wxLC_REPORT 0x0020
65 #define wxLC_ALIGN_TOP 0x0040
66 #define wxLC_ALIGN_LEFT 0x0080
67 #define wxLC_AUTOARRANGE 0x0100 // not supported in wxGLC
68 #define wxLC_USER_TEXT 0x0200 // not supported in wxGLC (how does it work?)
69 #define wxLC_EDIT_LABELS 0x0400
70 #define wxLC_NO_HEADER 0x0800 // not supported in wxGLC
71 #define wxLC_NO_SORT_HEADER 0x1000 // not supported in wxGLC
72 #define wxLC_SINGLE_SEL 0x2000
73 #define wxLC_SORT_ASCENDING 0x4000
74 #define wxLC_SORT_DESCENDING 0x8000 // not supported in wxGLC
75
76 #define wxLC_MASK_TYPE (wxLC_ICON | wxLC_SMALL_ICON | wxLC_LIST | wxLC_REPORT)
77 #define wxLC_MASK_ALIGN (wxLC_ALIGN_TOP | wxLC_ALIGN_LEFT)
78 #define wxLC_MASK_SORT (wxLC_SORT_ASCENDING | wxLC_SORT_DESCENDING)
79
80 // Omitted because (a) too much detail (b) not enough style flags
81 // #define wxLC_NO_SCROLL
82 // #define wxLC_NO_LABEL_WRAP
83 // #define wxLC_OWNERDRAW_FIXED
84 // #define wxLC_SHOW_SEL_ALWAYS
85
86 // Mask flags to tell app/GUI what fields of wxListItem are valid
87 #define wxLIST_MASK_STATE 0x0001
88 #define wxLIST_MASK_TEXT 0x0002
89 #define wxLIST_MASK_IMAGE 0x0004
90 #define wxLIST_MASK_DATA 0x0008
91 #define wxLIST_SET_ITEM 0x0010
92 #define wxLIST_MASK_WIDTH 0x0020
93 #define wxLIST_MASK_FORMAT 0x0040
94
95 // State flags for indicating the state of an item
96 #define wxLIST_STATE_DONTCARE 0x0000
97 #define wxLIST_STATE_DROPHILITED 0x0001 // not supported in wxGLC
98 #define wxLIST_STATE_FOCUSED 0x0002
99 #define wxLIST_STATE_SELECTED 0x0004
100 #define wxLIST_STATE_CUT 0x0008 // not supported in wxGLC
101
102 // Hit test flags, used in HitTest // wxGLC suppots 20 and 80
103 #define wxLIST_HITTEST_ABOVE 0x0001 // Above the client area.
104 #define wxLIST_HITTEST_BELOW 0x0002 // Below the client area.
105 #define wxLIST_HITTEST_NOWHERE 0x0004 // In the client area but below the last item.
106 #define wxLIST_HITTEST_ONITEMICON 0x0020 // On the bitmap associated with an item.
107 #define wxLIST_HITTEST_ONITEMLABEL 0x0080 // On the label (string) associated with an item.
108 #define wxLIST_HITTEST_ONITEMRIGHT 0x0100 // In the area to the right of an item.
109 #define wxLIST_HITTEST_ONITEMSTATEICON 0x0200 // On the state icon for a tree view item that is in a user-defined state.
110 #define wxLIST_HITTEST_TOLEFT 0x0400 // To the right of the client area.
111 #define wxLIST_HITTEST_TORIGHT 0x0800 // To the left of the client area.
112
113 #define wxLIST_HITTEST_ONITEM (wxLIST_HITTEST_ONITEMICON | wxLIST_HITTEST_ONITEMLABEL | wxLIST_HITTEST_ONITEMSTATEICON)
114
115
116
117 // Flags for GetNextItem // always wxLIST_NEXT_ALL in wxGLC
118 enum {
119 wxLIST_NEXT_ABOVE, // Searches for an item above the specified item
120 wxLIST_NEXT_ALL, // Searches for subsequent item by index
121 wxLIST_NEXT_BELOW, // Searches for an item below the specified item
122 wxLIST_NEXT_LEFT, // Searches for an item to the left of the specified item
123 wxLIST_NEXT_RIGHT // Searches for an item to the right of the specified item
124 };
125
126 // Alignment flags for Arrange // always wxLIST_ALIGN_LEFT in wxGLC
127 enum {
128 wxLIST_ALIGN_DEFAULT,
129 wxLIST_ALIGN_LEFT,
130 wxLIST_ALIGN_TOP,
131 wxLIST_ALIGN_SNAP_TO_GRID
132 };
133
134 // Column format // always wxLIST_FORMAT_LEFT in wxGLC
135 enum {
136 wxLIST_FORMAT_LEFT,
137 wxLIST_FORMAT_RIGHT,
138 wxLIST_FORMAT_CENTRE,
139 wxLIST_FORMAT_CENTER = wxLIST_FORMAT_CENTRE
140 };
141
142 // Autosize values for SetColumnWidth
143 enum {
144 wxLIST_AUTOSIZE = -1, // always 80 in wxGLC (what else?)
145 wxLIST_AUTOSIZE_USEHEADER = -2
146 };
147
148 // Flag values for GetItemRect
149 enum {
150 wxLIST_RECT_BOUNDS,
151 wxLIST_RECT_ICON,
152 wxLIST_RECT_LABEL
153 };
154
155 // Flag values for FindItem // not supported by wxGLC
156 enum {
157 wxLIST_FIND_UP,
158 wxLIST_FIND_DOWN,
159 wxLIST_FIND_LEFT,
160 wxLIST_FIND_RIGHT
161 };
162
163 //-----------------------------------------------------------------------------
164 // wxListItem
165 //-----------------------------------------------------------------------------
166
167 class wxListItem: public wxObject
168 {
169 DECLARE_DYNAMIC_CLASS(wxListItem)
170
171 public:
172 long m_mask; // Indicates what fields are valid
173 long m_itemId; // The zero-based item position
174 int m_col; // Zero-based column, if in report mode
175 long m_state; // The state of the item
176 long m_stateMask; // Which flags of m_state are valid (uses same flags)
177 wxString m_text; // The label/header text
178 int m_image; // The zero-based index into an image list
179 long m_data; // App-defined data
180 wxColour *m_colour; // only wxGLC, not supported by Windows ;->
181
182 // For columns only
183 int m_format; // left, right, centre
184 int m_width; // width of column
185
186 wxListItem(void);
187 };
188
189 //-----------------------------------------------------------------------------
190 // wxListEvent
191 //-----------------------------------------------------------------------------
192
193 class WXDLLEXPORT wxListEvent: public wxCommandEvent
194 {
195 DECLARE_DYNAMIC_CLASS(wxListEvent)
196
197 public:
198 wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
199
200 int m_code;
201 long m_itemIndex;
202 long m_oldItemIndex;
203 int m_col;
204 bool m_cancelled;
205 wxPoint m_pointDrag;
206
207 wxListItem m_item;
208 };
209
210 typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
211
212 #define EVT_LIST_BEGIN_DRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
213 #define EVT_LIST_BEGIN_RDRAG(id, fn) { wxEVT_COMMAND_LIST_BEGIN_RDRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
214 #define EVT_LIST_BEGIN_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
215 #define EVT_LIST_END_LABEL_EDIT(id, fn) { wxEVT_COMMAND_LIST_END_LABEL_EDIT, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
216 #define EVT_LIST_DELETE_ITEM(id, fn) { wxEVT_COMMAND_LIST_DELETE_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
217 #define EVT_LIST_DELETE_ALL_ITEMS(id, fn) { wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
218 #define EVT_LIST_GET_INFO(id, fn) { wxEVT_COMMAND_LIST_GET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
219 #define EVT_LIST_SET_INFO(id, fn) { wxEVT_COMMAND_LIST_SET_INFO, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
220 #define EVT_LIST_ITEM_SELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_SELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
221 #define EVT_LIST_ITEM_DESELECTED(id, fn) { wxEVT_COMMAND_LIST_ITEM_DESELECTED, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
222 #define EVT_LIST_KEY_DOWN(id, fn) { wxEVT_COMMAND_LIST_KEY_DOWN, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
223 #define EVT_LIST_INSERT_ITEM(id, fn) { wxEVT_COMMAND_LIST_INSERT_ITEM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
224 #define EVT_LIST_COL_CLICK(id, fn) { wxEVT_COMMAND_LIST_COL_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxListEventFunction) & fn, (wxObject *) NULL },
225
226
227 //-----------------------------------------------------------------------------
228 // wxListItemData (internal)
229 //-----------------------------------------------------------------------------
230
231 class wxListItemData : public wxObject
232 {
233 DECLARE_DYNAMIC_CLASS(wxListItemData);
234
235 public:
236 wxString m_text;
237 int m_image;
238 long m_data;
239 int m_xpos,m_ypos;
240 int m_width,m_height;
241 wxColour *m_colour;
242
243 public:
244 wxListItemData(void);
245 wxListItemData( const wxListItem &info );
246 void SetItem( const wxListItem &info );
247 void SetText( const wxString &s );
248 void SetImage( int image );
249 void SetData( long data );
250 void SetPosition( int x, int y );
251 void SetSize( int width, int height );
252 void SetColour( wxColour *col );
253 bool HasImage(void) const;
254 bool HasText(void) const;
255 bool IsHit( int x, int y ) const;
256 void GetText( wxString &s );
257 int GetX( void ) const;
258 int GetY( void ) const;
259 int GetWidth(void) const;
260 int GetHeight(void) const;
261 int GetImage(void) const;
262 void GetItem( wxListItem &info );
263 wxColour *GetColour(void);
264 };
265
266 //-----------------------------------------------------------------------------
267 // wxListHeaderData (internal)
268 //-----------------------------------------------------------------------------
269
270 class wxListHeaderData : public wxObject
271 {
272 DECLARE_DYNAMIC_CLASS(wxListHeaderData);
273
274 protected:
275 long m_mask;
276 int m_image;
277 wxString m_text;
278 int m_format;
279 int m_width;
280 int m_xpos,m_ypos;
281 int m_height;
282
283 public:
284 wxListHeaderData(void);
285 wxListHeaderData( const wxListItem &info );
286 void SetItem( const wxListItem &item );
287 void SetPosition( int x, int y );
288 void SetWidth( int w );
289 void SetFormat( int format );
290 void SetHeight( int h );
291 bool HasImage(void) const;
292 bool HasText(void) const;
293 bool IsHit( int x, int y ) const;
294 void GetItem( wxListItem &item );
295 void GetText( wxString &s );
296 int GetImage(void) const;
297 int GetWidth(void) const;
298 int GetFormat(void) const;
299 };
300
301 //-----------------------------------------------------------------------------
302 // wxListLineData (internal)
303 //-----------------------------------------------------------------------------
304
305 class wxListLineData : public wxObject
306 {
307 DECLARE_DYNAMIC_CLASS(wxListLineData);
308
309 public:
310 wxList m_items;
311 wxRectangle m_bound_all;
312 wxRectangle m_bound_label;
313 wxRectangle m_bound_icon;
314 wxRectangle m_bound_hilight;
315 int m_mode;
316 bool m_hilighted;
317 wxBrush *m_hilightBrush;
318 int m_spacing;
319 wxListMainWindow *m_owner;
320
321 void DoDraw( wxPaintDC *dc, bool hilight, bool paintBG );
322
323 public:
324 wxListLineData( void ) {};
325 wxListLineData( wxListMainWindow *owner, int mode, wxBrush *hilightBrush );
326 void CalculateSize( wxPaintDC *dc, int spacing );
327 void SetPosition( wxPaintDC *dc, int x, int y, int window_width );
328 void SetColumnPosition( int index, int x );
329 void GetSize( int &width, int &height );
330 void GetExtent( int &x, int &y, int &width, int &height );
331 void GetLabelExtent( int &x, int &y, int &width, int &height );
332 long IsHit( int x, int y );
333 void InitItems( int num );
334 void SetItem( int index, const wxListItem &info );
335 void GetItem( int index, wxListItem &info );
336 void GetText( int index, wxString &s );
337 void SetText( int index, const wxString s );
338 int GetImage( int index );
339 void GetRect( wxRectangle &rect );
340 void Hilight( bool on );
341 void ReverseHilight( void );
342 void DrawRubberBand( wxPaintDC *dc, bool on );
343 void Draw( wxPaintDC *dc );
344 bool IsInRect( int x, int y, const wxRectangle &rect );
345 bool IsHilighted( void );
346 void AssignRect( wxRectangle &dest, int x, int y, int width, int height );
347 void AssignRect( wxRectangle &dest, const wxRectangle &source );
348 };
349
350 //-----------------------------------------------------------------------------
351 // wxListHeaderWindow (internal)
352 //-----------------------------------------------------------------------------
353
354 class wxListHeaderWindow : public wxWindow
355 {
356 DECLARE_DYNAMIC_CLASS(wxListHeaderWindow)
357
358 protected:
359 wxListMainWindow *m_owner;
360 wxCursor *m_currentCursor;
361 wxCursor *m_resizeCursor;
362 bool m_isDraging;
363 int m_column;
364 int m_minX;
365 int m_currentX;
366
367 public:
368 wxListHeaderWindow( void );
369 wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
370 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
371 long style = 0, const wxString &name = "columntitles" );
372 void DoDrawRect( wxPaintDC *dc, int x, int y, int w, int h );
373 void OnPaint( wxPaintEvent &event );
374 void DrawCurrent();
375 void OnMouse( wxMouseEvent &event );
376 void OnSetFocus( wxFocusEvent &event );
377
378 DECLARE_EVENT_TABLE()
379 };
380
381 //-----------------------------------------------------------------------------
382 // wxListRenameTimer (internal)
383 //-----------------------------------------------------------------------------
384
385 class wxListRenameTimer: public wxTimer
386 {
387 private:
388 wxListMainWindow *m_owner;
389
390 public:
391 wxListRenameTimer( wxListMainWindow *owner );
392 void Notify();
393 };
394
395 //-----------------------------------------------------------------------------
396 // wxListTextCtrl (internal)
397 //-----------------------------------------------------------------------------
398
399 class wxListTextCtrl: public wxTextCtrl
400 {
401 DECLARE_DYNAMIC_CLASS(wxListTextCtrl);
402
403 private:
404 bool *m_accept;
405 wxString *m_res;
406 wxListMainWindow *m_owner;
407
408 public:
409 wxListTextCtrl(void) {};
410 wxListTextCtrl( wxWindow *parent, const wxWindowID id,
411 bool *accept, wxString *res, wxListMainWindow *owner,
412 const wxString &value = "",
413 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
414 int style = 0, const wxValidator& validator = wxDefaultValidator,
415 const wxString &name = "wxListTextCtrlText" );
416 void OnChar( wxKeyEvent &event );
417 void OnKillFocus( wxFocusEvent &event );
418
419 DECLARE_EVENT_TABLE()
420 };
421
422 //-----------------------------------------------------------------------------
423 // wxListMainWindow (internal)
424 //-----------------------------------------------------------------------------
425
426 class wxListMainWindow: public wxScrolledWindow
427 {
428 DECLARE_DYNAMIC_CLASS(wxListMainWindow);
429
430 public:
431 long m_mode;
432 wxList m_lines;
433 wxList m_columns;
434 wxListLineData *m_current;
435 int m_visibleLines;
436 wxBrush *m_hilightBrush;
437 wxColour *m_hilightColour;
438 int m_xScroll,m_yScroll;
439 bool m_dirty;
440 wxImageList *m_small_image_list;
441 wxImageList *m_normal_image_list;
442 int m_small_spacing;
443 int m_normal_spacing;
444 bool m_hasFocus;
445 bool m_usedKeys;
446 bool m_lastOnSame;
447 wxTimer *m_renameTimer;
448 // wxListTextCtrl *m_text;
449 bool m_renameAccept;
450 wxString m_renameRes;
451 bool m_isCreated;
452 int m_dragCount;
453
454 public:
455 wxListMainWindow(void);
456 wxListMainWindow( wxWindow *parent, wxWindowID id,
457 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
458 long style = 0, const wxString &name = "listctrl" );
459 ~wxListMainWindow(void);
460 void RefreshLine( wxListLineData *line );
461 void OnPaint( wxPaintEvent &event );
462 void HilightAll( bool on );
463 void ActivateLine( wxListLineData *line );
464 void SendNotify( wxListLineData *line, wxEventType command );
465 void FocusLine( wxListLineData *line );
466 void UnfocusLine( wxListLineData *line );
467 void SelectLine( wxListLineData *line );
468 void DeselectLine( wxListLineData *line );
469 void DeleteLine( wxListLineData *line );
470 void RenameLine( wxListLineData *line, const wxString &newName );
471 void StartLabelEdit( wxListLineData *line );
472 void OnRenameTimer(void);
473 void OnRenameAccept(void);
474 void OnMouse( wxMouseEvent &event );
475 void MoveToFocus( void );
476 void OnArrowChar( wxListLineData *newCurrent, bool shiftDown );
477 void OnChar( wxKeyEvent &event );
478 void OnSetFocus( wxFocusEvent &event );
479 void OnKillFocus( wxFocusEvent &event );
480 void OnSize( wxSizeEvent &event );
481 void DrawImage( int index, wxPaintDC *dc, int x, int y );
482 void GetImageSize( int index, int &width, int &height );
483 int GetIndexOfLine( const wxListLineData *line );
484 int GetTextLength( wxString &s ); // should be const
485
486 void SetImageList( wxImageList *imageList, int which );
487 void SetItemSpacing( int spacing, bool isSmall = FALSE );
488 int GetItemSpacing( bool isSmall = FALSE );
489 void SetColumn( int col, wxListItem &item );
490 void SetColumnWidth( int col, int width );
491 void GetColumn( int col, wxListItem &item );
492 int GetColumnWidth( int vol );
493 int GetColumnCount( void );
494 int GetCountPerPage( void );
495 void SetItem( wxListItem &item );
496 void GetItem( wxListItem &item );
497 void SetItemState( long item, long state, long stateMask );
498 int GetItemState( long item, long stateMask );
499 int GetItemCount( void );
500 void GetItemRect( long index, wxRectangle &rect );
501 bool GetItemPosition(long item, wxPoint& pos);
502 int GetSelectedItemCount( void );
503 void SetMode( long mode );
504 long GetMode( void ) const;
505 void CalculatePositions( void );
506 void RealizeChanges(void);
507 long GetNextItem( long item, int geometry, int state );
508 void DeleteItem( long index );
509 void DeleteAllItems( void );
510 void DeleteColumn( int col );
511 void DeleteEverything( void );
512 void EnsureVisible( long index );
513 long FindItem(long start, const wxString& str, bool partial = FALSE );
514 long FindItem(long start, long data);
515 long HitTest( int x, int y, int &flags );
516 void InsertItem( wxListItem &item );
517 // void AddItem( wxListItem &item );
518 void InsertColumn( long col, wxListItem &item );
519 // void AddColumn( wxListItem &item );
520 void SortItems( wxListCtrlCompare fn, long data );
521 virtual bool OnListNotify( wxListEvent &event );
522
523 DECLARE_EVENT_TABLE()
524 };
525
526 //-----------------------------------------------------------------------------
527 // wxListCtrl
528 //-----------------------------------------------------------------------------
529
530 class wxListCtrl: public wxControl
531 {
532 DECLARE_DYNAMIC_CLASS(wxListCtrl);
533
534 public:
535
536 wxListCtrl(void);
537 wxListCtrl( wxWindow *parent, wxWindowID id = -1,
538 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
539 long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
540 const wxString &name = "listctrl" )
541 {
542 Create(parent, id, pos, size, style, validator, name);
543 }
544 ~wxListCtrl(void);
545 bool Create( wxWindow *parent, wxWindowID id = -1,
546 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
547 long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
548 const wxString &name = "listctrl" );
549 void OnSize( wxSizeEvent &event );
550 bool GetColumn( int col, wxListItem& item );
551 bool SetColumn( int col, wxListItem& item );
552 int GetColumnWidth( int col );
553 bool SetColumnWidth( int col, int width);
554 int GetCountPerPage(void); // not the same in wxGLC as in Windows, I think
555 // wxText& GetEditControl(void) const; // not supported in wxGLC
556 bool GetItem( wxListItem& info );
557 bool SetItem( wxListItem& info ) ;
558 long SetItem( long index, int col, const wxString& label, int imageId = -1 );
559 int GetItemState( long item, long stateMask );
560 bool SetItemState( long item, long state, long stateMask);
561 bool SetItemImage( long item, int image, int selImage);
562 wxString GetItemText( long item );
563 void SetItemText( long item, const wxString& str );
564 long GetItemData( long item );
565 bool SetItemData( long item, long data );
566 bool GetItemRect( long item, wxRectangle& rect, int code = wxLIST_RECT_BOUNDS );
567 bool GetItemPosition( long item, wxPoint& pos );
568 bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
569 int GetItemCount(void);
570 void SetItemSpacing( int spacing, bool isSmall = FALSE );
571 int GetItemSpacing( bool isSmall );
572 int GetSelectedItemCount(void);
573 // wxColour GetTextColour(void) const; // wxGLC has colours for every Item (see wxListItem)
574 // void SetTextColour(const wxColour& col);
575 long GetTopItem(void);
576 void SetSingleStyle( long style, bool add = TRUE ) ;
577 void SetWindowStyleFlag(long style);
578 void RecreateWindow(void) {};
579 long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const;
580 wxImageList *GetImageList(int which);
581 void SetImageList(wxImageList *imageList, int which) ;
582 bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
583 bool DeleteItem( long item );
584 bool DeleteAllItems(void) ;
585 bool DeleteColumn( int col );
586 // wxText& Edit(long item) ; // not supported in wxGLC
587 bool EnsureVisible( long item );
588 long FindItem(long start, const wxString& str, bool partial = FALSE );
589 long FindItem(long start, long data);
590 long FindItem(long start, const wxPoint& pt, int direction); // not supported in wxGLC
591 long HitTest(const wxPoint& point, int& flags);
592 long InsertItem(wxListItem& info);
593 long InsertItem(long index, const wxString& label);
594 long InsertItem(long index, int imageIndex);
595 long InsertItem(long index, const wxString& label, int imageIndex);
596 long InsertColumn(long col, wxListItem& info);
597 long InsertColumn(long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT,
598 int width = -1);
599 bool ScrollList(int dx, int dy);
600 bool SortItems(wxListCtrlCompare fn, long data);
601 bool Update(long item);
602 virtual bool OnListNotify(wxListEvent& WXUNUSED(event)) { return FALSE; }
603 void OnIdle( wxIdleEvent &event );
604
605 // We have to hand down a few functions
606
607 void SetBackgroundColour( const wxColour &colour );
608 void SetForegroundColour( const wxColour &colour );
609 void SetFont( const wxFont &font );
610
611 void SetDropTarget( wxDropTarget *dropTarget )
612 { m_mainWin->SetDropTarget( dropTarget ); }
613 wxDropTarget *GetDropTarget() const
614 { return m_mainWin->GetDropTarget(); }
615 void SetCursor( const wxCursor &cursor )
616 { m_mainWin->SetCursor( cursor); }
617 wxColour GetBackgroundColour() const
618 { return m_mainWin->GetBackgroundColour(); }
619 wxColour GetForegroundColour() const
620 { return m_mainWin->GetForegroundColour(); }
621 bool PopupMenu( wxMenu *menu, int x, int y )
622 { return m_mainWin->PopupMenu( menu, x, y ); }
623
624 // implementation
625
626 // wxListTextCtrl m_textCtrl;
627 wxImageList *m_imageListNormal;
628 wxImageList *m_imageListSmall;
629 wxImageList *m_imageListState; // what's that ?
630 wxListHeaderWindow *m_headerWin;
631 wxListMainWindow *m_mainWin;
632
633 DECLARE_EVENT_TABLE()
634
635 };
636
637
638 #endif // __LISTCTRLH_G__