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