1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/dataview.h
3 // Purpose: wxDataViewCtrl GTK+2 implementation header
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef __GTKDATAVIEWCTRLH__
11 #define __GTKDATAVIEWCTRLH__
14 #include "wx/object.h"
16 #include "wx/control.h"
18 // ---------------------------------------------------------
20 // ---------------------------------------------------------
22 class WXDLLIMPEXP_CORE wxDataViewCtrl
;
24 // ---------------------------------------------------------
26 // ---------------------------------------------------------
28 class wxDataViewCell
: public wxDataViewCellBase
31 wxDataViewCell( const wxString
&varianttype
, wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
34 void* GetGtkHandle() { return m_renderer
; }
37 // holds the GTK handle
41 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell
)
44 // ---------------------------------------------------------
46 // ---------------------------------------------------------
48 class wxDataViewTextCell
: public wxDataViewCell
51 wxDataViewTextCell( const wxString
&varianttype
= wxT("string"),
52 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
54 bool SetValue( const wxVariant
&value
);
55 bool GetValue( wxVariant
&value
);
58 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell
)
61 // ---------------------------------------------------------
62 // wxDataViewBitmapCell
63 // ---------------------------------------------------------
65 class wxDataViewBitmapCell
: public wxDataViewCell
68 wxDataViewBitmapCell( const wxString
&varianttype
= wxT("wxBitmap"),
69 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
71 bool SetValue( const wxVariant
&value
);
72 bool GetValue( wxVariant
&value
);
75 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewBitmapCell
)
78 // ---------------------------------------------------------
79 // wxDataViewToggleCell
80 // ---------------------------------------------------------
82 class wxDataViewToggleCell
: public wxDataViewCell
85 wxDataViewToggleCell( const wxString
&varianttype
= wxT("bool"),
86 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
88 bool SetValue( const wxVariant
&value
);
89 bool GetValue( wxVariant
&value
);
92 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell
)
95 // ---------------------------------------------------------
96 // wxDataViewCustomCell
97 // ---------------------------------------------------------
99 class wxDataViewCustomCell
: public wxDataViewCell
102 wxDataViewCustomCell( const wxString
&varianttype
= wxT("string"),
103 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
104 bool no_init
= false );
105 virtual ~wxDataViewCustomCell();
108 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
) = 0;
109 virtual wxSize
GetSize() = 0;
111 virtual bool Activate( wxRect cell
,
112 wxDataViewListModel
*model
, size_t col
, size_t row
)
115 virtual bool LeftClick( wxPoint cursor
, wxRect cell
,
116 wxDataViewListModel
*model
, size_t col
, size_t row
)
118 virtual bool RightClick( wxPoint cursor
, wxRect cell
,
119 wxDataViewListModel
*model
, size_t col
, size_t row
)
121 virtual bool StartDrag( wxPoint cursor
, wxRect cell
,
122 wxDataViewListModel
*model
, size_t col
, size_t row
)
125 // Create DC on request
126 virtual wxDC
*GetDC();
132 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell
)
135 // ---------------------------------------------------------
136 // wxDataViewProgressCell
137 // ---------------------------------------------------------
139 class wxDataViewProgressCell
: public wxDataViewCustomCell
142 wxDataViewProgressCell( const wxString
&label
= wxEmptyString
,
143 const wxString
&varianttype
= wxT("long"),
144 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
145 virtual ~wxDataViewProgressCell();
147 bool SetValue( const wxVariant
&value
);
149 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
150 virtual wxSize
GetSize();
157 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell
)
160 // ---------------------------------------------------------
161 // wxDataViewDateCell
162 // ---------------------------------------------------------
164 class wxDataViewDateCell
: public wxDataViewCustomCell
167 wxDataViewDateCell( const wxString
&varianttype
= wxT("datetime"),
168 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
);
170 bool SetValue( const wxVariant
&value
);
172 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
173 virtual wxSize
GetSize();
174 virtual bool Activate( wxRect cell
,
175 wxDataViewListModel
*model
, size_t col
, size_t row
);
181 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell
)
184 // ---------------------------------------------------------
186 // ---------------------------------------------------------
188 class WXDLLIMPEXP_CORE wxDataViewColumn
: public wxDataViewColumnBase
191 wxDataViewColumn( const wxString
&title
, wxDataViewCell
*cell
, size_t model_column
,
192 int fixed_width
= 80, wxDataViewColumnSizing sizing
= wxDATAVIEW_COL_WIDTH_FIXED
, int flags
= 0 );
193 virtual ~wxDataViewColumn();
195 virtual void SetTitle( const wxString
&title
);
197 virtual int GetWidth();
199 virtual void SetFixedWidth( int width
);
200 virtual int GetFixedWidth();
203 void* GetGtkHandle() { return m_column
; }
206 // holds the GTK handle
210 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn
)
213 // ---------------------------------------------------------
215 // ---------------------------------------------------------
217 class WXDLLIMPEXP_CORE wxDataViewCtrl
: public wxDataViewCtrlBase
225 wxDataViewCtrl( wxWindow
*parent
, wxWindowID id
,
226 const wxPoint
& pos
= wxDefaultPosition
,
227 const wxSize
& size
= wxDefaultSize
, long style
= 0,
228 const wxValidator
& validator
= wxDefaultValidator
)
230 Create(parent
, id
, pos
, size
, style
, validator
);
233 virtual ~wxDataViewCtrl();
237 bool Create(wxWindow
*parent
, wxWindowID id
,
238 const wxPoint
& pos
= wxDefaultPosition
,
239 const wxSize
& size
= wxDefaultSize
, long style
= 0,
240 const wxValidator
& validator
= wxDefaultValidator
);
242 virtual bool AssociateModel( wxDataViewListModel
*model
);
243 virtual bool AppendColumn( wxDataViewColumn
*col
);
246 friend class wxDataViewCtrlDC
;
247 friend class wxGtkDataViewListModelNotifier
;
248 GtkWidget
*m_treeview
;
249 wxDataViewListModelNotifier
*m_notifier
;
252 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl
)
253 DECLARE_NO_COPY_CLASS(wxDataViewCtrl
)
257 #endif // __GTKDATAVIEWCTRLH__