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