]> git.saurik.com Git - wxWidgets.git/blob - include/wx/generic/listctrl.h
Added project files for wxUniv under MSW
[wxWidgets.git] / include / wx / generic / listctrl.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/generic/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/generic/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 #if wxUSE_DRAG_AND_DROP
29 class WXDLLEXPORT wxDropTarget;
30 #endif
31
32 //-----------------------------------------------------------------------------
33 // classes
34 //-----------------------------------------------------------------------------
35
36 class WXDLLEXPORT wxListItem;
37 class WXDLLEXPORT wxListEvent;
38 class WXDLLEXPORT wxListCtrl;
39
40 //-----------------------------------------------------------------------------
41 // internal classes
42 //-----------------------------------------------------------------------------
43
44 class WXDLLEXPORT wxListHeaderData;
45 class WXDLLEXPORT wxListItemData;
46 class WXDLLEXPORT wxListLineData;
47
48 class WXDLLEXPORT wxListHeaderWindow;
49 class WXDLLEXPORT wxListMainWindow;
50
51 class WXDLLEXPORT wxListRenameTimer;
52 class WXDLLEXPORT wxListTextCtrl;
53
54 //-----------------------------------------------------------------------------
55 // wxListCtrl
56 //-----------------------------------------------------------------------------
57
58 class WXDLLEXPORT wxListCtrl: public wxControl
59 {
60 public:
61 wxListCtrl();
62 wxListCtrl( wxWindow *parent,
63 wxWindowID id = -1,
64 const wxPoint &pos = wxDefaultPosition,
65 const wxSize &size = wxDefaultSize,
66 long style = wxLC_ICON,
67 const wxValidator& validator = wxDefaultValidator,
68 const wxString &name = "listctrl" )
69 {
70 Create(parent, id, pos, size, style, validator, name);
71 }
72 ~wxListCtrl();
73
74 bool Create( wxWindow *parent,
75 wxWindowID id = -1,
76 const wxPoint &pos = wxDefaultPosition,
77 const wxSize &size = wxDefaultSize,
78 long style = wxLC_ICON,
79 const wxValidator& validator = wxDefaultValidator,
80 const wxString &name = "listctrl" );
81
82 bool GetColumn( int col, wxListItem& item ) const;
83 bool SetColumn( int col, wxListItem& item );
84 int GetColumnWidth( int col ) const;
85 bool SetColumnWidth( int col, int width);
86 int GetCountPerPage() const; // not the same in wxGLC as in Windows, I think
87
88 bool GetItem( wxListItem& info ) const;
89 bool SetItem( wxListItem& info ) ;
90 long SetItem( long index, int col, const wxString& label, int imageId = -1 );
91 int GetItemState( long item, long stateMask ) const;
92 bool SetItemState( long item, long state, long stateMask);
93 bool SetItemImage( long item, int image, int selImage);
94 wxString GetItemText( long item ) const;
95 void SetItemText( long item, const wxString& str );
96 long GetItemData( long item ) const;
97 bool SetItemData( long item, long data );
98 bool GetItemRect( long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS ) const;
99 bool GetItemPosition( long item, wxPoint& pos ) const;
100 bool SetItemPosition( long item, const wxPoint& pos ); // not supported in wxGLC
101 int GetItemCount() const;
102 int GetColumnCount() const;
103 void SetItemSpacing( int spacing, bool isSmall = FALSE );
104 int GetItemSpacing( bool isSmall ) const;
105 int GetSelectedItemCount() const;
106 wxColour GetTextColour() const;
107 void SetTextColour(const wxColour& col);
108 long GetTopItem() const;
109
110 void SetSingleStyle( long style, bool add = TRUE ) ;
111 void SetWindowStyleFlag( long style );
112 void RecreateWindow() {}
113 long GetNextItem( long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE ) const;
114 wxImageList *GetImageList( int which ) const;
115 void SetImageList( wxImageList *imageList, int which );
116 void AssignImageList( wxImageList *imageList, int which );
117 bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC
118
119 void ClearAll();
120 bool DeleteItem( long item );
121 bool DeleteAllItems();
122 bool DeleteAllColumns();
123 bool DeleteColumn( int col );
124
125 void EditLabel( long item ) { Edit(item); }
126 void Edit( long item );
127
128 bool EnsureVisible( long item );
129 long FindItem( long start, const wxString& str, bool partial = FALSE );
130 long FindItem( long start, long data );
131 long FindItem( long start, const wxPoint& pt, int direction ); // not supported in wxGLC
132 long HitTest( const wxPoint& point, int& flags);
133 long InsertItem(wxListItem& info);
134 long InsertItem( long index, const wxString& label );
135 long InsertItem( long index, int imageIndex );
136 long InsertItem( long index, const wxString& label, int imageIndex );
137 long InsertColumn( long col, wxListItem& info );
138 long InsertColumn( long col, const wxString& heading, int format = wxLIST_FORMAT_LEFT,
139 int width = -1 );
140 bool ScrollList( int dx, int dy );
141 bool SortItems( wxListCtrlCompare fn, long data );
142 bool Update( long item );
143
144 void OnIdle( wxIdleEvent &event );
145 void OnSize( wxSizeEvent &event );
146
147 // We have to hand down a few functions
148
149 bool SetBackgroundColour( const wxColour &colour );
150 bool SetForegroundColour( const wxColour &colour );
151 bool SetFont( const wxFont &font );
152
153 #if wxUSE_DRAG_AND_DROP
154 void SetDropTarget( wxDropTarget *dropTarget );
155 wxDropTarget *GetDropTarget() const;
156 #endif
157
158 bool SetCursor( const wxCursor &cursor );
159 wxColour GetBackgroundColour() const;
160 wxColour GetForegroundColour() const;
161 bool DoPopupMenu( wxMenu *menu, int x, int y );
162 void SetFocus();
163
164 // implementation
165 // --------------
166
167 wxImageList *m_imageListNormal;
168 wxImageList *m_imageListSmall;
169 wxImageList *m_imageListState; // what's that ?
170 bool m_ownsImageListNormal,
171 m_ownsImageListSmall,
172 m_ownsImageListState;
173 wxListHeaderWindow *m_headerWin;
174 wxListMainWindow *m_mainWin;
175
176 private:
177 DECLARE_EVENT_TABLE()
178 DECLARE_DYNAMIC_CLASS(wxListCtrl);
179 };
180
181
182 #endif // __LISTCTRLH_G__