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 // wxDataViewToggleCell
63 // ---------------------------------------------------------
65 class wxDataViewToggleCell
: public wxDataViewCell
68 wxDataViewToggleCell( const wxString
&varianttype
= wxT("bool"),
69 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
71 bool SetValue( const wxVariant
&value
);
72 bool GetValue( wxVariant
&value
);
75 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell
)
78 // ---------------------------------------------------------
79 // wxDataViewCustomCell
80 // ---------------------------------------------------------
82 class wxDataViewCustomCell
: public wxDataViewCell
85 wxDataViewCustomCell( const wxString
&varianttype
= wxT("string"),
86 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
,
87 bool no_init
= false );
88 ~wxDataViewCustomCell();
91 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
) = 0;
92 virtual wxSize
GetSize() = 0;
94 virtual bool Activate( wxRect cell
,
95 wxDataViewListModel
*model
, size_t col
, size_t row
)
98 virtual bool LeftClick( wxPoint cursor
, wxRect cell
,
99 wxDataViewListModel
*model
, size_t col
, size_t row
)
101 virtual bool RightClick( wxPoint cursor
, wxRect cell
,
102 wxDataViewListModel
*model
, size_t col
, size_t row
)
104 virtual bool StartDrag( wxPoint cursor
, wxRect cell
,
105 wxDataViewListModel
*model
, size_t col
, size_t row
)
108 // Create DC on request
109 virtual wxDC
*GetDC();
115 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell
)
118 // ---------------------------------------------------------
119 // wxDataViewProgressCell
120 // ---------------------------------------------------------
122 class wxDataViewProgressCell
: public wxDataViewCustomCell
125 wxDataViewProgressCell( const wxString
&label
= wxEmptyString
,
126 const wxString
&varianttype
= wxT("long"),
127 wxDataViewCellMode mode
= wxDATAVIEW_CELL_INERT
);
128 ~wxDataViewProgressCell();
130 bool SetValue( const wxVariant
&value
);
132 virtual bool Render( wxRect cell
, wxDC
*dc
, int state
);
133 virtual wxSize
GetSize();
140 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell
)
143 // ---------------------------------------------------------
144 // wxDataViewDateCell
145 // ---------------------------------------------------------
147 class wxDataViewDateCell
: public wxDataViewCustomCell
150 wxDataViewDateCell( const wxString
&varianttype
= wxT("datetime"),
151 wxDataViewCellMode mode
= wxDATAVIEW_CELL_ACTIVATABLE
);
153 bool SetValue( const wxVariant
&value
);
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
);
164 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewDateCell
)
167 // ---------------------------------------------------------
169 // ---------------------------------------------------------
171 class WXDLLIMPEXP_CORE wxDataViewColumn
: public wxDataViewColumnBase
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 );
176 virtual ~wxDataViewColumn();
178 virtual void SetTitle( const wxString
&title
);
180 virtual int GetWidth();
182 virtual void SetFixedWidth( int width
);
183 virtual int GetFixedWidth();
186 void* GetGtkHandle() { return m_column
; }
189 // holds the GTK handle
193 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn
)
196 // ---------------------------------------------------------
198 // ---------------------------------------------------------
200 class WXDLLIMPEXP_CORE wxDataViewCtrl
: public wxDataViewCtrlBase
208 wxDataViewCtrl( wxWindow
*parent
, wxWindowID id
,
209 const wxPoint
& pos
= wxDefaultPosition
,
210 const wxSize
& size
= wxDefaultSize
, long style
= 0,
211 const wxValidator
& validator
= wxDefaultValidator
)
213 Create(parent
, id
, pos
, size
, style
, validator
);
216 virtual ~wxDataViewCtrl();
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
);
225 virtual bool AssociateModel( wxDataViewListModel
*model
);
226 virtual bool AppendColumn( wxDataViewColumn
*col
);
229 friend class wxDataViewCtrlDC
;
230 friend class wxGtkDataViewListModelNotifier
;
231 GtkWidget
*m_treeview
;
232 wxDataViewListModelNotifier
*m_notifier
;
235 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl
)
236 DECLARE_NO_COPY_CLASS(wxDataViewCtrl
)
240 #endif // __GTKDATAVIEWCTRLH__