]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dataview.h
1e398fe662d925181614906c4b62d0132a28152f
[wxWidgets.git] / include / wx / gtk / dataview.h
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
22 class WXDLLIMPEXP_CORE wxDataViewCtrl;
23
24 // ---------------------------------------------------------
25 // wxDataViewCell
26 // ---------------------------------------------------------
27
28 class wxDataViewCell: public wxDataViewCellBase
29 {
30 public:
31 wxDataViewCell( const wxString &varianttype, wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
32
33 // implementation
34 void* GetGtkHandle() { return m_renderer; }
35
36 protected:
37 // holds the GTK handle
38 void* m_renderer;
39
40 protected:
41 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCell)
42 };
43
44 // ---------------------------------------------------------
45 // wxDataViewTextCell
46 // ---------------------------------------------------------
47
48 class wxDataViewTextCell: public wxDataViewCell
49 {
50 public:
51 wxDataViewTextCell( const wxString &varianttype = wxT("string"),
52 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
53
54 bool SetValue( const wxVariant &value );
55 bool GetValue( wxVariant &value );
56
57 protected:
58 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewTextCell)
59 };
60
61 // ---------------------------------------------------------
62 // wxDataViewToggleCell
63 // ---------------------------------------------------------
64
65 class wxDataViewToggleCell: public wxDataViewCell
66 {
67 public:
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
74 protected:
75 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewToggleCell)
76 };
77
78 // ---------------------------------------------------------
79 // wxDataViewCustomCell
80 // ---------------------------------------------------------
81
82 class wxDataViewCustomCell: public wxDataViewCell
83 {
84 public:
85 wxDataViewCustomCell( const wxString &varianttype = wxT("string"),
86 wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT );
87 ~wxDataViewCustomCell();
88
89 virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0;
90 virtual wxSize GetSize() = 0;
91
92 // Create DC on request
93 virtual wxDC *GetDC();
94
95 private:
96 wxDC *m_dc;
97
98 protected:
99 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell)
100 };
101
102 // ---------------------------------------------------------
103 // wxDataViewColumn
104 // ---------------------------------------------------------
105
106 class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase
107 {
108 public:
109 wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column, int flags = 0 );
110 virtual ~wxDataViewColumn();
111
112 virtual void SetTitle( const wxString &title );
113
114 // implementation
115 void* GetGtkHandle() { return m_column; }
116
117 private:
118 // holds the GTK handle
119 void* m_column;
120
121 protected:
122 DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn)
123 };
124
125 // ---------------------------------------------------------
126 // wxDataViewCtrl
127 // ---------------------------------------------------------
128
129 class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase
130 {
131 public:
132 wxDataViewCtrl()
133 {
134 Init();
135 }
136
137 wxDataViewCtrl( wxWindow *parent, wxWindowID id,
138 const wxPoint& pos = wxDefaultPosition,
139 const wxSize& size = wxDefaultSize, long style = 0,
140 const wxValidator& validator = wxDefaultValidator )
141 {
142 Create(parent, id, pos, size, style, validator );
143 }
144
145 virtual ~wxDataViewCtrl();
146
147 void Init();
148
149 bool Create(wxWindow *parent, wxWindowID id,
150 const wxPoint& pos = wxDefaultPosition,
151 const wxSize& size = wxDefaultSize, long style = 0,
152 const wxValidator& validator = wxDefaultValidator );
153
154 virtual bool AssociateModel( wxDataViewListModel *model );
155 virtual bool AppendColumn( wxDataViewColumn *col );
156
157 private:
158 DECLARE_DYNAMIC_CLASS(wxDataViewCtrl)
159 DECLARE_NO_COPY_CLASS(wxDataViewCtrl)
160 };
161
162
163 #endif // __GTKDATAVIEWCTRLH__