]>
Commit | Line | Data |
---|---|---|
1c4293cb VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: propgrid.h | |
3 | // Purpose: topic overview | |
4 | // Author: wxWidgets team | |
de003797 | 5 | // RCS-ID: $Id$ |
1c4293cb VZ |
6 | // Licence: wxWindows license |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | ||
11 | @page overview_propgrid wxPropertyGrid Overview | |
12 | ||
13 | Key Classes: | |
14 | @li wxPGProperty | |
15 | @li wxPropertyGrid | |
16 | @li wxPropertyGridEvent | |
17 | @li wxPropertyGridManager | |
18 | @li wxPropertyGridPage | |
19 | ||
bba3f9b5 JS |
20 | wxPropertyGrid is a specialized grid for editing properties - in other |
21 | words name = value pairs. List of ready-to-use property classes include | |
22 | strings, numbers, flag sets, fonts, colours and many others. It is possible, | |
23 | for example, to categorize properties, set up a complete tree-hierarchy, | |
24 | add more than two columns, and set arbitrary per-property attributes. | |
1c4293cb | 25 | |
8622887c JS |
26 | As this version of wxPropertyGrid has some backward-incompatible changes |
27 | from version 1.4, everybody who need to maintain custom property classes | |
28 | should carefully read final section in @ref propgrid_compat. | |
29 | ||
216214f8 JS |
30 | @li @ref propgrid_basics |
31 | @li @ref propgrid_categories | |
32 | @li @ref propgrid_parentprops | |
33 | @li @ref propgrid_enumandflags | |
34 | @li @ref propgrid_advprops | |
bba3f9b5 | 35 | @li @ref propgrid_processingvalues |
216214f8 | 36 | @li @ref propgrid_iterating |
216214f8 | 37 | @li @ref propgrid_events |
534090e3 | 38 | @li @ref propgrid_tooltipandhint |
216214f8 JS |
39 | @li @ref propgrid_validating |
40 | @li @ref propgrid_populating | |
41 | @li @ref propgrid_cellrender | |
42 | @li @ref propgrid_customizing | |
43 | @li @ref propgrid_usage2 | |
44 | @li @ref propgrid_subclassing | |
45 | @li @ref propgrid_misc | |
46 | @li @ref propgrid_proplist | |
8622887c | 47 | @li @ref propgrid_compat |
216214f8 JS |
48 | |
49 | @section propgrid_basics Creating and Populating wxPropertyGrid | |
1c4293cb VZ |
50 | |
51 | As seen here, wxPropertyGrid is constructed in the same way as | |
52 | other wxWidgets controls: | |
53 | ||
54 | @code | |
55 | ||
56 | // Necessary header file | |
57 | #include <wx/propgrid/propgrid.h> | |
58 | ||
59 | ... | |
60 | ||
61 | // Assumes code is in frame/dialog constructor | |
62 | ||
63 | // Construct wxPropertyGrid control | |
64 | wxPropertyGrid* pg = new wxPropertyGrid( | |
65 | this, // parent | |
66 | PGID, // id | |
67 | wxDefaultPosition, // position | |
68 | wxDefaultSize, // size | |
69 | // Here are just some of the supported window styles | |
70 | wxPG_AUTO_SORT | // Automatic sorting after items added | |
71 | wxPG_SPLITTER_AUTO_CENTER | // Automatically center splitter until user manually adjusts it | |
72 | // Default style | |
73 | wxPG_DEFAULT_STYLE ); | |
74 | ||
75 | // Window style flags are at premium, so some less often needed ones are | |
76 | // available as extra window styles (wxPG_EX_xxx) which must be set using | |
77 | // SetExtraStyle member function. wxPG_EX_HELP_AS_TOOLTIPS, for instance, | |
bba3f9b5 | 78 | // allows displaying help strings as tool tips. |
1c4293cb VZ |
79 | pg->SetExtraStyle( wxPG_EX_HELP_AS_TOOLTIPS ); |
80 | ||
81 | @endcode | |
82 | ||
b55018ec | 83 | (for complete list of new window styles, see @ref propgrid_window_styles) |
1c4293cb VZ |
84 | |
85 | wxPropertyGrid is usually populated with lines like this: | |
86 | ||
87 | @code | |
d6ae8b5b | 88 | pg->Append( new wxStringProperty("Label", "Name", "Initial Value") ); |
1c4293cb VZ |
89 | @endcode |
90 | ||
91 | Naturally, wxStringProperty is a property class. Only the first function argument (label) | |
92 | is mandatory. Second one, name, defaults to label and, third, the initial value, to | |
93 | default value. If constant wxPG_LABEL is used as the name argument, then the label is | |
d665918b JS |
94 | automatically used as a name as well (this is more efficient than manually defining both |
95 | as the same). Use of empty name is discouraged and will sometimes result in run-time error. | |
96 | Note that all property class constructors have quite similar constructor argument list. | |
1c4293cb VZ |
97 | |
98 | To demonstrate other common property classes, here's another code snippet: | |
99 | ||
100 | @code | |
101 | ||
102 | // Add int property | |
d6ae8b5b | 103 | pg->Append( new wxIntProperty("IntProperty", wxPG_LABEL, 12345678) ); |
1c4293cb VZ |
104 | |
105 | // Add float property (value type is actually double) | |
d6ae8b5b | 106 | pg->Append( new wxFloatProperty("FloatProperty", wxPG_LABEL, 12345.678) ); |
1c4293cb VZ |
107 | |
108 | // Add a bool property | |
d6ae8b5b | 109 | pg->Append( new wxBoolProperty("BoolProperty", wxPG_LABEL, false) ); |
1c4293cb VZ |
110 | |
111 | // A string property that can be edited in a separate editor dialog. | |
d6ae8b5b | 112 | pg->Append( new wxLongStringProperty("LongStringProperty", |
1c4293cb | 113 | wxPG_LABEL, |
d6ae8b5b JS |
114 | "This is much longer string than the " |
115 | "first one. Edit it by clicking the button.")); | |
1c4293cb VZ |
116 | |
117 | // String editor with dir selector button. | |
d6ae8b5b | 118 | pg->Append( new wxDirProperty("DirProperty", wxPG_LABEL, ::wxGetUserHome()) ); |
1c4293cb VZ |
119 | |
120 | // wxArrayStringProperty embeds a wxArrayString. | |
d6ae8b5b JS |
121 | pg->Append( new wxArrayStringProperty("Label of ArrayStringProperty", |
122 | "NameOfArrayStringProp")); | |
1c4293cb VZ |
123 | |
124 | // A file selector property. | |
d6ae8b5b | 125 | pg->Append( new wxFileProperty("FileProperty", wxPG_LABEL, wxEmptyString) ); |
1c4293cb | 126 | |
bba3f9b5 | 127 | // Extra: set wild card for file property (format same as in wxFileDialog). |
d6ae8b5b | 128 | pg->SetPropertyAttribute( "FileProperty", |
1c4293cb | 129 | wxPG_FILE_WILDCARD, |
d6ae8b5b | 130 | "All files (*.*)|*.*" ); |
1c4293cb VZ |
131 | |
132 | @endcode | |
133 | ||
bba3f9b5 JS |
134 | Operations on properties are usually done by directly calling wxPGProperty's |
135 | or wxPropertyGridInterface's member functions. wxPropertyGridInterface is an | |
136 | abstract base class for property containers such as wxPropertyGrid, | |
137 | wxPropertyGridManager, and wxPropertyGridPage. Note however that wxPGProperty's | |
138 | member functions generally do not refresh the grid. | |
1c4293cb | 139 | |
bba3f9b5 JS |
140 | wxPropertyGridInterface's property operation member functions , such as |
141 | SetPropertyValue() and DisableProperty(), all accept a special wxPGPropArg id | |
142 | argument, using which you can refer to properties either by their pointer | |
143 | (for performance) or by their name (for convenience). For instance: | |
1c4293cb VZ |
144 | |
145 | @code | |
bba3f9b5 | 146 | // Add a file selector property. |
d6ae8b5b | 147 | wxPGPropety* prop = pg->Append( new wxFileProperty("FileProperty", |
bba3f9b5 JS |
148 | wxPG_LABEL, |
149 | wxEmptyString) ); | |
1c4293cb | 150 | |
bba3f9b5 | 151 | // Valid: Set wild card by name |
d6ae8b5b | 152 | pg->SetPropertyAttribute( "FileProperty", |
1c4293cb | 153 | wxPG_FILE_WILDCARD, |
d6ae8b5b | 154 | "All files (*.*)|*.*" ); |
1c4293cb | 155 | |
bba3f9b5 JS |
156 | // Also Valid: Set wild card by property pointer |
157 | pg->SetPropertyAttribute( prop, | |
1c4293cb | 158 | wxPG_FILE_WILDCARD, |
d6ae8b5b | 159 | "All files (*.*)|*.*" ); |
1c4293cb VZ |
160 | @endcode |
161 | ||
bba3f9b5 JS |
162 | Using pointer is faster, since it doesn't require hash map lookup. Anyway, |
163 | you can always get property pointer (wxPGProperty*) as return value from Append() | |
164 | or Insert(), or by calling wxPropertyGridInterface::GetPropertyByName() or | |
165 | just plain GetProperty(). | |
1c4293cb | 166 | |
216214f8 | 167 | @section propgrid_categories Categories |
1c4293cb | 168 | |
bba3f9b5 | 169 | wxPropertyGrid has a hierarchic property storage and display model, which |
1c4293cb VZ |
170 | allows property categories to hold child properties and even other |
171 | categories. Other than that, from the programmer's point of view, categories | |
172 | can be treated exactly the same as "other" properties. For example, despite | |
bba3f9b5 JS |
173 | its name, GetPropertyByName() also returns a category by name. Note however |
174 | that sometimes the label of a property category may be referred as caption | |
175 | (for example, there is wxPropertyGrid::SetCaptionTextColour() method | |
176 | that sets text colour of property category labels). | |
1c4293cb VZ |
177 | |
178 | When category is added at the top (i.e. root) level of the hierarchy, | |
179 | it becomes a *current category*. This means that all other (non-category) | |
bba3f9b5 JS |
180 | properties after it are automatically appended to it. You may add |
181 | properties to specific categories by using wxPropertyGridInterface::Insert | |
182 | or wxPropertyGridInterface::AppendIn. | |
1c4293cb VZ |
183 | |
184 | Category code sample: | |
185 | ||
186 | @code | |
187 | ||
188 | // One way to add category (similar to how other properties are added) | |
d6ae8b5b | 189 | pg->Append( new wxPropertyCategory("Main") ); |
1c4293cb VZ |
190 | |
191 | // All these are added to "Main" category | |
d6ae8b5b JS |
192 | pg->Append( new wxStringProperty("Name") ); |
193 | pg->Append( new wxIntProperty("Age",wxPG_LABEL,25) ); | |
194 | pg->Append( new wxIntProperty("Height",wxPG_LABEL,180) ); | |
195 | pg->Append( new wxIntProperty("Weight") ); | |
1c4293cb VZ |
196 | |
197 | // Another one | |
d6ae8b5b | 198 | pg->Append( new wxPropertyCategory("Attributes") ); |
1c4293cb VZ |
199 | |
200 | // All these are added to "Attributes" category | |
d6ae8b5b JS |
201 | pg->Append( new wxIntProperty("Intelligence") ); |
202 | pg->Append( new wxIntProperty("Agility") ); | |
203 | pg->Append( new wxIntProperty("Strength") ); | |
1c4293cb VZ |
204 | |
205 | @endcode | |
206 | ||
207 | ||
216214f8 | 208 | @section propgrid_parentprops Tree-like Property Structure |
1c4293cb | 209 | |
bba3f9b5 | 210 | Basically any property can have children. There are few limitations, however. |
1c4293cb VZ |
211 | |
212 | @remarks | |
bba3f9b5 JS |
213 | - Names of properties with non-category, non-root parents are not stored in global |
214 | hash map. Instead, they can be accessed with strings like "Parent.Child". | |
215 | For instance, in the sample below, child property named "Max. Speed (mph)" | |
216 | can be accessed by global name "Car.Speeds.Max Speed (mph)". | |
217 | - If you want to property's value to be a string composed of the child property values, | |
218 | you must use wxStringProperty as parent and use magic string "<composed>" as its | |
219 | value. | |
1c4293cb VZ |
220 | - Events (eg. change of value) that occur in parent do not propagate to children. Events |
221 | that occur in children will propagate to parents, but only if they are wxStringProperties | |
222 | with "<composed>" value. | |
1c4293cb VZ |
223 | |
224 | Sample: | |
225 | ||
226 | @code | |
d6ae8b5b | 227 | wxPGProperty* carProp = pg->Append(new wxStringProperty("Car", |
bba3f9b5 | 228 | wxPG_LABEL, |
d6ae8b5b | 229 | "<composed>")); |
bba3f9b5 | 230 | |
d6ae8b5b | 231 | pg->AppendIn(carProp, new wxStringProperty("Model", |
bba3f9b5 | 232 | wxPG_LABEL, |
d6ae8b5b | 233 | "Lamborghini Diablo SV")); |
1c4293cb | 234 | |
d6ae8b5b | 235 | pg->AppendIn(carProp, new wxIntProperty("Engine Size (cc)", |
1c4293cb | 236 | wxPG_LABEL, |
bba3f9b5 | 237 | 5707) ); |
1c4293cb | 238 | |
bba3f9b5 | 239 | wxPGProperty* speedsProp = pg->AppendIn(carProp, |
d6ae8b5b | 240 | new wxStringProperty("Speeds", |
bba3f9b5 | 241 | wxPG_LABEL, |
d6ae8b5b | 242 | "<composed>")); |
1c4293cb | 243 | |
d6ae8b5b | 244 | pg->AppendIn( speedsProp, new wxIntProperty("Max. Speed (mph)", |
bba3f9b5 | 245 | wxPG_LABEL,290) ); |
d6ae8b5b | 246 | pg->AppendIn( speedsProp, new wxFloatProperty("0-100 mph (sec)", |
bba3f9b5 | 247 | wxPG_LABEL,3.9) ); |
d6ae8b5b | 248 | pg->AppendIn( speedsProp, new wxFloatProperty("1/4 mile (sec)", |
bba3f9b5 | 249 | wxPG_LABEL,8.6) ); |
1c4293cb | 250 | |
bba3f9b5 | 251 | // This is how child property can be referred to by name |
d6ae8b5b | 252 | pg->SetPropertyValue( "Car.Speeds.Max. Speed (mph)", 300 ); |
1c4293cb | 253 | |
d6ae8b5b | 254 | pg->AppendIn(carProp, new wxIntProperty("Price ($)", |
bba3f9b5 JS |
255 | wxPG_LABEL, |
256 | 300000) ); | |
257 | ||
258 | // Displayed value of "Car" property is now very close to this: | |
259 | // "Lamborghini Diablo SV; 5707 [300; 3.9; 8.6] 300000" | |
1c4293cb VZ |
260 | |
261 | @endcode | |
262 | ||
216214f8 | 263 | @section propgrid_enumandflags wxEnumProperty and wxFlagsProperty |
1c4293cb VZ |
264 | |
265 | wxEnumProperty is used when you want property's (integer or string) value | |
266 | to be selected from a popup list of choices. | |
267 | ||
bba3f9b5 JS |
268 | Creating wxEnumProperty is slightly more complex than those described |
269 | earlier. You have to provide list of constant labels, and optionally relevant | |
270 | values (if label indexes are not sufficient). | |
1c4293cb VZ |
271 | |
272 | @remarks | |
273 | ||
939d9364 JS |
274 | - Value wxPG_INVALID_VALUE (equals INT_MAX) is not allowed as list |
275 | item value. | |
1c4293cb VZ |
276 | |
277 | A very simple example: | |
278 | ||
279 | @code | |
280 | ||
281 | // | |
282 | // Using wxArrayString | |
283 | // | |
284 | wxArrayString arrDiet; | |
d6ae8b5b JS |
285 | arr.Add("Herbivore"); |
286 | arr.Add("Carnivore"); | |
287 | arr.Add("Omnivore"); | |
1c4293cb | 288 | |
d6ae8b5b | 289 | pg->Append( new wxEnumProperty("Diet", |
1c4293cb VZ |
290 | wxPG_LABEL, |
291 | arrDiet) ); | |
292 | ||
1c4293cb VZ |
293 | // |
294 | // Using wxChar* array | |
295 | // | |
296 | const wxChar* arrayDiet[] = | |
297 | { wxT("Herbivore"), wxT("Carnivore"), wxT("Omnivore"), NULL }; | |
298 | ||
d6ae8b5b | 299 | pg->Append( new wxEnumProperty("Diet", |
1c4293cb VZ |
300 | wxPG_LABEL, |
301 | arrayDiet) ); | |
302 | ||
1c4293cb VZ |
303 | @endcode |
304 | ||
305 | Here's extended example using values as well: | |
306 | ||
307 | @code | |
308 | ||
309 | // | |
310 | // Using wxArrayString and wxArrayInt | |
311 | // | |
312 | wxArrayString arrDiet; | |
d6ae8b5b JS |
313 | arr.Add("Herbivore"); |
314 | arr.Add("Carnivore"); | |
315 | arr.Add("Omnivore"); | |
1c4293cb VZ |
316 | |
317 | wxArrayInt arrIds; | |
318 | arrIds.Add(40); | |
319 | arrIds.Add(45); | |
320 | arrIds.Add(50); | |
321 | ||
322 | // Note that the initial value (the last argument) is the actual value, | |
323 | // not index or anything like that. Thus, our value selects "Omnivore". | |
d6ae8b5b | 324 | pg->Append( new wxEnumProperty("Diet", |
1c4293cb VZ |
325 | wxPG_LABEL, |
326 | arrDiet, | |
327 | arrIds, | |
328 | 50)); | |
329 | ||
1c4293cb VZ |
330 | @endcode |
331 | ||
332 | wxPGChoices is a class where wxEnumProperty, and other properties which | |
bba3f9b5 JS |
333 | require storage for list of items, actually stores strings and values. It is |
334 | used to facilitate reference counting, and therefore recommended way of | |
1c4293cb VZ |
335 | adding items when multiple properties share the same set. |
336 | ||
337 | You can use wxPGChoices directly as well, filling it and then passing it | |
bba3f9b5 | 338 | to the constructor. In fact, if you wish to display bitmaps next to labels, |
1c4293cb VZ |
339 | your best choice is to use this approach. |
340 | ||
341 | @code | |
342 | ||
343 | wxPGChoices chs; | |
d6ae8b5b JS |
344 | chs.Add("Herbivore", 40); |
345 | chs.Add("Carnivore", 45); | |
346 | chs.Add("Omnivore", 50); | |
1c4293cb VZ |
347 | |
348 | // Let's add an item with bitmap, too | |
d6ae8b5b | 349 | chs.Add("None of the above", wxBitmap(), 60); |
1c4293cb | 350 | |
d6ae8b5b | 351 | pg->Append( new wxEnumProperty("Primary Diet", |
1c4293cb VZ |
352 | wxPG_LABEL, |
353 | chs) ); | |
354 | ||
355 | // Add same choices to another property as well - this is efficient due | |
356 | // to reference counting | |
d6ae8b5b | 357 | pg->Append( new wxEnumProperty("Secondary Diet", |
1c4293cb VZ |
358 | wxPG_LABEL, |
359 | chs) ); | |
1c4293cb VZ |
360 | @endcode |
361 | ||
d5774494 JS |
362 | You can later change choices of property by using wxPGProperty::AddChoice(), |
363 | wxPGProperty::InsertChoice(), wxPGProperty::DeleteChoice(), and | |
364 | wxPGProperty::SetChoices(). | |
1c4293cb | 365 | |
bba3f9b5 JS |
366 | <b>wxEditEnumProperty</b> works exactly like wxEnumProperty, except |
367 | is uses non-read-only combo box as default editor, and value is stored as | |
1c4293cb VZ |
368 | string when it is not any of the choices. |
369 | ||
939d9364 | 370 | wxFlagsProperty has similar construction: |
1c4293cb VZ |
371 | |
372 | @code | |
373 | ||
374 | const wxChar* flags_prop_labels[] = { wxT("wxICONIZE"), | |
375 | wxT("wxCAPTION"), wxT("wxMINIMIZE_BOX"), wxT("wxMAXIMIZE_BOX"), NULL }; | |
376 | ||
377 | // this value array would be optional if values matched string indexes | |
378 | long flags_prop_values[] = { wxICONIZE, wxCAPTION, wxMINIMIZE_BOX, | |
379 | wxMAXIMIZE_BOX }; | |
380 | ||
d6ae8b5b | 381 | pg->Append( new wxFlagsProperty("Window Style", |
1c4293cb VZ |
382 | wxPG_LABEL, |
383 | flags_prop_labels, | |
384 | flags_prop_values, | |
385 | wxDEFAULT_FRAME_STYLE) ); | |
386 | ||
387 | @endcode | |
388 | ||
389 | wxFlagsProperty can use wxPGChoices just the same way as wxEnumProperty | |
bba3f9b5 | 390 | <b>Note:</b> When changing "choices" (ie. flag labels) of wxFlagsProperty, |
939d9364 | 391 | you will need to use wxPGProperty::SetChoices() to replace all choices |
bba3f9b5 | 392 | at once - otherwise implicit child properties will not get updated properly. |
1c4293cb | 393 | |
216214f8 | 394 | @section propgrid_advprops Specialized Properties |
1c4293cb VZ |
395 | |
396 | This section describes the use of less often needed property classes. | |
397 | To use them, you have to include <wx/propgrid/advprops.h>. | |
398 | ||
399 | @code | |
400 | ||
401 | // Necessary extra header file | |
402 | #include <wx/propgrid/advprops.h> | |
403 | ||
404 | ... | |
405 | ||
406 | // Date property. | |
d6ae8b5b | 407 | pg->Append( new wxDateProperty("MyDateProperty", |
1c4293cb VZ |
408 | wxPG_LABEL, |
409 | wxDateTime::Now()) ); | |
410 | ||
bba3f9b5 | 411 | // Image file property. Wild card is auto-generated from available |
1c4293cb | 412 | // image handlers, so it is not set this time. |
d6ae8b5b JS |
413 | pg->Append( new wxImageFileProperty("Label of ImageFileProperty", |
414 | "NameOfImageFileProp") ); | |
1c4293cb VZ |
415 | |
416 | // Font property has sub-properties. Note that we give window's font as | |
417 | // initial value. | |
d6ae8b5b | 418 | pg->Append( new wxFontProperty("Font", |
1c4293cb VZ |
419 | wxPG_LABEL, |
420 | GetFont()) ); | |
421 | ||
422 | // Colour property with arbitrary colour. | |
d6ae8b5b | 423 | pg->Append( new wxColourProperty("My Colour 1", |
1c4293cb VZ |
424 | wxPG_LABEL, |
425 | wxColour(242,109,0) ) ); | |
426 | ||
427 | // System colour property. | |
d6ae8b5b | 428 | pg->Append( new wxSystemColourProperty("My SysColour 1", |
1c4293cb VZ |
429 | wxPG_LABEL, |
430 | wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)) ); | |
431 | ||
432 | // System colour property with custom colour. | |
d6ae8b5b | 433 | pg->Append( new wxSystemColourProperty("My SysColour 2", |
1c4293cb VZ |
434 | wxPG_LABEL, |
435 | wxColour(0,200,160) ) ); | |
436 | ||
437 | // Cursor property | |
d6ae8b5b | 438 | pg->Append( new wxCursorProperty("My Cursor", |
1c4293cb VZ |
439 | wxPG_LABEL, |
440 | wxCURSOR_ARROW)); | |
441 | ||
442 | @endcode | |
443 | ||
444 | ||
bba3f9b5 JS |
445 | @section propgrid_processingvalues Processing Property Values |
446 | ||
447 | Properties store their values internally in wxVariant. You can obtain | |
448 | this value using wxPGProperty::GetValue() or wxPropertyGridInterface:: | |
449 | GetPropertyValue(). | |
450 | ||
451 | If you wish to obtain property value in specific data type, you can | |
452 | call various getter functions, such as wxPropertyGridInterface:: | |
453 | GetPropertyValueAsString(), which, as name might say, returns property | |
454 | value's string representation. While this particular function is very | |
455 | safe to use for any kind of property, some might display error message | |
456 | if property value is not in compatible enough format. For instance, | |
457 | wxPropertyGridInterface::GetPropertyValueAsLongLong() will support | |
458 | long as well as wxLongLong, but GetPropertyValueAsArrayString() only | |
459 | supports wxArrayString and nothing else. | |
460 | ||
461 | In any case, you will need to take extra care when dealing with | |
462 | raw wxVariant values. For instance, wxIntProperty and wxUIntProperty, | |
463 | store value internally as wx(U)LongLong when number doesn't fit into | |
a6162a3e JS |
464 | standard long type. Using << operator to get wx(U)LongLong from wxVariant |
465 | is customized to work quite safely with various types of variant data. | |
bba3f9b5 JS |
466 | |
467 | You may have noticed that properties store, in wxVariant, values of many | |
468 | types which are not natively supported by it. Custom wxVariantDatas | |
469 | are therefore implemented and << and >> operators implemented to | |
470 | convert data from and to wxVariant. | |
471 | ||
472 | Note that in some cases property value can be Null variant, which means | |
473 | that property value is unspecified. This usually occurs only when | |
474 | wxPG_EX_AUTO_UNSPECIFIED_VALUES extra window style is defined or when you | |
475 | manually set property value to Null (or unspecified). | |
476 | ||
477 | ||
216214f8 | 478 | @section propgrid_iterating Iterating through a property container |
1c4293cb VZ |
479 | |
480 | You can use somewhat STL'ish iterator classes to iterate through the grid. | |
481 | Here is a simple example of forward iterating through all individual | |
bba3f9b5 JS |
482 | properties (not categories nor private child properties that are normally |
483 | 'transparent' to application code): | |
1c4293cb VZ |
484 | |
485 | @code | |
486 | ||
487 | wxPropertyGridIterator it; | |
488 | ||
489 | for ( it = pg->GetIterator(); | |
490 | !it.AtEnd(); | |
491 | it++ ) | |
492 | { | |
493 | wxPGProperty* p = *it; | |
494 | // Do something with the property | |
495 | } | |
496 | ||
497 | @endcode | |
498 | ||
499 | As expected there is also a const iterator: | |
500 | ||
501 | @code | |
502 | ||
503 | wxPropertyGridConstIterator it; | |
504 | ||
505 | for ( it = pg->GetIterator(); | |
506 | !it.AtEnd(); | |
507 | it++ ) | |
508 | { | |
509 | const wxPGProperty* p = *it; | |
510 | // Do something with the property | |
511 | } | |
512 | ||
513 | @endcode | |
514 | ||
515 | You can give some arguments to GetIterator to determine which properties | |
516 | get automatically filtered out. For complete list of options, see | |
b55018ec JS |
517 | @ref propgrid_iterator_flags. GetIterator() also accepts other arguments. |
518 | See wxPropertyGridInterface::GetIterator() for details. | |
1c4293cb VZ |
519 | |
520 | This example reverse-iterates through all visible items: | |
521 | ||
522 | @code | |
523 | ||
524 | wxPropertyGridIterator it; | |
525 | ||
526 | for ( it = pg->GetIterator(wxPG_ITERATE_VISIBLE, wxBOTTOM); | |
527 | !it.AtEnd(); | |
528 | it-- ) | |
529 | { | |
530 | wxPGProperty* p = *it; | |
531 | // Do something with the property | |
532 | } | |
533 | ||
534 | @endcode | |
535 | ||
536 | <b>wxPython Note:</b> Instead of ++ operator, use Next() method, and instead of | |
537 | * operator, use GetProperty() method. | |
538 | ||
539 | GetIterator() only works with wxPropertyGrid and the individual pages | |
540 | of wxPropertyGridManager. In order to iterate through an arbitrary | |
bba3f9b5 JS |
541 | property container (such as entire wxPropertyGridManager), you need to use |
542 | wxPropertyGridInterface::GetVIterator(). Note however that this virtual | |
543 | iterator is limited to forward iteration. | |
1c4293cb VZ |
544 | |
545 | @code | |
546 | ||
547 | wxPGVIterator it; | |
548 | ||
549 | for ( it = manager->GetVIterator(); | |
550 | !it.AtEnd(); | |
551 | it.Next() ) | |
552 | { | |
553 | wxPGProperty* p = it.GetProperty(); | |
554 | // Do something with the property | |
555 | } | |
556 | ||
557 | @endcode | |
558 | ||
216214f8 | 559 | @section propgrid_populating Populating wxPropertyGrid Automatically |
1c4293cb | 560 | |
216214f8 | 561 | @subsection propgrid_fromvariants Populating from List of wxVariants |
1c4293cb VZ |
562 | |
563 | Example of populating an empty wxPropertyGrid from a values stored | |
564 | in an arbitrary list of wxVariants. | |
565 | ||
566 | @code | |
567 | ||
bba3f9b5 | 568 | // This is a static method that initializes *all* built-in type handlers |
1c4293cb VZ |
569 | // available, including those for wxColour and wxFont. Refers to *all* |
570 | // included properties, so when compiling with static library, this | |
bba3f9b5 | 571 | // method may increase the executable size noticeably. |
1c4293cb VZ |
572 | pg->InitAllTypeHandlers(); |
573 | ||
574 | // Get contents of the grid as a wxVariant list | |
575 | wxVariant all_values = pg->GetPropertyValues(); | |
576 | ||
577 | // Populate the list with values. If a property with appropriate | |
578 | // name is not found, it is created according to the type of variant. | |
579 | pg->SetPropertyValues( my_list_variant ); | |
580 | ||
1c4293cb VZ |
581 | @endcode |
582 | ||
216214f8 | 583 | @subsection propgrid_fromfile Loading Population from a Text-based Storage |
1c4293cb VZ |
584 | |
585 | Class wxPropertyGridPopulator may be helpful when writing code that | |
bba3f9b5 JS |
586 | loads properties from a text-source. In fact, the wxPropertyGrid xrc-handler |
587 | (which may not be currently included in wxWidgets, but probably will be in | |
588 | near future) uses it. | |
1c4293cb | 589 | |
bba3f9b5 | 590 | @subsection editablestate Saving and Restoring User-Editable State |
1c4293cb | 591 | |
bba3f9b5 JS |
592 | You can use wxPropertyGridInterface::SaveEditableState() and |
593 | wxPropertyGridInterface::RestoreEditableState() to save and restore | |
594 | user-editable state (selected property, expanded/collapsed properties, | |
595 | selected page, scrolled position, and splitter positions). | |
1c4293cb | 596 | |
216214f8 | 597 | @section propgrid_events Event Handling |
1c4293cb VZ |
598 | |
599 | Probably the most important event is the Changed event which occurs when | |
600 | value of any property is changed by the user. Use EVT_PG_CHANGED(id,func) | |
601 | in your event table to use it. | |
602 | ||
603 | For complete list of event types, see wxPropertyGrid class reference. | |
604 | ||
bba3f9b5 JS |
605 | However, one type of event that might need focused attention is EVT_PG_CHANGING, |
606 | which occurs just prior property value is being changed by user. You can | |
607 | acquire pending value using wxPropertyGridEvent::GetValue(), and if it is | |
608 | not acceptable, call wxPropertyGridEvent::Veto() to prevent the value change | |
609 | from taking place. | |
1c4293cb VZ |
610 | |
611 | @code | |
612 | ||
1c4293cb VZ |
613 | void MyForm::OnPropertyGridChanging( wxPropertyGridEvent& event ) |
614 | { | |
615 | wxPGProperty* property = event.GetProperty(); | |
616 | ||
617 | if ( property == m_pWatchThisProperty ) | |
618 | { | |
619 | // GetValue() returns the pending value, but is only | |
620 | // supported by wxEVT_PG_CHANGING. | |
621 | if ( event.GetValue().GetString() == g_pThisTextIsNotAllowed ) | |
622 | { | |
623 | event.Veto(); | |
624 | return; | |
625 | } | |
626 | } | |
627 | } | |
628 | ||
629 | @endcode | |
630 | ||
bba3f9b5 JS |
631 | @remarks On Child Property Event Handling |
632 | - For properties which have private, implicit children (wxFontProperty and | |
633 | wxFlagsProperty), events occur for the main parent property only. | |
634 | For other properties events occur for the children themselves. See | |
635 | @ref propgrid_parentprops. | |
1c4293cb | 636 | |
bba3f9b5 | 637 | - When property's child gets changed, you can use wxPropertyGridEvent::GetMainParent() |
1c4293cb VZ |
638 | to obtain its topmost non-category parent (useful, if you have deeply nested |
639 | properties). | |
640 | ||
534090e3 JS |
641 | @section propgrid_tooltipandhint Help String, Hint and Tool Tips |
642 | ||
643 | For each property you can specify two different types of help text. First, | |
644 | you can use wxPropertyGridInterface::SetPropertyHelpString() or | |
645 | wxPGProperty::SetHelpString() to set property's help text. Second, you | |
646 | can use wxPGProperty::SetAttribute() to set property's "Hint" attribute. | |
647 | ||
648 | Difference between hint and help string is that the hint is shown in an empty | |
649 | property value cell, while help string is shown either in the description text | |
650 | box, as a tool tip, or on the status bar, whichever of these is available. | |
651 | ||
652 | To enable display of help string as tool tips, you must explicitly use | |
653 | the wxPG_EX_HELP_AS_TOOLTIPS extra window style. | |
1c4293cb | 654 | |
216214f8 | 655 | @section propgrid_validating Validating Property Values |
1c4293cb VZ |
656 | |
657 | There are various ways to make sure user enters only correct values. First, you | |
658 | can use wxValidators similar to as you would with ordinary controls. Use | |
8622887c | 659 | wxPropertyGridInterface::SetPropertyValidator() to assign wxValidator to |
1c4293cb VZ |
660 | property. |
661 | ||
662 | Second, you can subclass a property and override wxPGProperty::ValidateValue(), | |
bba3f9b5 | 663 | or handle wxEVT_PG_CHANGING for the same effect. Both of these ways do not |
1c4293cb VZ |
664 | actually prevent user from temporarily entering invalid text, but they do give |
665 | you an opportunity to warn the user and block changed value from being committed | |
666 | in a property. | |
667 | ||
668 | Various validation failure options can be controlled globally with | |
669 | wxPropertyGrid::SetValidationFailureBehavior(), or on an event basis by | |
670 | calling wxEvent::SetValidationFailureBehavior(). Here's a code snippet of | |
671 | how to handle wxEVT_PG_CHANGING, and to set custom failure behaviour and | |
672 | message. | |
673 | ||
674 | @code | |
675 | void MyFrame::OnPropertyGridChanging(wxPropertyGridEvent& event) | |
676 | { | |
677 | wxPGProperty* property = event.GetProperty(); | |
678 | ||
679 | // You must use wxPropertyGridEvent::GetValue() to access | |
680 | // the value to be validated. | |
681 | wxVariant pendingValue = event.GetValue(); | |
682 | ||
d6ae8b5b | 683 | if ( property->GetName() == "Font" ) |
1c4293cb VZ |
684 | { |
685 | // Make sure value is not unspecified | |
686 | if ( !pendingValue.IsNull() ) | |
687 | { | |
bba3f9b5 JS |
688 | wxFont font; |
689 | font << pendingValue; | |
1c4293cb VZ |
690 | |
691 | // Let's just allow Arial font | |
d6ae8b5b | 692 | if ( font.GetFaceName() != "Arial" ) |
1c4293cb VZ |
693 | { |
694 | event.Veto(); | |
695 | event.SetValidationFailureBehavior(wxPG_VFB_STAY_IN_PROPERTY | | |
696 | wxPG_VFB_BEEP | | |
697 | wxPG_VFB_SHOW_MESSAGE); | |
698 | } | |
699 | } | |
700 | } | |
701 | } | |
702 | @endcode | |
703 | ||
704 | ||
216214f8 | 705 | @section propgrid_cellrender Customizing Individual Cell Appearance |
1c4293cb VZ |
706 | |
707 | You can control text colour, background colour, and attached image of | |
708 | each cell in the property grid. Use wxPropertyGridInterface::SetPropertyCell() or | |
709 | wxPGProperty::SetCell() for this purpose. | |
710 | ||
711 | In addition, it is possible to control these characteristics for | |
bba3f9b5 | 712 | wxPGChoices list items. See wxPGChoices class reference for more info. |
1c4293cb VZ |
713 | |
714 | ||
216214f8 | 715 | @section propgrid_customizing Customizing Properties (without sub-classing) |
1c4293cb VZ |
716 | |
717 | In this section are presented miscellaneous ways to have custom appearance | |
718 | and behavior for your properties without all the necessary hassle | |
719 | of sub-classing a property class etc. | |
720 | ||
216214f8 | 721 | @subsection propgrid_customimage Setting Value Image |
1c4293cb VZ |
722 | |
723 | Every property can have a small value image placed in front of the | |
724 | actual value text. Built-in example of this can be seen with | |
725 | wxColourProperty and wxImageFileProperty, but for others it can | |
726 | be set using wxPropertyGrid::SetPropertyImage method. | |
727 | ||
216214f8 | 728 | @subsection propgrid_customeditor Setting Property's Editor Control(s) |
1c4293cb VZ |
729 | |
730 | You can set editor control (or controls, in case of a control and button), | |
731 | of any property using wxPropertyGrid::SetPropertyEditor. Editors are passed | |
bba3f9b5 | 732 | as wxPGEditor_EditorName, and valid built-in EditorNames are |
1c4293cb VZ |
733 | TextCtrl, Choice, ComboBox, CheckBox, TextCtrlAndButton, ChoiceAndButton, |
734 | SpinCtrl, and DatePickerCtrl. Two last mentioned ones require call to | |
735 | static member function wxPropertyGrid::RegisterAdditionalEditors(). | |
736 | ||
737 | Following example changes wxColourProperty's editor from default Choice | |
738 | to TextCtrlAndButton. wxColourProperty has its internal event handling set | |
739 | up so that button click events of the button will be used to trigger | |
740 | colour selection dialog. | |
741 | ||
742 | @code | |
743 | ||
d6ae8b5b | 744 | wxPGProperty* colProp = new wxColourProperty("Text Colour"); |
bba3f9b5 JS |
745 | pg->Append(colProp); |
746 | pg->SetPropertyEditor(colProp, wxPGEditor_TextCtrlAndButton); | |
1c4293cb VZ |
747 | |
748 | @endcode | |
749 | ||
750 | Naturally, creating and setting custom editor classes is a possibility as | |
751 | well. For more information, see wxPGEditor class reference. | |
752 | ||
216214f8 | 753 | @subsection propgrid_editorattrs Property Attributes Recognized by Editors |
1c4293cb | 754 | |
bba3f9b5 JS |
755 | <b>SpinCtrl</b> editor can make use of property's "Min", "Max", "Step" and |
756 | "Wrap" attributes. | |
1c4293cb | 757 | |
216214f8 | 758 | @subsection propgrid_multiplebuttons Adding Multiple Buttons Next to an Editor |
1c4293cb VZ |
759 | |
760 | See wxPGMultiButton class reference. | |
761 | ||
216214f8 | 762 | @subsection propgrid_customeventhandling Handling Events Passed from Properties |
1c4293cb VZ |
763 | |
764 | <b>wxEVT_COMMAND_BUTTON_CLICKED </b>(corresponds to event table macro EVT_BUTTON): | |
765 | Occurs when editor button click is not handled by the property itself | |
766 | (as is the case, for example, if you set property's editor to TextCtrlAndButton | |
767 | from the original TextCtrl). | |
768 | ||
216214f8 | 769 | @subsection propgrid_attributes Property Attributes |
1c4293cb VZ |
770 | |
771 | Miscellaneous values, often specific to a property type, can be set | |
bba3f9b5 JS |
772 | using wxPropertyGridInterface::SetPropertyAttribute() and |
773 | wxPropertyGridInterface::SetPropertyAttributeAll() methods. | |
1c4293cb VZ |
774 | |
775 | Attribute names are strings and values wxVariant. Arbitrary names are allowed | |
bba3f9b5 JS |
776 | in order to store values that are relevant to application only and not |
777 | property grid. Constant equivalents of all attribute string names are | |
778 | provided. Some of them are defined as cached strings, so using these constants | |
779 | can provide for smaller binary size. | |
1c4293cb | 780 | |
b55018ec | 781 | For complete list of attributes, see @ref propgrid_property_attributes. |
1c4293cb | 782 | |
1c4293cb | 783 | |
216214f8 | 784 | @section propgrid_usage2 Using wxPropertyGridManager |
1c4293cb VZ |
785 | |
786 | wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid, | |
bba3f9b5 JS |
787 | which can optionally have tool bar for mode and page selection, and a help text |
788 | box. For more information, see wxPropertyGridManager class reference. | |
1c4293cb | 789 | |
216214f8 | 790 | @subsection propgrid_propgridpage wxPropertyGridPage |
1c4293cb VZ |
791 | |
792 | wxPropertyGridPage is holder of properties for one page in manager. It is derived from | |
793 | wxEvtHandler, so you can subclass it to process page-specific property grid events. Hand | |
bba3f9b5 | 794 | over your page instance in wxPropertyGridManager::AddPage(). |
1c4293cb VZ |
795 | |
796 | Please note that the wxPropertyGridPage itself only sports subset of wxPropertyGrid API | |
797 | (but unlike manager, this include item iteration). Naturally it inherits from | |
bba3f9b5 | 798 | wxPropertyGridInterface. |
1c4293cb | 799 | |
bba3f9b5 | 800 | For more information, see wxPropertyGridPage class reference. |
1c4293cb | 801 | |
bba3f9b5 JS |
802 | |
803 | @section propgrid_subclassing Sub-classing wxPropertyGrid and wxPropertyGridManager | |
1c4293cb VZ |
804 | |
805 | Few things to note: | |
806 | ||
807 | - Only a small percentage of member functions are virtual. If you need more, | |
808 | just e-mail to wx-dev mailing list. | |
809 | ||
810 | - Data manipulation is done in wxPropertyGridPageState class. So, instead of | |
bba3f9b5 JS |
811 | overriding wxPropertyGrid::Insert(), you'll probably want to override |
812 | wxPropertyGridPageState::DoInsert(). See header file for details. | |
1c4293cb | 813 | |
bba3f9b5 JS |
814 | - Override wxPropertyGrid::CreateState() to instantiate your derivate |
815 | wxPropertyGridPageState. For wxPropertyGridManager, you'll need to subclass | |
816 | wxPropertyGridPage instead (since it is derived from wxPropertyGridPageState), | |
817 | and hand over instances in wxPropertyGridManager::AddPage() calls. | |
1c4293cb | 818 | |
bba3f9b5 JS |
819 | - You can use a derivate wxPropertyGrid with manager by overriding |
820 | wxPropertyGridManager::CreatePropertyGrid() member function. | |
1c4293cb VZ |
821 | |
822 | ||
216214f8 | 823 | @section propgrid_misc Miscellaneous Topics |
1c4293cb | 824 | |
216214f8 | 825 | @subsection propgrid_namescope Property Name Scope |
1c4293cb | 826 | |
258ccb95 JS |
827 | All properties which parent is category or root can be accessed |
828 | directly by their base name (ie. name given for property in its constructor). | |
829 | Other properties can be accessed via "ParentsName.BaseName" notation, | |
830 | Naturally, all property names should be unique. | |
1c4293cb | 831 | |
216214f8 | 832 | @subsection propgrid_nonuniquelabels Non-unique Labels |
258ccb95 JS |
833 | |
834 | It is possible to have properties with identical label under same parent. | |
835 | However, care must be taken to ensure that each property still has | |
836 | unique (base) name. | |
1c4293cb | 837 | |
216214f8 | 838 | @subsection propgrid_boolproperty wxBoolProperty |
1c4293cb | 839 | |
bba3f9b5 JS |
840 | There are few points about wxBoolProperty that require further discussion: |
841 | - wxBoolProperty can be shown as either normal combo box or as a check box. | |
1c4293cb VZ |
842 | Property attribute wxPG_BOOL_USE_CHECKBOX is used to change this. |
843 | For example, if you have a wxFlagsProperty, you can | |
844 | set its all items to use check box using the following: | |
845 | @code | |
d6ae8b5b | 846 | pg->SetPropertyAttribute("MyFlagsProperty", wxPG_BOOL_USE_CHECKBOX, true, wxPG_RECURSE); |
1c4293cb | 847 | @endcode |
8622887c | 848 | |
bba3f9b5 JS |
849 | Following will set all individual bool properties in your control to |
850 | use check box: | |
8622887c | 851 | |
bba3f9b5 JS |
852 | @code |
853 | pg->SetPropertyAttributeAll(wxPG_BOOL_USE_CHECKBOX, true); | |
854 | @endcode | |
1c4293cb | 855 | |
939d9364 | 856 | - Default item names for wxBoolProperty are ["False", "True"]. This can be |
bba3f9b5 JS |
857 | changed using static function wxPropertyGrid::SetBoolChoices(trueChoice, |
858 | falseChoice). | |
1c4293cb | 859 | |
216214f8 | 860 | @subsection propgrid_textctrlupdates Updates from wxTextCtrl Based Editor |
1c4293cb VZ |
861 | |
862 | Changes from wxTextCtrl based property editors are committed (ie. | |
863 | wxEVT_PG_CHANGED is sent etc.) *only* when (1) user presser enter, (2) | |
864 | user moves to edit another property, or (3) when focus leaves | |
865 | the grid. | |
866 | ||
867 | Because of this, you may find it useful, in some apps, to call | |
868 | wxPropertyGrid::CommitChangesFromEditor() just before you need to do any | |
869 | computations based on property grid values. Note that CommitChangesFromEditor() | |
870 | will dispatch wxEVT_PG_CHANGED with ProcessEvent, so any of your event handlers | |
871 | will be called immediately. | |
872 | ||
216214f8 | 873 | @subsection propgrid_splittercentering Centering the Splitter |
1c4293cb VZ |
874 | |
875 | If you need to center the splitter, but only once when the program starts, | |
876 | then do <b>not</b> use the wxPG_SPLITTER_AUTO_CENTER window style, but the | |
877 | wxPropertyGrid::CenterSplitter() method. <b>However, be sure to call it after | |
878 | the sizer setup and SetSize calls!</b> (ie. usually at the end of the | |
879 | frame/dialog constructor) | |
880 | ||
fe01f16e JS |
881 | Splitter centering behavior can be customized using |
882 | wxPropertyGridInterface::SetColumnProportion(). Usually it is used to set | |
883 | non-equal column proportions, which in essence stops the splitter(s) from | |
884 | being 'centered' as such, and instead just auto-resized. | |
885 | ||
216214f8 | 886 | @subsection propgrid_splittersetting Setting Splitter Position When Creating Property Grid |
1c4293cb VZ |
887 | |
888 | Splitter position cannot exceed grid size, and therefore setting it during | |
889 | form creation may fail as initial grid size is often smaller than desired | |
890 | splitter position, especially when sizers are being used. | |
891 | ||
216214f8 | 892 | @subsection propgrid_colourproperty wxColourProperty and wxSystemColourProperty |
1c4293cb | 893 | |
bba3f9b5 | 894 | Through sub-classing, these two property classes provide substantial customization |
1c4293cb VZ |
895 | features. Subclass wxSystemColourProperty if you want to use wxColourPropertyValue |
896 | (which features colour type in addition to wxColour), and wxColourProperty if plain | |
897 | wxColour is enough. | |
898 | ||
899 | Override wxSystemColourProperty::ColourToString() to redefine how colours are | |
900 | printed as strings. | |
901 | ||
902 | Override wxSystemColourProperty::GetCustomColourIndex() to redefine location of | |
903 | the item that triggers colour picker dialog (default is last). | |
904 | ||
905 | Override wxSystemColourProperty::GetColour() to determine which colour matches | |
906 | which choice entry. | |
907 | ||
216214f8 | 908 | @section propgrid_proplist Property Class Descriptions |
1c4293cb VZ |
909 | |
910 | See @ref pgproperty_properties | |
911 | ||
8622887c JS |
912 | @section propgrid_compat Changes from wxPropertyGrid 1.4 |
913 | ||
914 | Version of wxPropertyGrid bundled with wxWidgets 2.9+ has various backward- | |
915 | incompatible changes from version 1.4, which had a stable API and will remain | |
916 | as the last separate branch. | |
917 | ||
918 | Note that in general any behavior-breaking changes should not compile or run | |
919 | without warnings or errors. | |
920 | ||
921 | @subsection propgrid_compat_general General Changes | |
922 | ||
923 | - Tab-traversal can no longer be used to travel between properties. Now | |
924 | it only causes focus to move from main grid to editor of selected property. | |
925 | Arrow keys are now your primary means of navigating between properties, | |
926 | with keyboard. This change allowed fixing broken tab traversal on wxGTK | |
927 | (which is open issue in wxPropertyGrid 1.4). | |
928 | ||
929 | - A few member functions were removed from wxPropertyGridInterface. | |
930 | Please use wxPGProperty's counterparts from now on. | |
931 | ||
932 | - wxPGChoices now has proper Copy-On-Write behavior. | |
933 | ||
934 | - wxPGChoices::SetExclusive() was renamed to AllocExclusive(). | |
935 | ||
936 | - wxPGProperty::SetPropertyChoicesExclusive() was removed. Instead, use | |
937 | GetChoices().AllocExclusive(). | |
938 | ||
939 | - wxPGProperty::ClearModifiedStatus() is removed. Please use | |
940 | SetModifiedStatus() instead. | |
941 | ||
942 | - wxPropertyGridInterface::GetExpandedProperties() is removed. You should | |
943 | now use wxPropertyGridInterface::GetEditableState() instead. | |
1c4293cb | 944 | |
08c1613f JS |
945 | - wxPG_EX_DISABLE_TLP_TRACKING is now enabled by default. To get the old |
946 | behavior (recommended if you don't use a system that reparents the grid | |
947 | on its own), use the wxPG_EX_ENABLE_TLP_TRACKING extra style. | |
948 | ||
8622887c JS |
949 | - Extended window style wxPG_EX_LEGACY_VALIDATORS was removed. |
950 | ||
951 | - wxPropertyGridManager now has same Get/SetSelection() semantics as | |
952 | wxPropertyGrid. | |
953 | ||
954 | - Various wxPropertyGridManager page-related functions now return pointer | |
955 | to the page object instead of index. | |
956 | ||
957 | - Instead of calling wxPropertyGrid::SetButtonShortcut(), use | |
958 | wxPropertyGrid::SetActionTrigger(wxPG_ACTION_PRESS_BUTTON). | |
959 | ||
960 | - wxPGProperty::GetCell() now returns a reference. AcquireCell() was removed. | |
961 | ||
962 | - wxPGMultiButton::FinalizePosition() has been renamed to Finalize(), | |
963 | and it has slightly different argument list. | |
964 | ||
965 | - wxPropertyGridEvent::HasProperty() is removed. You can use GetProperty() | |
966 | as immediate replacement when checking if event has a property. | |
967 | ||
534090e3 JS |
968 | - "InlineHelp" property has been replaced with "Hint". |
969 | ||
27c14b30 JS |
970 | - wxPropertyGrid::CanClose() has been removed. Call |
971 | wxPropertyGridInterface::EditorValidate() instead. | |
972 | ||
8622887c JS |
973 | @subsection propgrid_compat_propdev Property and Editor Sub-classing Changes |
974 | ||
975 | - Confusing custom property macros have been eliminated. | |
976 | ||
977 | - Implement wxPGProperty::ValueToString() instead of GetValueAsString(). | |
978 | ||
979 | - wxPGProperty::ChildChanged() must now return the modified value of | |
980 | whole property instead of writing it back into 'thisValue' argument. | |
981 | ||
982 | - Removed wxPropertyGrid::PrepareValueForDialogEditing(). Use | |
983 | wxPropertyGrid::GetPendingEditedValue() instead. | |
984 | ||
985 | - wxPGProperty::GetChoiceInfo() is removed, as all properties now carry | |
986 | wxPGChoices instance (protected wxPGProperty::m_choices). | |
987 | ||
988 | - Connect() should no longer be called in implementations of | |
989 | wxPGEditor::CreateControls(). wxPropertyGrid automatically passes all | |
990 | events from editor to wxPGEditor::OnEvent() and wxPGProperty::OnEvent(), | |
991 | as appropriate. | |
0cd4552a JS |
992 | |
993 | - wxPython: Previously some of the reimplemented member functions needed a | |
994 | 'Py' prefix. This is no longer necessary. For instance, if you previously | |
995 | implemented PyStringToValue() for your custom property, you should now | |
996 | just implement StringToValue(). | |
8622887c | 997 | */ |