]>
Commit | Line | Data |
---|---|---|
1c4293cb VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: samples/propgrid/propgrid.h | |
3 | // Purpose: wxPropertyGrid sample | |
4 | // Author: Jaakko Salli | |
5 | // Modified by: | |
6 | // Created: 2004-09-25 | |
7 | // RCS-ID: $Id: | |
8 | // Copyright: (c) Jaakko Salli | |
9 | // Licence: wxWindows license | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_SAMPLES_PROPGRID_PROPGRID_H_ | |
13 | #define _WX_SAMPLES_PROPGRID_PROPGRID_H_ | |
14 | ||
15 | // ----------------------------------------------------------------------- | |
16 | ||
17 | class wxAdvImageFileProperty : public wxFileProperty | |
18 | { | |
19 | WX_PG_DECLARE_PROPERTY_CLASS(wxAdvImageFileProperty) | |
20 | public: | |
21 | ||
22 | wxAdvImageFileProperty( const wxString& label = wxPG_LABEL, | |
23 | const wxString& name = wxPG_LABEL, | |
24 | const wxString& value = wxEmptyString ); | |
25 | virtual ~wxAdvImageFileProperty (); | |
26 | ||
27 | virtual void OnSetValue(); // Override to allow image loading. | |
28 | ||
7eac5c53 JS |
29 | virtual bool IntToValue( wxVariant& variant, int number, int argFlags = 0 ) const; |
30 | virtual bool OnEvent( wxPropertyGrid* propgrid, wxWindow* primary, wxEvent& event ); | |
31 | virtual wxSize OnMeasureImage( int item ) const; | |
32 | virtual void OnCustomPaint( wxDC& dc, | |
33 | const wxRect& rect, wxPGPaintData& paintdata ); | |
1c4293cb VZ |
34 | |
35 | void LoadThumbnails( size_t n ); | |
36 | ||
37 | protected: | |
38 | wxImage* m_pImage; // Temporary thumbnail data. | |
39 | ||
40 | static wxPGChoices ms_choices; | |
41 | ||
42 | int m_index; // Index required for choice behaviour. | |
43 | }; | |
44 | ||
45 | // ----------------------------------------------------------------------- | |
46 | ||
47 | class wxVector3f | |
48 | { | |
49 | public: | |
50 | wxVector3f() | |
51 | { | |
52 | x = y = z = 0.0; | |
53 | } | |
54 | wxVector3f( double x, double y, double z ) | |
55 | { | |
56 | x = x; y = y; z = z; | |
57 | } | |
58 | ||
59 | double x, y, z; | |
60 | }; | |
61 | ||
62 | inline bool operator == (const wxVector3f& a, const wxVector3f& b) | |
63 | { | |
64 | return (a.x == b.x && a.y == b.y && a.z == b.z); | |
65 | } | |
66 | ||
0372d42e | 67 | WX_PG_DECLARE_VARIANT_DATA(wxVector3f) |
1c4293cb VZ |
68 | |
69 | class wxVectorProperty : public wxPGProperty | |
70 | { | |
71 | WX_PG_DECLARE_PROPERTY_CLASS(wxVectorProperty) | |
72 | public: | |
73 | ||
74 | wxVectorProperty( const wxString& label = wxPG_LABEL, | |
75 | const wxString& name = wxPG_LABEL, | |
76 | const wxVector3f& value = wxVector3f() ); | |
77 | virtual ~wxVectorProperty(); | |
78 | ||
7eac5c53 JS |
79 | virtual void ChildChanged( wxVariant& thisValue, |
80 | int childIndex, wxVariant& childValue ) const; | |
81 | virtual void RefreshChildren(); | |
1c4293cb VZ |
82 | |
83 | protected: | |
84 | }; | |
85 | ||
86 | // ----------------------------------------------------------------------- | |
87 | ||
88 | class wxTriangle | |
89 | { | |
90 | public: | |
91 | wxVector3f a, b, c; | |
92 | }; | |
93 | ||
94 | inline bool operator == (const wxTriangle& a, const wxTriangle& b) | |
95 | { | |
96 | return (a.a == b.a && a.b == b.b && a.c == b.c); | |
97 | } | |
98 | ||
0372d42e | 99 | WX_PG_DECLARE_VARIANT_DATA(wxTriangle) |
1c4293cb VZ |
100 | |
101 | class wxTriangleProperty : public wxPGProperty | |
102 | { | |
103 | WX_PG_DECLARE_PROPERTY_CLASS(wxTriangleProperty) | |
104 | public: | |
105 | ||
106 | wxTriangleProperty( const wxString& label = wxPG_LABEL, | |
107 | const wxString& name = wxPG_LABEL, | |
108 | const wxTriangle& value = wxTriangle() ); | |
109 | virtual ~wxTriangleProperty(); | |
110 | ||
7eac5c53 JS |
111 | virtual void ChildChanged( wxVariant& thisValue, |
112 | int childIndex, wxVariant& childValue ) const; | |
113 | virtual void RefreshChildren(); | |
1c4293cb VZ |
114 | |
115 | protected: | |
116 | }; | |
117 | ||
118 | // ----------------------------------------------------------------------- | |
119 | ||
120 | enum | |
121 | { | |
122 | ID_COLOURSCHEME4 = 100 | |
123 | }; | |
124 | ||
125 | // ----------------------------------------------------------------------- | |
126 | ||
127 | class FormMain : public wxFrame | |
128 | { | |
129 | public: | |
130 | FormMain(const wxString& title, const wxPoint& pos, const wxSize& size ); | |
131 | ~FormMain(); | |
132 | ||
133 | wxPropertyGridManager* m_pPropGridManager; | |
134 | wxPropertyGrid* m_propGrid; | |
135 | ||
136 | wxTextCtrl* m_tcPropLabel; | |
137 | wxWindow* m_panel; | |
138 | wxBoxSizer* m_topSizer; | |
139 | ||
524d97b1 | 140 | wxPGEditor* m_pSampleMultiButtonEditor; |
1c4293cb VZ |
141 | wxPGChoices m_combinedFlags; |
142 | ||
143 | wxMenuItem* m_itemCatColours; | |
144 | wxMenuItem* m_itemFreeze; | |
145 | wxMenuItem* m_itemEnable; | |
146 | ||
147 | wxVariant m_storedValues; | |
148 | ||
149 | wxString m_savedState; | |
150 | ||
151 | ||
152 | void CreateGrid( int style, int extraStyle ); | |
153 | ||
154 | // These are used in CreateGrid(), and in tests to compose | |
155 | // grids for testing purposes. | |
156 | void InitPanel(); | |
157 | void PopulateGrid(); | |
158 | void FinalizePanel( bool wasCreated = true ); | |
159 | ||
160 | void PopulateWithStandardItems(); | |
161 | void PopulateWithExamples(); | |
162 | void PopulateWithLibraryConfig(); | |
163 | ||
164 | void OnCloseClick( wxCommandEvent& event ); | |
165 | void OnLabelTextChange( wxCommandEvent& event ); | |
166 | ||
167 | void OnColourScheme( wxCommandEvent& event ); | |
168 | ||
169 | void OnInsertPropClick( wxCommandEvent& event ); | |
170 | void OnAppendPropClick( wxCommandEvent& event ); | |
171 | void OnClearClick( wxCommandEvent& event ); | |
172 | void OnAppendCatClick( wxCommandEvent& event ); | |
173 | void OnInsertCatClick( wxCommandEvent& event ); | |
174 | void OnDelPropClick( wxCommandEvent& event ); | |
175 | void OnDelPropRClick( wxCommandEvent& event ); | |
176 | ||
177 | void OnContextMenu( wxContextMenuEvent& event ); | |
178 | ||
179 | void OnEnableDisable( wxCommandEvent& event ); | |
180 | void OnHideShow( wxCommandEvent& event ); | |
181 | void OnClearModifyStatusClick( wxCommandEvent& event ); | |
182 | void OnFreezeClick( wxCommandEvent& event ); | |
183 | void OnDumpList( wxCommandEvent& event ); | |
184 | void OnCatColours( wxCommandEvent& event ); | |
185 | void OnSetColumns( wxCommandEvent& event ); | |
186 | void OnMisc( wxCommandEvent& event ); | |
187 | void OnPopulateClick( wxCommandEvent& event ); | |
188 | void OnSetSpinCtrlEditorClick( wxCommandEvent& event ); | |
189 | void OnTestReplaceClick( wxCommandEvent& event ); | |
190 | void OnTestXRC( wxCommandEvent& event ); | |
191 | void OnEnableCommonValues( wxCommandEvent& event ); | |
192 | void OnSelectStyle( wxCommandEvent& event ); | |
193 | ||
194 | void OnFitColumnsClick( wxCommandEvent& event ); | |
195 | ||
196 | void OnChangeFlagsPropItemsClick( wxCommandEvent& event ); | |
197 | ||
198 | void OnSaveToFileClick( wxCommandEvent& event ); | |
199 | void OnLoadFromFileClick( wxCommandEvent& event ); | |
200 | ||
201 | void OnSetPropertyValue( wxCommandEvent& event ); | |
202 | void OnInsertChoice( wxCommandEvent& event ); | |
203 | void OnDeleteChoice( wxCommandEvent& event ); | |
204 | void OnInsertPage( wxCommandEvent& event ); | |
205 | void OnRemovePage( wxCommandEvent& event ); | |
206 | ||
207 | void OnSaveState( wxCommandEvent& event ); | |
208 | void OnRestoreState( wxCommandEvent& event ); | |
209 | ||
210 | void OnRunMinimalClick( wxCommandEvent& event ); | |
211 | ||
212 | void OnIterate1Click( wxCommandEvent& event ); | |
213 | void OnIterate2Click( wxCommandEvent& event ); | |
214 | void OnIterate3Click( wxCommandEvent& event ); | |
215 | void OnIterate4Click( wxCommandEvent& event ); | |
216 | ||
217 | void OnPropertyGridChange( wxPropertyGridEvent& event ); | |
218 | void OnPropertyGridChanging( wxPropertyGridEvent& event ); | |
219 | void OnPropertyGridSelect( wxPropertyGridEvent& event ); | |
220 | void OnPropertyGridHighlight( wxPropertyGridEvent& event ); | |
221 | void OnPropertyGridItemRightClick( wxPropertyGridEvent& event ); | |
222 | void OnPropertyGridItemDoubleClick( wxPropertyGridEvent& event ); | |
223 | void OnPropertyGridPageChange( wxPropertyGridEvent& event ); | |
224 | void OnPropertyGridButtonClick( wxCommandEvent& event ); | |
225 | void OnPropertyGridTextUpdate( wxCommandEvent& event ); | |
226 | void OnPropertyGridKeyEvent( wxKeyEvent& event ); | |
227 | void OnPropertyGridItemCollapse( wxPropertyGridEvent& event ); | |
228 | void OnPropertyGridItemExpand( wxPropertyGridEvent& event ); | |
229 | ||
230 | void OnAbout( wxCommandEvent& event ); | |
231 | ||
232 | void OnMove( wxMoveEvent& event ); | |
233 | void OnResize( wxSizeEvent& event ); | |
234 | void OnPaint( wxPaintEvent& event ); | |
235 | void OnCloseEvent( wxCloseEvent& event ); | |
236 | ||
237 | void OnIdle( wxIdleEvent& event ); | |
238 | ||
239 | void AddTestProperties( wxPropertyGridPage* pg ); | |
240 | ||
241 | bool RunTests( bool fullTest, bool interactive = false ); | |
242 | ||
243 | private: | |
244 | DECLARE_EVENT_TABLE() | |
245 | }; | |
246 | ||
247 | // ----------------------------------------------------------------------- | |
248 | ||
249 | class cxApplication : public wxApp | |
250 | { | |
251 | public: | |
252 | ||
253 | virtual bool OnInit(); | |
254 | ||
255 | private: | |
256 | FormMain *Form1; | |
257 | }; | |
258 | ||
259 | DECLARE_APP(cxApplication) | |
260 | ||
261 | // ----------------------------------------------------------------------- | |
262 | ||
263 | #endif // _WX_SAMPLES_PROPGRID_PROPGRID_H_ |