]>
Commit | Line | Data |
---|---|---|
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 | bool no_init = false ); | |
88 | ~wxDataViewCustomCell(); | |
89 | bool Init(); | |
90 | ||
91 | virtual bool Render( wxRect cell, wxDC *dc, int state ) = 0; | |
92 | virtual wxSize GetSize() = 0; | |
93 | virtual bool Activate( wxRect cell ) { return false; }; | |
94 | ||
95 | // Create DC on request | |
96 | virtual wxDC *GetDC(); | |
97 | ||
98 | private: | |
99 | wxDC *m_dc; | |
100 | ||
101 | protected: | |
102 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewCustomCell) | |
103 | }; | |
104 | ||
105 | // --------------------------------------------------------- | |
106 | // wxDataViewProgressCell | |
107 | // --------------------------------------------------------- | |
108 | ||
109 | class wxDataViewProgressCell: public wxDataViewCustomCell | |
110 | { | |
111 | public: | |
112 | wxDataViewProgressCell( const wxString &label = wxEmptyString, | |
113 | const wxString &varianttype = wxT("long"), | |
114 | wxDataViewCellMode mode = wxDATAVIEW_CELL_INERT ); | |
115 | ~wxDataViewProgressCell(); | |
116 | ||
117 | bool SetValue( const wxVariant &value ); | |
118 | ||
119 | virtual bool Render( wxRect cell, wxDC *dc, int state ); | |
120 | virtual wxSize GetSize(); | |
121 | ||
122 | private: | |
123 | wxString m_label; | |
124 | int m_value; | |
125 | ||
126 | protected: | |
127 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewProgressCell) | |
128 | }; | |
129 | ||
130 | // --------------------------------------------------------- | |
131 | // wxDataViewColumn | |
132 | // --------------------------------------------------------- | |
133 | ||
134 | class WXDLLIMPEXP_CORE wxDataViewColumn: public wxDataViewColumnBase | |
135 | { | |
136 | public: | |
137 | wxDataViewColumn( const wxString &title, wxDataViewCell *cell, size_t model_column, int flags = 0 ); | |
138 | virtual ~wxDataViewColumn(); | |
139 | ||
140 | virtual void SetTitle( const wxString &title ); | |
141 | ||
142 | // implementation | |
143 | void* GetGtkHandle() { return m_column; } | |
144 | ||
145 | private: | |
146 | // holds the GTK handle | |
147 | void* m_column; | |
148 | ||
149 | protected: | |
150 | DECLARE_DYNAMIC_CLASS_NO_COPY(wxDataViewColumn) | |
151 | }; | |
152 | ||
153 | // --------------------------------------------------------- | |
154 | // wxDataViewCtrl | |
155 | // --------------------------------------------------------- | |
156 | ||
157 | class WXDLLIMPEXP_CORE wxDataViewCtrl: public wxDataViewCtrlBase | |
158 | { | |
159 | public: | |
160 | wxDataViewCtrl() | |
161 | { | |
162 | Init(); | |
163 | } | |
164 | ||
165 | wxDataViewCtrl( wxWindow *parent, wxWindowID id, | |
166 | const wxPoint& pos = wxDefaultPosition, | |
167 | const wxSize& size = wxDefaultSize, long style = 0, | |
168 | const wxValidator& validator = wxDefaultValidator ) | |
169 | { | |
170 | Create(parent, id, pos, size, style, validator ); | |
171 | } | |
172 | ||
173 | virtual ~wxDataViewCtrl(); | |
174 | ||
175 | void Init(); | |
176 | ||
177 | bool Create(wxWindow *parent, wxWindowID id, | |
178 | const wxPoint& pos = wxDefaultPosition, | |
179 | const wxSize& size = wxDefaultSize, long style = 0, | |
180 | const wxValidator& validator = wxDefaultValidator ); | |
181 | ||
182 | virtual bool AssociateModel( wxDataViewListModel *model ); | |
183 | virtual bool AppendColumn( wxDataViewColumn *col ); | |
184 | ||
185 | private: | |
186 | friend class wxDataViewCtrlDC; | |
187 | GtkWidget *m_treeview; | |
188 | ||
189 | private: | |
190 | DECLARE_DYNAMIC_CLASS(wxDataViewCtrl) | |
191 | DECLARE_NO_COPY_CLASS(wxDataViewCtrl) | |
192 | }; | |
193 | ||
194 | ||
195 | #endif // __GTKDATAVIEWCTRLH__ |