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