]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/listctrl.h
event/leave events
[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"
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
31class wxListItem;
32class wxListEvent;
33class wxListCtrl;
34
35//-----------------------------------------------------------------------------
36// internal classes
37//-----------------------------------------------------------------------------
38
39class wxListHeaderData;
40class wxListItemData;
41class wxListLineData;
42
43class wxListHeaderWindow;
44class wxListMainWindow;
45
46class wxListRenameTimer;
47//class wxListTextCtrl;
48
49//-----------------------------------------------------------------------------
50// types
51//-----------------------------------------------------------------------------
52
53// type of compare function for wxListCtrl sort operation
debe6624 54typedef int (*wxListCtrlCompare)(long item1, long item2, long sortData);
c801d85f
KB
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
117enum {
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
126enum {
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
134enum {
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
142enum {
143 wxLIST_AUTOSIZE = -1, // always 80 in wxGLC (what else?)
144 wxLIST_AUTOSIZE_USEHEADER = -2
145};
146
147// Flag values for GetItemRect
148enum {
149 wxLIST_RECT_BOUNDS,
150 wxLIST_RECT_ICON,
151 wxLIST_RECT_LABEL
152};
153
154// Flag values for FindItem // not supported by wxGLC
155enum {
156 wxLIST_FIND_UP,
157 wxLIST_FIND_DOWN,
158 wxLIST_FIND_LEFT,
159 wxLIST_FIND_RIGHT
160};
161
162// Flag values for Set/GetImageList
163enum {
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
174class 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
200class WXDLLEXPORT wxListEvent: public wxCommandEvent
201{
202 DECLARE_DYNAMIC_CLASS(wxListEvent)
203
204 public:
64693098 205 wxListEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
c801d85f
KB
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
217typedef void (wxEvtHandler::*wxListEventFunction)(wxListEvent&);
218
fe71f65c
RR
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 },
c801d85f
KB
232
233
234//-----------------------------------------------------------------------------
235// wxListItemData (internal)
236//-----------------------------------------------------------------------------
237
238class 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 );
debe6624
JS
255 void SetImage( int image );
256 void SetData( long data );
257 void SetPosition( int x, int y );
258 void SetSize( int width, int height );
c801d85f
KB
259 void SetColour( wxColour *col );
260 bool HasImage(void) const;
261 bool HasText(void) const;
debe6624 262 bool IsHit( int x, int y ) const;
c801d85f
KB
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
277class 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 );
debe6624
JS
294 void SetPosition( int x, int y );
295 void SetWidth( int w );
296 void SetFormat( int format );
297 void SetHeight( int h );
c801d85f
KB
298 bool HasImage(void) const;
299 bool HasText(void) const;
debe6624 300 bool IsHit( int x, int y ) const;
c801d85f
KB
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
312class 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
debe6624 328 void DoDraw( wxPaintDC *dc, bool hilight, bool paintBG );
c801d85f
KB
329
330 public:
331 wxListLineData( void ) {};
debe6624
JS
332 wxListLineData( wxListMainWindow *owner, int mode, wxBrush *hilightBrush );
333 void CalculateSize( wxPaintDC *dc, int spacing );
334 void SetPosition( wxPaintDC *dc, int x, int y, int window_width );
335 void SetColumnPosition( int index, int x );
c801d85f
KB
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 );
debe6624
JS
339 long IsHit( int x, int y );
340 void InitItems( int num );
341 void SetItem( int index, const wxListItem &info );
342 void GetItem( int index, wxListItem &info );
343 void GetText( int index, wxString &s );
344 void SetText( int index, const wxString s );
345 int GetImage( int index );
c801d85f 346 void GetRect( wxRectangle &rect );
debe6624 347 void Hilight( bool on );
c801d85f 348 void ReverseHilight( void );
debe6624 349 void DrawRubberBand( wxPaintDC *dc, bool on );
c801d85f 350 void Draw( wxPaintDC *dc );
debe6624 351 bool IsInRect( int x, int y, const wxRectangle &rect );
c801d85f 352 bool IsHilighted( void );
debe6624 353 void AssignRect( wxRectangle &dest, int x, int y, int width, int height );
c801d85f
KB
354 void AssignRect( wxRectangle &dest, const wxRectangle &source );
355};
356
357//-----------------------------------------------------------------------------
358// wxListHeaderWindow (internal)
359//-----------------------------------------------------------------------------
360
361class 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 );
debe6624
JS
372 wxListHeaderWindow( wxWindow *win, wxWindowID id, wxListMainWindow *owner,
373 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
374 long style = 0, const wxString &name = "columntitles" );
c801d85f
KB
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
387class 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
403class 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
459class 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);
debe6624
JS
490 wxListMainWindow( wxWindow *parent, wxWindowID id,
491 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
492 long style = 0, const wxString &name = "listctrl" );
c801d85f
KB
493 ~wxListMainWindow(void);
494 void RefreshLine( wxListLineData *line );
495 void OnPaint( wxPaintEvent &event );
debe6624 496 void HilightAll( bool on );
c801d85f 497 void ActivateLine( wxListLineData *line );
64693098 498 void SendNotify( wxListLineData *line, wxEventType command );
c801d85f
KB
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
debe6624
JS
520 void SetImageList( wxImageList *imageList, int which );
521 void SetItemSpacing( int spacing, bool isSmall = FALSE );
522 int GetItemSpacing( bool isSmall = FALSE );
523 void SetColumn( int col, wxListItem &item );
524 void SetColumnWidth( int col, int width );
525 void GetColumn( int col, wxListItem &item );
526 int GetColumnWidth( int vol );
c801d85f
KB
527 int GetColumnCount( void );
528 int GetCountPerPage( void );
529 void SetItem( wxListItem &item );
530 void GetItem( wxListItem &item );
debe6624
JS
531 void SetItemState( long item, long state, long stateMask );
532 int GetItemState( long item, long stateMask );
c801d85f 533 int GetItemCount( void );
debe6624 534 void GetItemRect( long index, wxRectangle &rect );
c801d85f 535 int GetSelectedItemCount( void );
debe6624 536 void SetMode( long mode );
c801d85f
KB
537 long GetMode( void ) const;
538 void CalculatePositions( void );
539 void RealizeChanges(void);
debe6624
JS
540 long GetNextItem( long item, int geometry, int state );
541 void DeleteItem( long index );
c801d85f 542 void DeleteAllItems( void );
debe6624 543 void DeleteColumn( int col );
c801d85f 544 void DeleteEverything( void );
debe6624
JS
545 void EnsureVisible( long index );
546 long FindItem(long start, const wxString& str, bool partial = FALSE );
547 long FindItem(long start, long data);
548 long HitTest( int x, int y, int &flags );
c801d85f 549 void InsertItem( wxListItem &item );
debe6624 550 void InsertColumn( long col, wxListItem &item );
c801d85f
KB
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
561class wxListCtrl: public wxControl
562{
563 DECLARE_DYNAMIC_CLASS(wxListCtrl);
564
565 public:
566
567 wxListCtrl(void);
debe6624
JS
568 wxListCtrl( wxWindow *parent, wxWindowID id,
569 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
570 long style = 0, const wxString &name = "listctrl" );
c801d85f 571 ~wxListCtrl(void);
debe6624
JS
572 bool Create( wxWindow *parent, wxWindowID id,
573 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
574 long style = 0, const wxString &name = "listctrl" );
c801d85f
KB
575 void OnSize( wxSizeEvent &event );
576 void SetBackgroundColour( const wxColour& col );
debe6624
JS
577 bool GetColumn( int col, wxListItem& item );
578 bool SetColumn( int col, wxListItem& item );
579 int GetColumnWidth( int col );
580 bool SetColumnWidth( int col, int width);
c801d85f
KB
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 ) ;
debe6624
JS
585 long SetItem( long index, int col, const wxString& label, int imageId = -1 );
586 int GetItemState( long item, long stateMask );
587 bool SetItemState( long item, long state, long stateMask);
588 bool SetItemImage( long item, int image, int selImage);
589 wxString GetItemText( long item );
590 void SetItemText( long item, const wxString& str );
591 long GetItemData( long item );
592 bool SetItemData( long item, long data );
593 bool GetItemRect( long item, wxRectangle& rect, int code = wxLIST_RECT_BOUNDS ); // not supported in wxGLC
594 bool GetItemPosition( long item, wxPoint& pos ) const; // not supported in wxGLC
595 bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
c801d85f
KB
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);
debe6624
JS
602 void SetSingleStyle( long style, bool add = TRUE ) ;
603 void SetWindowStyleFlag(long style);
c801d85f 604 void RecreateWindow(void) {};
debe6624
JS
605 long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE);
606 wxImageList *GetImageList(int which);
607 void SetImageList(wxImageList *imageList, int which) ;
608 bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
609 bool DeleteItem( long item );
c801d85f 610 bool DeleteAllItems(void) ;
debe6624
JS
611 bool DeleteColumn( int col );
612// wxText& Edit(long item) ; // not supported in wxGLC
613 bool EnsureVisible( long item );
614 long FindItem(long start, const wxString& str, bool partial = FALSE );
615 long FindItem(long start, long data);
616 long FindItem(long start, const wxPoint& pt, int direction); // not supported in wxGLC
c801d85f
KB
617 long HitTest(const wxPoint& point, int& flags);
618 long InsertItem(wxListItem& info);
debe6624
JS
619 long InsertItem(long index, const wxString& label);
620 long InsertItem(long index, int imageIndex);
621 long InsertItem(long index, const wxString& label, int imageIndex);
622 long InsertColumn(long col, wxListItem& info);
623 long InsertColumn(long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT,
624 int width = -1);
625 bool ScrollList(int dx, int dy);
c801d85f 626 bool SortItems(wxListCtrlCompare fn, long data);
debe6624 627 bool Update(long item);
c801d85f
KB
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(); };
53010e52
RR
633
634 void OnIdle( wxIdleEvent &event );
c801d85f
KB
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__