]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dataview.h
fix printf() argument type in GetOsInfo()
[wxWidgets.git] / include / wx / gtk / dataview.h
CommitLineData
239eaa41
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: wx/gtk/dataview.h
3// Purpose: wxDataViewCtrl GTK+2 implementation header
4// Author: Robert Roebling
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
10#ifndef __GTKDATAVIEWCTRLH__
11#define __GTKDATAVIEWCTRLH__
12
13#include "wx/defs.h"
14#include "wx/object.h"
15#include "wx/list.h"
16#include "wx/control.h"
17
18// ---------------------------------------------------------
19// classes
20// ---------------------------------------------------------
21
22class WXDLLIMPEXP_CORE wxDataViewCtrl;
23
6842a71a
RR
24// ---------------------------------------------------------
25// wxDataViewCell
26// ---------------------------------------------------------
27
28class wxDataViewCell: public wxDataViewCellBase
29{
30public:
31 wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
32
33 // implementation
34 void* GetGtkHandle() { return m_renderer; }
35
36protected:
37 // holds the GTK handle
38 void* m_renderer;
39
40protected:
41 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
42};
43
44// ---------------------------------------------------------
45// wxDataViewTextCell
46// ---------------------------------------------------------
47
48class wxDataViewTextCell: public wxDataViewCell
49{
50public:
51 wxDataViewTextCell( const wxString &varianttype = wxT("string"),
52 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
53
7b4fde82 54 bool SetValue( const wxVariant &value );
a7f61f76 55 bool GetValue( wxVariant &value );
7b4fde82 56
6842a71a
RR
57protected:
58 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
59};
60
605c2c4a
RR
61// ---------------------------------------------------------
62// wxDataViewToggleCell
63// ---------------------------------------------------------
64
65class wxDataViewToggleCell: public wxDataViewCell
66{
67public:
68 wxDataViewToggleCell( const wxString &varianttype = wxT("bool"),
69 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
70
71 bool SetValue( const wxVariant &value );
72 bool GetValue( wxVariant &value );
73
74protected:
75 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
76};
77
e152afc3
RR
78// ---------------------------------------------------------
79// wxDataViewCustomCell
80// ---------------------------------------------------------
81
82class wxDataViewCustomCell: public wxDataViewCell
83{
84public:
85 wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
ad63bf41
RR
86 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT,
87 bool no_init = false );
e152afc3 88 ~wxDataViewCustomCell();
ad63bf41 89 bool Init();
e152afc3
RR
90
91 virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
92 virtual wxSize GetSize() = 0;
4d496ecb
RR
93
94 virtual bool Activate( wxRect cell,
95 wxDataViewListModel *model, size_t col, size_t row )
96 { return false; }
97
98 virtual bool LeftClick( wxPoint cursor, wxRect cell,
99 wxDataViewListModel *model, size_t col, size_t row )
100 { return false; }
101 virtual bool RightClick( wxPoint cursor, wxRect cell,
102 wxDataViewListModel *model, size_t col, size_t row )
103 { return false; }
104 virtual bool StartDrag( wxPoint cursor, wxRect cell,
105 wxDataViewListModel *model, size_t col, size_t row )
106 { return false; }
e152afc3
RR
107
108 // Create DC on request
109 virtual wxDC *GetDC();
110
111private:
112 wxDC *m_dc;
113
114protected:
115 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
116};
117
ad63bf41
RR
118// ---------------------------------------------------------
119// wxDataViewProgressCell
120// ---------------------------------------------------------
121
122class wxDataViewProgressCell: public wxDataViewCustomCell
123{
124public:
125 wxDataViewProgressCell( const wxString &label = wxEmptyString,
126 const wxString &varianttype = wxT("long"),
127 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
128 ~wxDataViewProgressCell();
129
130 bool SetValue( const wxVariant &value );
131
132 virtual bool Render( wxRect cell, wxDC *dc, int state );
133 virtual wxSize GetSize();
134
135private:
136 wxString m_label;
137 int m_value;
138
139protected:
140 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell)
141};
142
4d496ecb
RR
143// ---------------------------------------------------------
144// wxDataViewDateCell
145// ---------------------------------------------------------
146
147class wxDataViewDateCell: public wxDataViewCustomCell
148{
149public:
150 wxDataViewDateCell( const wxString &varianttype = wxT("datetime"),
151 wxDataViewCellMode mode = wxDATAVIEW_CELL_ACTIVATABLE );
152
153 bool SetValue( const wxVariant &value );
154
155 virtual bool Render( wxRect cell, wxDC *dc, int state );
156 virtual wxSize GetSize();
157 virtual bool Activate( wxRect cell,
158 wxDataViewListModel *model, size_t col, size_t row );
159
160private:
161 wxDateTime m_date;
162
163protected:
164 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell)
165};
166
fa28826d
RR
167// ---------------------------------------------------------
168// wxDataViewColumn
169// ---------------------------------------------------------
170
171class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
172{
173public:
533544f2
RR
174 wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column,
175 int fixed_width = 80, wxDataViewColumnSizing sizing = wxDATAVIEW_COL_WIDTH_FIXED, int flags = 0 );
fa28826d
RR
176 virtual ~wxDataViewColumn();
177
178 virtual void SetTitle( const wxString &title );
179
533544f2
RR
180 virtual int GetWidth();
181
182 virtual void SetFixedWidth( int width );
183 virtual int GetFixedWidth();
184
fa28826d
RR
185 // implementation
186 void* GetGtkHandle() { return m_column; }
187
188private:
6842a71a 189 // holds the GTK handle
fa28826d
RR
190 void* m_column;
191
192protected:
193 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
194};
195
239eaa41
RR
196// ---------------------------------------------------------
197// wxDataViewCtrl
198// ---------------------------------------------------------
199
200class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase
201{
202public:
203 wxDataViewCtrl()
204 {
205 Init();
206 }
207
208 wxDataViewCtrl( wxWindow *parent, wxWindowID id,
209 const wxPoint& pos = wxDefaultPosition,
210 const wxSize& size = wxDefaultSize, long style = 0,
211 const wxValidator& validator = wxDefaultValidator )
212 {
213 Create(parent, id, pos, size, style, validator );
214 }
215
216 virtual ~wxDataViewCtrl();
217
218 void Init();
219
220 bool Create(wxWindow *parent, wxWindowID id,
221 const wxPoint& pos = wxDefaultPosition,
222 const wxSize& size = wxDefaultSize, long style = 0,
223 const wxValidator& validator = wxDefaultValidator );
224
6e2e590f 225 virtual bool AssociateModel( wxDataViewListModel *model );
1a367564
RR
226 virtual bool AppendColumn( wxDataViewColumn *col );
227
228private:
229 friend class wxDataViewCtrlDC;
5d605a69 230 friend class wxGtkDataViewListModelNotifier;
8f850e28
RR
231 GtkWidget *m_treeview;
232 wxDataViewListModelNotifier *m_notifier;
239eaa41
RR
233
234private:
235 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
236 DECLARE_NO_COPY_CLASS(wxDataViewCtrl)
237};
238
239
240#endif // __GTKDATAVIEWCTRLH__