]> git.saurik.com Git - wxWidgets.git/blame - samples/propgrid/propgrid.h
wxPropertyGrid::DoPropertyChanged() incorrectly passed raw m_wndEditor pointer to...
[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
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
17class wxAdvImageFileProperty : public wxFileProperty
18{
19 WX_PG_DECLARE_PROPERTY_CLASS(wxAdvImageFileProperty)
20public:
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
29 WX_PG_DECLARE_CHOICE_METHODS()
30 WX_PG_DECLARE_EVENT_METHODS()
31 WX_PG_DECLARE_CUSTOM_PAINT_METHODS()
32
33 void LoadThumbnails( size_t n );
34
35protected:
36 wxImage* m_pImage; // Temporary thumbnail data.
37
38 static wxPGChoices ms_choices;
39
40 int m_index; // Index required for choice behaviour.
41};
42
43// -----------------------------------------------------------------------
44
45class wxVector3f
46{
47public:
48 wxVector3f()
49 {
50 x = y = z = 0.0;
51 }
52 wxVector3f( double x, double y, double z )
53 {
54 x = x; y = y; z = z;
55 }
56
57 double x, y, z;
58};
59
60inline bool operator == (const wxVector3f& a, const wxVector3f& b)
61{
62 return (a.x == b.x && a.y == b.y && a.z == b.z);
63}
64
65WX_PG_DECLARE_VARIANT_DATA(wxVector3fVariantData, wxVector3f, wxEMPTY_PARAMETER_VALUE)
66
67class wxVectorProperty : public wxPGProperty
68{
69 WX_PG_DECLARE_PROPERTY_CLASS(wxVectorProperty)
70public:
71
72 wxVectorProperty( const wxString& label = wxPG_LABEL,
73 const wxString& name = wxPG_LABEL,
74 const wxVector3f& value = wxVector3f() );
75 virtual ~wxVectorProperty();
76
77 WX_PG_DECLARE_PARENTAL_METHODS()
78
79protected:
80};
81
82// -----------------------------------------------------------------------
83
84class wxTriangle
85{
86public:
87 wxVector3f a, b, c;
88};
89
90inline bool operator == (const wxTriangle& a, const wxTriangle& b)
91{
92 return (a.a == b.a && a.b == b.b && a.c == b.c);
93}
94
95WX_PG_DECLARE_VARIANT_DATA(wxTriangleVariantData, wxTriangle, wxEMPTY_PARAMETER_VALUE)
96
97class wxTriangleProperty : public wxPGProperty
98{
99 WX_PG_DECLARE_PROPERTY_CLASS(wxTriangleProperty)
100public:
101
102 wxTriangleProperty( const wxString& label = wxPG_LABEL,
103 const wxString& name = wxPG_LABEL,
104 const wxTriangle& value = wxTriangle() );
105 virtual ~wxTriangleProperty();
106
107 WX_PG_DECLARE_PARENTAL_METHODS()
108
109protected:
110};
111
112// -----------------------------------------------------------------------
113
114enum
115{
116 ID_COLOURSCHEME4 = 100
117};
118
119// -----------------------------------------------------------------------
120
121class FormMain : public wxFrame
122{
123public:
124 FormMain(const wxString& title, const wxPoint& pos, const wxSize& size );
125 ~FormMain();
126
127 wxPropertyGridManager* m_pPropGridManager;
128 wxPropertyGrid* m_propGrid;
129
130 wxTextCtrl* m_tcPropLabel;
131 wxWindow* m_panel;
132 wxBoxSizer* m_topSizer;
133
134 wxPGChoices m_combinedFlags;
135
136 wxMenuItem* m_itemCatColours;
137 wxMenuItem* m_itemFreeze;
138 wxMenuItem* m_itemEnable;
139
140 wxVariant m_storedValues;
141
142 wxString m_savedState;
143
144
145 void CreateGrid( int style, int extraStyle );
146
147 // These are used in CreateGrid(), and in tests to compose
148 // grids for testing purposes.
149 void InitPanel();
150 void PopulateGrid();
151 void FinalizePanel( bool wasCreated = true );
152
153 void PopulateWithStandardItems();
154 void PopulateWithExamples();
155 void PopulateWithLibraryConfig();
156
157 void OnCloseClick( wxCommandEvent& event );
158 void OnLabelTextChange( wxCommandEvent& event );
159
160 void OnColourScheme( wxCommandEvent& event );
161
162 void OnInsertPropClick( wxCommandEvent& event );
163 void OnAppendPropClick( wxCommandEvent& event );
164 void OnClearClick( wxCommandEvent& event );
165 void OnAppendCatClick( wxCommandEvent& event );
166 void OnInsertCatClick( wxCommandEvent& event );
167 void OnDelPropClick( wxCommandEvent& event );
168 void OnDelPropRClick( wxCommandEvent& event );
169
170 void OnContextMenu( wxContextMenuEvent& event );
171
172 void OnEnableDisable( wxCommandEvent& event );
173 void OnHideShow( wxCommandEvent& event );
174 void OnClearModifyStatusClick( wxCommandEvent& event );
175 void OnFreezeClick( wxCommandEvent& event );
176 void OnDumpList( wxCommandEvent& event );
177 void OnCatColours( wxCommandEvent& event );
178 void OnSetColumns( wxCommandEvent& event );
179 void OnMisc( wxCommandEvent& event );
180 void OnPopulateClick( wxCommandEvent& event );
181 void OnSetSpinCtrlEditorClick( wxCommandEvent& event );
182 void OnTestReplaceClick( wxCommandEvent& event );
183 void OnTestXRC( wxCommandEvent& event );
184 void OnEnableCommonValues( wxCommandEvent& event );
185 void OnSelectStyle( wxCommandEvent& event );
186
187 void OnFitColumnsClick( wxCommandEvent& event );
188
189 void OnChangeFlagsPropItemsClick( wxCommandEvent& event );
190
191 void OnSaveToFileClick( wxCommandEvent& event );
192 void OnLoadFromFileClick( wxCommandEvent& event );
193
194 void OnSetPropertyValue( wxCommandEvent& event );
195 void OnInsertChoice( wxCommandEvent& event );
196 void OnDeleteChoice( wxCommandEvent& event );
197 void OnInsertPage( wxCommandEvent& event );
198 void OnRemovePage( wxCommandEvent& event );
199
200 void OnSaveState( wxCommandEvent& event );
201 void OnRestoreState( wxCommandEvent& event );
202
203 void OnRunMinimalClick( wxCommandEvent& event );
204
205 void OnIterate1Click( wxCommandEvent& event );
206 void OnIterate2Click( wxCommandEvent& event );
207 void OnIterate3Click( wxCommandEvent& event );
208 void OnIterate4Click( wxCommandEvent& event );
209
210 void OnPropertyGridChange( wxPropertyGridEvent& event );
211 void OnPropertyGridChanging( wxPropertyGridEvent& event );
212 void OnPropertyGridSelect( wxPropertyGridEvent& event );
213 void OnPropertyGridHighlight( wxPropertyGridEvent& event );
214 void OnPropertyGridItemRightClick( wxPropertyGridEvent& event );
215 void OnPropertyGridItemDoubleClick( wxPropertyGridEvent& event );
216 void OnPropertyGridPageChange( wxPropertyGridEvent& event );
217 void OnPropertyGridButtonClick( wxCommandEvent& event );
218 void OnPropertyGridTextUpdate( wxCommandEvent& event );
219 void OnPropertyGridKeyEvent( wxKeyEvent& event );
220 void OnPropertyGridItemCollapse( wxPropertyGridEvent& event );
221 void OnPropertyGridItemExpand( wxPropertyGridEvent& event );
222
223 void OnAbout( wxCommandEvent& event );
224
225 void OnMove( wxMoveEvent& event );
226 void OnResize( wxSizeEvent& event );
227 void OnPaint( wxPaintEvent& event );
228 void OnCloseEvent( wxCloseEvent& event );
229
230 void OnIdle( wxIdleEvent& event );
231
232 void AddTestProperties( wxPropertyGridPage* pg );
233
234 bool RunTests( bool fullTest, bool interactive = false );
235
236private:
237 DECLARE_EVENT_TABLE()
238};
239
240// -----------------------------------------------------------------------
241
242class cxApplication : public wxApp
243{
244public:
245
246 virtual bool OnInit();
247
248private:
249 FormMain *Form1;
250};
251
252DECLARE_APP(cxApplication)
253
254// -----------------------------------------------------------------------
255
256#endif // _WX_SAMPLES_PROPGRID_PROPGRID_H_