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