]>
Commit | Line | Data |
---|---|---|
1c4293cb VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: property.h | |
3 | // Purpose: interface of wxPGProperty | |
4 | // Author: wxWidgets team | |
de003797 | 5 | // RCS-ID: $Id$ |
1c4293cb VZ |
6 | // Licence: wxWindows license |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | // ----------------------------------------------------------------------- | |
10 | ||
effb029c JS |
11 | /** |
12 | @class wxPropertyGridInterface | |
1c4293cb VZ |
13 | |
14 | Most of the shared property manipulation interface shared by wxPropertyGrid, | |
15 | wxPropertyGridPage, and wxPropertyGridManager is defined in this class. | |
16 | ||
17 | @remarks | |
effb029c JS |
18 | - In separate wxPropertyGrid component this class was known as |
19 | wxPropertyContainerMethods. | |
1c4293cb | 20 | |
bba3f9b5 JS |
21 | - wxPropertyGridInterface's property operation member functions all accept |
22 | a special wxPGPropArg id argument, using which you can refer to properties | |
23 | either by their pointer (for performance) or by their name (for conveniency). | |
24 | ||
1c4293cb VZ |
25 | @library{wxpropgrid} |
26 | @category{propgrid} | |
27 | */ | |
28 | class WXDLLIMPEXP_PROPGRID wxPropertyGridInterface | |
29 | { | |
30 | public: | |
31 | ||
32 | /** Destructor */ | |
33 | virtual ~wxPropertyGridInterface() { } | |
34 | ||
effb029c JS |
35 | /** |
36 | Appends property to the list. wxPropertyGrid assumes ownership of the | |
37 | object. Becomes child of most recently added category. | |
38 | ||
1c4293cb VZ |
39 | @remarks |
40 | - wxPropertyGrid takes the ownership of the property pointer. | |
effb029c JS |
41 | - If appending a category with name identical to a category already in |
42 | the wxPropertyGrid, then newly created category is deleted, and most | |
43 | recently added category (under which properties are appended) is set | |
44 | to the one with same name. This allows easier adding of items to same | |
45 | categories in multiple passes. | |
46 | - Does not automatically redraw the control, so you may need to call | |
47 | Refresh() when calling this function after control has been shown for | |
48 | the first time. | |
1621f192 JS |
49 | - This functions deselects selected property, if any. Validation |
50 | failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. | |
51 | selection is cleared even if editor had invalid value. | |
1c4293cb VZ |
52 | */ |
53 | wxPGProperty* Append( wxPGProperty* property ); | |
54 | ||
effb029c JS |
55 | /** |
56 | Same as Append(), but appends under given parent property. | |
57 | ||
58 | @param id | |
59 | Name or pointer to parent property. | |
60 | ||
61 | @param newProperty | |
62 | Property to be added. | |
63 | */ | |
64 | wxPGProperty* AppendIn( wxPGPropArg id, wxPGProperty* newProperty ); | |
65 | ||
66 | /** | |
67 | In order to add new items into a property with private children (for | |
0ad10f30 FM |
68 | instance, wxFlagsProperty), you need to call this method. |
69 | After populating has been finished, you need to call EndAddChildren(). | |
1c4293cb | 70 | |
effb029c | 71 | @see EndAddChildren() |
1c4293cb VZ |
72 | */ |
73 | void BeginAddChildren( wxPGPropArg id ); | |
74 | ||
effb029c JS |
75 | /** |
76 | Deletes all properties. | |
1621f192 JS |
77 | |
78 | @remarks This functions deselects selected property, if any. Validation | |
79 | failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. | |
80 | selection is cleared even if editor had invalid value. | |
1c4293cb VZ |
81 | */ |
82 | virtual void Clear() = 0; | |
83 | ||
effb029c | 84 | /** |
1621f192 JS |
85 | Clears current selection, if any. |
86 | ||
87 | @param validation | |
88 | If set to @false, deselecting the property will always work, | |
89 | even if its editor had invalid value in it. | |
effb029c | 90 | |
1621f192 JS |
91 | @return Returns @true if successful or if there was no selection. May |
92 | fail if validation was enabled and active editor had invalid | |
93 | value. | |
effb029c | 94 | */ |
1621f192 | 95 | bool ClearSelection( bool validation = false); |
1c4293cb | 96 | |
effb029c JS |
97 | /** |
98 | Resets modified status of all properties. | |
1c4293cb | 99 | */ |
effb029c JS |
100 | void ClearModifiedStatus(); |
101 | ||
102 | /** | |
103 | Collapses given category or property with children. | |
1c4293cb | 104 | |
effb029c | 105 | @return Returns @true if actually collapsed. |
1621f192 JS |
106 | |
107 | @remarks This function may deselect selected property, if any. Validation | |
108 | failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. | |
109 | selection is cleared even if editor had invalid value. | |
1c4293cb VZ |
110 | */ |
111 | bool Collapse( wxPGPropArg id ); | |
112 | ||
effb029c JS |
113 | /** |
114 | Collapses all items that can be collapsed. | |
1c4293cb | 115 | |
1621f192 JS |
116 | @remarks This functions clears selection. Validation failure option |
117 | wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. selection | |
118 | is cleared even if editor had invalid value. | |
1c4293cb | 119 | */ |
effb029c | 120 | bool CollapseAll(); |
1c4293cb | 121 | |
effb029c JS |
122 | /** |
123 | Changes value of a property, as if by user. Use this instead of | |
124 | SetPropertyValue() if you need the value to run through validation | |
125 | process, and also send the property change event. | |
1c4293cb | 126 | |
effb029c | 127 | @return Returns @true if value was successfully changed. |
1c4293cb VZ |
128 | */ |
129 | bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue ); | |
130 | ||
effb029c JS |
131 | /** |
132 | Deletes a property. | |
1621f192 JS |
133 | |
134 | @remarks This functions deselects selected property, if any. Validation | |
135 | failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. | |
136 | selection is cleared even if editor had invalid value. | |
effb029c | 137 | */ |
1c4293cb VZ |
138 | void DeleteProperty( wxPGPropArg id ); |
139 | ||
effb029c JS |
140 | /** |
141 | Disables a property. | |
142 | */ | |
143 | bool DisableProperty( wxPGPropArg id ); | |
1c4293cb | 144 | |
effb029c | 145 | /** |
0ad10f30 FM |
146 | Returns @true if all property grid data changes have been committed. Usually |
147 | only returns @false if value in active editor has been invalidated by a | |
1c4293cb VZ |
148 | wxValidator. |
149 | */ | |
150 | bool EditorValidate(); | |
151 | ||
effb029c JS |
152 | /** |
153 | Enables or disables property. | |
154 | ||
155 | @param id | |
156 | Name or pointer to a property. | |
effb029c JS |
157 | @param enable |
158 | If @false, property is disabled instead. | |
159 | */ | |
1c4293cb VZ |
160 | bool EnableProperty( wxPGPropArg id, bool enable = true ); |
161 | ||
effb029c JS |
162 | /** |
163 | Called after population of property with fixed children has finished. | |
164 | ||
165 | @see BeginAddChildren() | |
1c4293cb VZ |
166 | */ |
167 | void EndAddChildren( wxPGPropArg id ); | |
168 | ||
effb029c JS |
169 | /** |
170 | Expands given category or property with children. | |
171 | ||
172 | @return Returns @true if actually expanded. | |
1621f192 JS |
173 | |
174 | @remarks This function may deselect selected property, if any. Validation | |
175 | failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. | |
176 | selection is cleared even if editor had invalid value. | |
1c4293cb VZ |
177 | */ |
178 | bool Expand( wxPGPropArg id ); | |
179 | ||
effb029c JS |
180 | /** |
181 | Expands all items that can be expanded. | |
1621f192 JS |
182 | |
183 | @remarks This functions clears selection. Validation failure option | |
184 | wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. selection | |
185 | is cleared even if editor had invalid value. | |
1c4293cb VZ |
186 | */ |
187 | bool ExpandAll( bool expand = true ); | |
188 | ||
effb029c JS |
189 | /** |
190 | Returns id of first child of given property. | |
1c4293cb | 191 | |
effb029c JS |
192 | @remarks Does not return private children! |
193 | */ | |
194 | wxPGProperty* GetFirstChild( wxPGPropArg id ); | |
1c4293cb VZ |
195 | |
196 | //@{ | |
0ad10f30 FM |
197 | /** |
198 | Returns iterator class instance. | |
bba3f9b5 | 199 | |
1c4293cb | 200 | @param flags |
bba3f9b5 JS |
201 | See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes |
202 | iteration over everything except private child properties. | |
1c4293cb | 203 | @param firstProp |
0ad10f30 | 204 | Property to start iteration from. If @NULL, then first child of root |
effb029c | 205 | is used. |
bba3f9b5 | 206 | |
0ad10f30 FM |
207 | @beginWxPythonOnly |
208 | <b>wxPython Note:</b> Instead of ++ operator, use Next() method, and | |
209 | instead of * operator, use GetProperty() method. | |
210 | @endWxPythonOnly | |
211 | */ | |
212 | wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, | |
213 | wxPGProperty* firstProp = NULL ); | |
214 | wxPropertyGridConstIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT, | |
215 | wxPGProperty* firstProp = NULL ) const; | |
216 | //@} | |
217 | ||
218 | //@{ | |
219 | /** | |
220 | Returns iterator class instance. | |
221 | ||
222 | @param flags | |
223 | See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes | |
224 | iteration over everything except private child properties. | |
1c4293cb | 225 | @param startPos |
effb029c JS |
226 | Either wxTOP or wxBOTTOM. wxTOP will indicate that iterations start |
227 | from the first property from the top, and wxBOTTOM means that the | |
228 | iteration will instead begin from bottommost valid item. | |
229 | ||
0ad10f30 | 230 | @beginWxPythonOnly |
effb029c JS |
231 | <b>wxPython Note:</b> Instead of ++ operator, use Next() method, and |
232 | instead of * operator, use GetProperty() method. | |
0ad10f30 | 233 | @endWxPythonOnly |
effb029c | 234 | */ |
effb029c JS |
235 | wxPropertyGridIterator GetIterator( int flags, int startPos ); |
236 | wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const; | |
1c4293cb VZ |
237 | //@} |
238 | ||
effb029c JS |
239 | /** |
240 | Returns id of first item that matches given criteria. | |
241 | ||
1c4293cb | 242 | @param flags |
effb029c | 243 | See @ref propgrid_iterator_flags. |
1c4293cb | 244 | */ |
effb029c | 245 | wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ); |
1c4293cb | 246 | |
effb029c JS |
247 | /** |
248 | Returns id of property with given name (case-sensitive). | |
1c4293cb | 249 | */ |
0ad10f30 | 250 | wxPGProperty* GetProperty( const wxString& name ) const; |
1c4293cb | 251 | |
effb029c | 252 | /** |
0ad10f30 FM |
253 | Adds to 'targetArr' pointers to properties that have given flags 'flags' set. |
254 | However, if @a 'inverse' is set to @true, then only properties without | |
255 | given flags are stored. | |
effb029c | 256 | |
0ad10f30 FM |
257 | @param targetArr |
258 | @todo docme | |
1c4293cb | 259 | @param flags |
effb029c | 260 | Property flags to use. |
0ad10f30 FM |
261 | @param inverse |
262 | @todo docme | |
1c4293cb | 263 | @param iterFlags |
effb029c JS |
264 | Iterator flags to use. Default is everything expect private children. |
265 | See @ref propgrid_iterator_flags. | |
1c4293cb VZ |
266 | */ |
267 | void GetPropertiesWithFlag( wxArrayPGProperty* targetArr, | |
268 | wxPGProperty::FlagType flags, | |
269 | bool inverse = false, | |
270 | int iterFlags = (wxPG_ITERATE_PROPERTIES|wxPG_ITERATE_HIDDEN|wxPG_ITERATE_CATEGORIES) ) const; | |
271 | ||
effb029c JS |
272 | /** |
273 | Returns value of given attribute. If none found, returns wxNullVariant. | |
1c4293cb | 274 | */ |
effb029c | 275 | wxVariant GetPropertyAttribute( wxPGPropArg id, const wxString& attrName ) const; |
1c4293cb | 276 | |
e2ca6599 JS |
277 | /** |
278 | Returns background colour of first cell of a property. | |
279 | */ | |
280 | wxColour GetPropertyBackgroundColour( wxPGPropArg id ) const; | |
281 | ||
effb029c JS |
282 | /** |
283 | Returns pointer of property's nearest parent category. If no category | |
0ad10f30 | 284 | found, returns @NULL. |
1c4293cb | 285 | */ |
effb029c | 286 | wxPropertyCategory* GetPropertyCategory( wxPGPropArg id ) const; |
1c4293cb VZ |
287 | |
288 | /** Returns client data (void*) of a property. */ | |
effb029c | 289 | void* GetPropertyClientData( wxPGPropArg id ) const; |
1c4293cb | 290 | |
effb029c | 291 | /** |
0ad10f30 | 292 | Returns first property which label matches given string. @NULL if none |
effb029c JS |
293 | found. Note that this operation is very slow when compared to |
294 | GetPropertyByName(). | |
1c4293cb VZ |
295 | */ |
296 | wxPGProperty* GetPropertyByLabel( const wxString& label ) const; | |
297 | ||
effb029c | 298 | /** |
0ad10f30 | 299 | Returns property with given name. @NULL if none found. |
1c4293cb VZ |
300 | */ |
301 | wxPGProperty* GetPropertyByName( const wxString& name ) const; | |
302 | ||
effb029c JS |
303 | /** |
304 | Returns child property 'subname' of property 'name'. Same as | |
1c4293cb VZ |
305 | calling GetPropertyByName("name.subname"), albeit slightly faster. |
306 | */ | |
effb029c JS |
307 | wxPGProperty* GetPropertyByName( const wxString& name, |
308 | const wxString& subname ) const; | |
1c4293cb | 309 | |
effb029c JS |
310 | /** |
311 | Returns property's editor. | |
312 | */ | |
313 | const wxPGEditor* GetPropertyEditor( wxPGPropArg id ) const; | |
1c4293cb | 314 | |
effb029c JS |
315 | /** |
316 | Returns help string associated with a property. | |
317 | */ | |
318 | wxString GetPropertyHelpString( wxPGPropArg id ) const; | |
1c4293cb | 319 | |
effb029c | 320 | /** |
0ad10f30 | 321 | Returns property's custom value image (@NULL of none). |
effb029c JS |
322 | */ |
323 | wxBitmap* GetPropertyImage( wxPGPropArg id ) const; | |
1c4293cb VZ |
324 | |
325 | /** Returns label of a property. */ | |
effb029c | 326 | const wxString& GetPropertyLabel( wxPGPropArg id ); |
1c4293cb | 327 | |
effb029c JS |
328 | /** Returns property's name, by which it is globally accessible. */ |
329 | wxString GetPropertyName( wxPGProperty* property ); | |
1c4293cb | 330 | |
e2ca6599 JS |
331 | /** |
332 | Returns text colour of first cell of a property. | |
333 | */ | |
334 | wxColour GetPropertyTextColour( wxPGPropArg id ) const; | |
335 | ||
effb029c JS |
336 | /** |
337 | Returns validator of a property as a reference, which you | |
1c4293cb VZ |
338 | can pass to any number of SetPropertyValidator. |
339 | */ | |
effb029c | 340 | wxValidator* GetPropertyValidator( wxPGPropArg id ); |
1c4293cb | 341 | |
effb029c JS |
342 | /** |
343 | Returns property's value as wxVariant. | |
1c4293cb VZ |
344 | |
345 | If property value is unspecified, Null variant is returned. | |
346 | */ | |
effb029c | 347 | wxVariant GetPropertyValue( wxPGPropArg id ); |
1c4293cb | 348 | |
effb029c JS |
349 | /** Return's property's value as wxArrayInt. */ |
350 | wxArrayInt GetPropertyValueAsArrayInt( wxPGPropArg id ) const; | |
351 | ||
352 | /** Returns property's value as wxArrayString. */ | |
353 | wxArrayString GetPropertyValueAsArrayString( wxPGPropArg id ) const; | |
354 | ||
355 | /** Returns property's value as bool */ | |
1c4293cb | 356 | bool GetPropertyValueAsBool( wxPGPropArg id ) const; |
1c4293cb | 357 | |
effb029c JS |
358 | /** Return's property's value as wxDateTime. */ |
359 | wxDateTime GetPropertyValueAsDateTime( wxPGPropArg id ) const; | |
1c4293cb | 360 | |
effb029c JS |
361 | /** Returns property's value as double-precision floating point number. */ |
362 | double GetPropertyValueAsDouble( wxPGPropArg id ) const; | |
1c4293cb | 363 | |
effb029c JS |
364 | /** Returns property's value as integer */ |
365 | int GetPropertyValueAsInt( wxPGPropArg id ) const; | |
1c4293cb | 366 | |
effb029c JS |
367 | /** Returns property's value as integer */ |
368 | long GetPropertyValueAsLong( wxPGPropArg id ) const; | |
1c4293cb | 369 | |
effb029c JS |
370 | /** Returns property's value as native signed 64-bit integer. */ |
371 | wxLongLong_t GetPropertyValueAsLongLong( wxPGPropArg id ) const; | |
1c4293cb | 372 | |
effb029c JS |
373 | /** |
374 | Returns property's value as wxString. If property does not | |
375 | use string value type, then its value is converted using | |
376 | wxPGProperty::GetValueAsString(). | |
377 | */ | |
378 | wxString GetPropertyValueAsString( wxPGPropArg id ) const; | |
1c4293cb | 379 | |
effb029c JS |
380 | /** Returns property's value as unsigned integer */ |
381 | unsigned long GetPropertyValueAsULong( wxPGPropArg id ) const; | |
1c4293cb | 382 | |
effb029c JS |
383 | /** Returns property's value as native unsigned 64-bit integer. */ |
384 | wxULongLong_t GetPropertyValueAsULongLong( wxPGPropArg id ) const; | |
385 | ||
386 | /** | |
387 | Returns a wxVariant list containing wxVariant versions of all | |
1c4293cb | 388 | property values. Order is not guaranteed. |
effb029c | 389 | |
0ad10f30 FM |
390 | @param listname |
391 | @todo docme | |
392 | @param baseparent | |
393 | @todo docme | |
1c4293cb | 394 | @param flags |
effb029c JS |
395 | Use wxPG_KEEP_STRUCTURE to retain category structure; each sub |
396 | category will be its own wxVariantList of wxVariant. | |
397 | ||
398 | Use wxPG_INC_ATTRIBUTES to include property attributes as well. | |
399 | Each attribute will be stored as list variant named | |
400 | "@@<propname>@@attr." | |
1c4293cb VZ |
401 | */ |
402 | wxVariant GetPropertyValues( const wxString& listname = wxEmptyString, | |
0ad10f30 | 403 | wxPGProperty* baseparent = NULL, long flags = 0 ) const; |
1c4293cb VZ |
404 | |
405 | /** Returns currently selected property. */ | |
effb029c | 406 | wxPGProperty* GetSelection() const; |
1c4293cb | 407 | |
effb029c JS |
408 | /** |
409 | Similar to GetIterator(), but instead returns wxPGVIterator instance, | |
1c4293cb VZ |
410 | which can be useful for forward-iterating through arbitrary property |
411 | containers. | |
412 | ||
413 | @param flags | |
bba3f9b5 JS |
414 | See @ref propgrid_iterator_flags. |
415 | ||
effb029c JS |
416 | <b>wxPython Note:</b> Instead of ++ operator, use Next() method, and |
417 | instead of * operator, use GetProperty() method. | |
1c4293cb VZ |
418 | */ |
419 | virtual wxPGVIterator GetVIterator( int flags ) const; | |
420 | ||
effb029c JS |
421 | /** |
422 | Hides or reveals a property. | |
423 | ||
0ad10f30 FM |
424 | @param id |
425 | @todo docme | |
1c4293cb | 426 | @param hide |
effb029c | 427 | If @true, hides property, otherwise reveals it. |
1c4293cb | 428 | @param flags |
effb029c JS |
429 | By default changes are applied recursively. Set this parameter |
430 | wxPG_DONT_RECURSE to prevent this. | |
1c4293cb VZ |
431 | */ |
432 | bool HideProperty( wxPGPropArg id, bool hide = true, int flags = wxPG_RECURSE ); | |
433 | ||
effb029c JS |
434 | /** |
435 | Initializes *all* property types. Causes references to most object | |
1c4293cb VZ |
436 | files in the library, so calling this may cause significant increase |
437 | in executable size when linking with static library. | |
438 | */ | |
439 | static void InitAllTypeHandlers(); | |
440 | ||
0ad10f30 FM |
441 | /** |
442 | Inserts property to the property container. | |
1c4293cb VZ |
443 | |
444 | @param priorThis | |
effb029c JS |
445 | New property is inserted just prior to this. Available only |
446 | in the first variant. There are two versions of this function | |
447 | to allow this parameter to be either an id or name to | |
448 | a property. | |
effb029c JS |
449 | @param newProperty |
450 | Pointer to the inserted property. wxPropertyGrid will take | |
451 | ownership of this object. | |
1c4293cb | 452 | |
effb029c | 453 | @return Returns newProperty. |
1c4293cb VZ |
454 | |
455 | @remarks | |
456 | ||
457 | - wxPropertyGrid takes the ownership of the property pointer. | |
458 | ||
459 | - While Append may be faster way to add items, make note that when | |
460 | both types of data storage (categoric and | |
461 | non-categoric) are active, Insert becomes even more slow. This is | |
462 | especially true if current mode is non-categoric. | |
463 | ||
1621f192 JS |
464 | - This functions deselects selected property, if any. Validation |
465 | failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie. | |
466 | selection is cleared even if editor had invalid value. | |
467 | ||
1c4293cb VZ |
468 | Example of use: |
469 | ||
470 | @code | |
471 | ||
472 | // append category | |
473 | wxPGProperty* my_cat_id = propertygrid->Append( new wxPropertyCategory("My Category") ); | |
474 | ||
475 | ... | |
476 | ||
477 | // insert into category - using second variant | |
478 | wxPGProperty* my_item_id_1 = propertygrid->Insert( my_cat_id, 0, new wxStringProperty("My String 1") ); | |
479 | ||
480 | // insert before to first item - using first variant | |
481 | wxPGProperty* my_item_id_2 = propertygrid->Insert( my_item_id, new wxStringProperty("My String 2") ); | |
482 | ||
483 | @endcode | |
1c4293cb | 484 | */ |
effb029c | 485 | wxPGProperty* Insert( wxPGPropArg priorThis, wxPGProperty* newProperty ); |
0ad10f30 FM |
486 | |
487 | /** | |
488 | Inserts property to the property container. | |
489 | See the other overload for more details. | |
490 | ||
491 | @param parent | |
492 | New property is inserted under this category. Available only | |
493 | in the second variant. There are two versions of this function | |
494 | to allow this parameter to be either an id or name to | |
495 | a property. | |
496 | @param index | |
497 | Index under category. Available only in the second variant. | |
498 | If index is < 0, property is appended in category. | |
499 | @param newProperty | |
500 | Pointer to the inserted property. wxPropertyGrid will take | |
501 | ownership of this object. | |
502 | ||
503 | @return Returns newProperty. | |
504 | */ | |
effb029c | 505 | wxPGProperty* Insert( wxPGPropArg parent, int index, wxPGProperty* newProperty ); |
1c4293cb | 506 | |
effb029c JS |
507 | /** Returns @true if property is a category. */ |
508 | bool IsPropertyCategory( wxPGPropArg id ) const; | |
1c4293cb | 509 | |
effb029c JS |
510 | /** Returns @true if property is enabled. */ |
511 | bool IsPropertyEnabled( wxPGPropArg id ) const; | |
1c4293cb | 512 | |
effb029c | 513 | /** |
0ad10f30 | 514 | Returns @true if given property is expanded. Naturally, always returns |
effb029c | 515 | @false for properties that cannot be expanded. |
1c4293cb VZ |
516 | */ |
517 | bool IsPropertyExpanded( wxPGPropArg id ) const; | |
518 | ||
effb029c JS |
519 | /** |
520 | Returns @true if property has been modified after value set or modify | |
521 | flag clear by software. | |
1c4293cb | 522 | */ |
effb029c | 523 | bool IsPropertyModified( wxPGPropArg id ) const; |
1c4293cb | 524 | |
effb029c | 525 | /** |
0ad10f30 | 526 | Returns @true if property is shown (ie. HideProperty() with @true not |
effb029c | 527 | called for it). |
1c4293cb | 528 | */ |
effb029c | 529 | bool IsPropertyShown( wxPGPropArg id ) const; |
1c4293cb | 530 | |
effb029c | 531 | /** |
0ad10f30 | 532 | Returns @true if property value is set to unspecified. |
1c4293cb | 533 | */ |
effb029c | 534 | bool IsPropertyValueUnspecified( wxPGPropArg id ) const; |
1c4293cb | 535 | |
effb029c JS |
536 | /** |
537 | Disables (limit = @true) or enables (limit = @false) wxTextCtrl editor | |
538 | of a property, if it is not the sole mean to edit the value. | |
1c4293cb | 539 | */ |
effb029c | 540 | void LimitPropertyEditing( wxPGPropArg id, bool limit = true ); |
1c4293cb | 541 | |
effb029c JS |
542 | /** |
543 | Initializes additional property editors (SpinCtrl etc.). Causes | |
544 | references to most object files in the library, so calling this may | |
545 | cause significant increase in executable size when linking with static | |
546 | library. | |
1c4293cb VZ |
547 | */ |
548 | static void RegisterAdditionalEditors(); | |
549 | ||
effb029c JS |
550 | /** |
551 | Replaces property with id with newly created one. For example, | |
1c4293cb VZ |
552 | this code replaces existing property named "Flags" with one that |
553 | will have different set of items: | |
effb029c | 554 | |
1c4293cb VZ |
555 | @code |
556 | pg->ReplaceProperty("Flags", | |
557 | wxFlagsProperty("Flags", wxPG_LABEL, newItems)) | |
558 | @endcode | |
effb029c JS |
559 | |
560 | @see Insert() | |
1c4293cb VZ |
561 | */ |
562 | wxPGProperty* ReplaceProperty( wxPGPropArg id, wxPGProperty* property ); | |
563 | ||
effb029c JS |
564 | /** |
565 | @anchor propgridinterface_editablestate_flags | |
1c4293cb VZ |
566 | |
567 | Flags for wxPropertyGridInterface::SaveEditableState() and | |
568 | wxPropertyGridInterface::RestoreEditableState(). | |
569 | */ | |
570 | enum EditableStateFlags | |
571 | { | |
572 | /** Include selected property. */ | |
573 | SelectionState = 0x01, | |
574 | /** Include expanded/collapsed property information. */ | |
575 | ExpandedState = 0x02, | |
576 | /** Include scrolled position. */ | |
577 | ScrollPosState = 0x04, | |
effb029c JS |
578 | /** Include selected page information. Only applies to |
579 | wxPropertyGridManager. */ | |
1c4293cb VZ |
580 | PageState = 0x08, |
581 | /** Include splitter position. Stored for each page. */ | |
582 | SplitterPosState = 0x10, | |
62805170 JS |
583 | /** Include description box size. |
584 | Only applies to wxPropertyGridManager. */ | |
585 | DescBoxState = 0x20, | |
586 | ||
587 | /** | |
588 | Include all supported user editable state information. | |
589 | This is usually the default value. */ | |
590 | AllStates = SelectionState | | |
591 | ExpandedState | | |
592 | ScrollPosState | | |
593 | PageState | | |
594 | SplitterPosState | | |
595 | DescBoxState | |
1c4293cb VZ |
596 | }; |
597 | ||
effb029c JS |
598 | /** |
599 | Restores user-editable state. See also wxPropertyGridInterface::SaveEditableState(). | |
1c4293cb VZ |
600 | |
601 | @param src | |
602 | String generated by SaveEditableState. | |
603 | ||
604 | @param restoreStates | |
605 | Which parts to restore from source string. See @ref propgridinterface_editablestate_flags | |
606 | "list of editable state flags". | |
607 | ||
effb029c | 608 | @return Returns @false if there was problem reading the string. |
1c4293cb | 609 | |
effb029c JS |
610 | @remarks If some parts of state (such as scrolled or splitter position) |
611 | fail to restore correctly, please make sure that you call this | |
612 | function after wxPropertyGrid size has been set (this may | |
613 | sometimes be tricky when sizers are used). | |
1c4293cb VZ |
614 | */ |
615 | bool RestoreEditableState( const wxString& src, | |
616 | int restoreStates = AllStates ); | |
617 | ||
effb029c JS |
618 | /** |
619 | Used to acquire user-editable state (selected property, expanded | |
620 | properties, scrolled position, splitter positions). | |
1c4293cb VZ |
621 | |
622 | @param includedStates | |
623 | Which parts of state to include. See @ref propgridinterface_editablestate_flags | |
624 | "list of editable state flags". | |
625 | */ | |
626 | wxString SaveEditableState( int includedStates = AllStates ) const; | |
627 | ||
effb029c JS |
628 | /** |
629 | Sets strings listed in the choice dropdown of a wxBoolProperty. | |
630 | ||
631 | Defaults are "True" and "False", so changing them to, say, "Yes" and | |
632 | "No" may be useful in some less technical applications. | |
1c4293cb | 633 | */ |
effb029c JS |
634 | static void SetBoolChoices( const wxString& trueChoice, |
635 | const wxString& falseChoice ); | |
636 | ||
effb029c JS |
637 | /** |
638 | Sets an attribute for this property. | |
639 | ||
0ad10f30 FM |
640 | @param id |
641 | @todo docme | |
642 | @param attrName | |
effb029c | 643 | Text identifier of attribute. See @ref propgrid_property_attributes. |
1c4293cb | 644 | @param value |
effb029c | 645 | Value of attribute. |
1c4293cb | 646 | @param argFlags |
0ad10f30 FM |
647 | Optional. |
648 | Use wxPG_RECURSE to set the attribute to child properties recursively. | |
1802a91d JS |
649 | |
650 | @remarks Setting attribute's value to Null variant will simply remove it | |
0ad10f30 | 651 | from property's set of attributes. |
1c4293cb | 652 | */ |
effb029c JS |
653 | void SetPropertyAttribute( wxPGPropArg id, const wxString& attrName, |
654 | wxVariant value, long argFlags = 0 ); | |
1c4293cb | 655 | |
effb029c JS |
656 | /** |
657 | Sets property attribute for all applicapple properties. | |
3c26d11b JS |
658 | Be sure to use this method only after all properties have been |
659 | added to the grid. | |
660 | */ | |
661 | void SetPropertyAttributeAll( const wxString& attrName, wxVariant value ); | |
662 | ||
e2ca6599 JS |
663 | /** |
664 | Sets background colour of a property. | |
665 | ||
666 | @param id | |
667 | Property name or pointer. | |
668 | ||
669 | @param colour | |
670 | New background colour. | |
671 | ||
672 | @param recursively | |
673 | If True, child properties are affected recursively. Property | |
674 | categories are skipped if this flag is used. | |
675 | */ | |
676 | void SetPropertyBackgroundColour( wxPGPropArg id, | |
677 | const wxColour& colour, | |
678 | bool recursively = true ); | |
679 | ||
effb029c JS |
680 | /** |
681 | Sets text, bitmap, and colours for given column's cell. | |
1c4293cb VZ |
682 | |
683 | @remarks | |
effb029c | 684 | - You can set label cell by using column 0. |
1c4293cb VZ |
685 | - You can use wxPG_LABEL as text to use default text for column. |
686 | */ | |
687 | void SetPropertyCell( wxPGPropArg id, | |
688 | int column, | |
689 | const wxString& text = wxEmptyString, | |
690 | const wxBitmap& bitmap = wxNullBitmap, | |
691 | const wxColour& fgCol = wxNullColour, | |
effb029c JS |
692 | const wxColour& bgCol = wxNullColour ); |
693 | ||
694 | /** | |
695 | Sets client data (void*) of a property. | |
1c4293cb | 696 | |
1c4293cb VZ |
697 | @remarks |
698 | This untyped client data has to be deleted manually. | |
699 | */ | |
effb029c | 700 | void SetPropertyClientData( wxPGPropArg id, void* clientData ); |
1c4293cb | 701 | |
e2ca6599 JS |
702 | /** |
703 | Resets text and background colours of given property. | |
704 | */ | |
705 | void SetPropertyColoursToDefault( wxPGPropArg id ); | |
706 | ||
effb029c JS |
707 | /** |
708 | Sets editor for a property. | |
1c4293cb | 709 | |
0ad10f30 FM |
710 | @param id |
711 | @todo docme | |
1c4293cb | 712 | @param editor |
effb029c JS |
713 | For builtin editors, use wxPGEditor_X, where X is builtin editor's |
714 | name (TextCtrl, Choice, etc. see wxPGEditor documentation for full | |
715 | list). | |
1c4293cb VZ |
716 | |
717 | For custom editors, use pointer you received from wxPropertyGrid::RegisterEditorClass(). | |
718 | */ | |
effb029c | 719 | void SetPropertyEditor( wxPGPropArg id, const wxPGEditor* editor ); |
1c4293cb | 720 | |
effb029c JS |
721 | /** |
722 | Sets editor control of a property. As editor argument, use | |
1c4293cb VZ |
723 | editor name string, such as "TextCtrl" or "Choice". |
724 | */ | |
effb029c | 725 | void SetPropertyEditor( wxPGPropArg id, const wxString& editorName ); |
1c4293cb | 726 | |
effb029c JS |
727 | /** |
728 | Sets label of a property. | |
258ccb95 | 729 | |
1c4293cb | 730 | @remarks |
258ccb95 JS |
731 | - Properties under same parent may have same labels. However, |
732 | property names must still remain unique. | |
1c4293cb VZ |
733 | */ |
734 | void SetPropertyLabel( wxPGPropArg id, const wxString& newproplabel ); | |
735 | ||
020b0041 JS |
736 | /** |
737 | Sets name of a property. | |
738 | ||
739 | @param id | |
740 | Name or pointer of property which name to change. | |
741 | ||
742 | @param newName | |
743 | New name for property. | |
744 | */ | |
745 | void SetPropertyName( wxPGPropArg id, const wxString& newName ); | |
746 | ||
effb029c JS |
747 | /** |
748 | Sets property (and, recursively, its children) to have read-only value. | |
749 | In other words, user cannot change the value in the editor, but they can | |
750 | still copy it. | |
751 | ||
752 | @remarks This is mainly for use with textctrl editor. Only some other | |
753 | editors fully support it. | |
754 | ||
755 | @param id | |
756 | Property name or pointer. | |
757 | ||
758 | @param set | |
759 | Use @true to enable read-only, @false to disable it. | |
1c4293cb | 760 | |
1c4293cb | 761 | @param flags |
effb029c JS |
762 | By default changes are applied recursively. Set this parameter |
763 | wxPG_DONT_RECURSE to prevent this. | |
1c4293cb | 764 | */ |
effb029c JS |
765 | void SetPropertyReadOnly( wxPGPropArg id, bool set = true, |
766 | int flags = wxPG_RECURSE ); | |
1c4293cb | 767 | |
effb029c JS |
768 | /** |
769 | Sets property's value to unspecified. If it has children (it may be | |
770 | category), then the same thing is done to them. | |
1c4293cb VZ |
771 | */ |
772 | void SetPropertyValueUnspecified( wxPGPropArg id ); | |
773 | ||
effb029c JS |
774 | /** |
775 | Sets various property values from a list of wxVariants. If property with | |
776 | name is missing from the grid, new property is created under given | |
777 | default category (or root if omitted). | |
1c4293cb | 778 | */ |
effb029c JS |
779 | void SetPropertyValues( const wxVariantList& list, |
780 | wxPGPropArg defaultCategory = wxNullProperty ); | |
1c4293cb | 781 | |
effb029c JS |
782 | void SetPropertyValues( const wxVariant& list, |
783 | wxPGPropArg defaultCategory = wxNullProperty ); | |
1c4293cb | 784 | |
effb029c JS |
785 | /** |
786 | Associates the help string with property. | |
787 | ||
788 | @remarks By default, text is shown either in the manager's "description" | |
789 | text box or in the status bar. If extra window style | |
790 | wxPG_EX_HELP_AS_TOOLTIPS is used, then the text will appear as | |
791 | a tooltip. | |
1c4293cb | 792 | */ |
effb029c | 793 | void SetPropertyHelpString( wxPGPropArg id, const wxString& helpString ); |
1c4293cb | 794 | |
effb029c JS |
795 | /** |
796 | Set wxBitmap in front of the value. | |
797 | ||
798 | @remarks Bitmap will be scaled to a size returned by | |
799 | wxPropertyGrid::GetImageSize(); | |
1c4293cb | 800 | */ |
effb029c | 801 | void SetPropertyImage( wxPGPropArg id, wxBitmap& bmp ); |
1c4293cb | 802 | |
effb029c JS |
803 | /** |
804 | Sets max length of property's text. | |
1c4293cb VZ |
805 | */ |
806 | bool SetPropertyMaxLength( wxPGPropArg id, int maxLen ); | |
807 | ||
e2ca6599 JS |
808 | |
809 | /** | |
810 | Sets text colour of a property. | |
811 | ||
812 | @param id | |
813 | Property name or pointer. | |
814 | ||
815 | @param colour | |
816 | New background colour. | |
817 | ||
818 | @param recursively | |
819 | If True, child properties are affected recursively. Property | |
820 | categories are skipped if this flag is used. | |
821 | */ | |
822 | void SetPropertyTextColour( wxPGPropArg id, | |
088441b5 | 823 | const wxColour& colour, |
e2ca6599 JS |
824 | bool recursively = true ); |
825 | ||
effb029c JS |
826 | /** |
827 | Sets validator of a property. | |
1c4293cb | 828 | */ |
effb029c | 829 | void SetPropertyValidator( wxPGPropArg id, const wxValidator& validator ); |
1c4293cb | 830 | |
effb029c JS |
831 | /** Sets value (integer) of a property. */ |
832 | void SetPropertyValue( wxPGPropArg id, long value ); | |
1c4293cb | 833 | |
effb029c JS |
834 | /** Sets value (integer) of a property. */ |
835 | void SetPropertyValue( wxPGPropArg id, int value ); | |
1c4293cb | 836 | |
effb029c JS |
837 | /** Sets value (floating point) of a property. */ |
838 | void SetPropertyValue( wxPGPropArg id, double value ); | |
1c4293cb | 839 | |
effb029c JS |
840 | /** Sets value (bool) of a property. */ |
841 | void SetPropertyValue( wxPGPropArg id, bool value ); | |
1c4293cb | 842 | |
effb029c JS |
843 | /** Sets value (string) of a property. */ |
844 | void SetPropertyValue( wxPGPropArg id, const wxString& value ); | |
1c4293cb | 845 | |
effb029c JS |
846 | /** Sets value (wxArrayString) of a property. */ |
847 | void SetPropertyValue( wxPGPropArg id, const wxArrayString& value ); | |
1c4293cb | 848 | |
effb029c JS |
849 | /** Sets value (wxDateTime) of a property. */ |
850 | void SetPropertyValue( wxPGPropArg id, const wxDateTime& value ); | |
1c4293cb | 851 | |
effb029c JS |
852 | /** Sets value (wxObject*) of a property. */ |
853 | void SetPropertyValue( wxPGPropArg id, wxObject* value ); | |
1c4293cb | 854 | |
effb029c JS |
855 | /** Sets value (wxObject&) of a property. */ |
856 | void SetPropertyValue( wxPGPropArg id, wxObject& value ); | |
857 | ||
858 | /** Sets value (native 64-bit int) of a property. */ | |
859 | void SetPropertyValue( wxPGPropArg id, wxLongLong_t value ); | |
860 | ||
861 | /** Sets value (native 64-bit unsigned int) of a property. */ | |
862 | void SetPropertyValue( wxPGPropArg id, wxULongLong_t value ); | |
863 | ||
864 | /** Sets value (wxArrayInt&) of a property. */ | |
865 | void SetPropertyValue( wxPGPropArg id, const wxArrayInt& value ); | |
866 | ||
867 | /** | |
868 | Sets value (wxString) of a property. | |
869 | ||
870 | @remarks This method uses wxPGProperty::SetValueFromString(), which all | |
871 | properties should implement. This means that there should not be | |
872 | a type error, and instead the string is converted to property's | |
873 | actual value type. | |
1c4293cb VZ |
874 | */ |
875 | void SetPropertyValueString( wxPGPropArg id, const wxString& value ); | |
876 | ||
effb029c JS |
877 | /** |
878 | Sets value (wxVariant&) of a property. | |
bba3f9b5 | 879 | |
effb029c JS |
880 | @remarks Use wxPropertyGrid::ChangePropertyValue() instead if you need to |
881 | run through validation process and send property change event. | |
1c4293cb | 882 | */ |
effb029c | 883 | void SetPropertyValue( wxPGPropArg id, wxVariant value ); |
1c4293cb | 884 | |
effb029c JS |
885 | /** |
886 | Adjusts how wxPropertyGrid behaves when invalid value is entered | |
1c4293cb | 887 | in a property. |
effb029c | 888 | |
1c4293cb | 889 | @param vfbFlags |
effb029c | 890 | See @ref propgrid_vfbflags for possible values. |
1c4293cb VZ |
891 | */ |
892 | void SetValidationFailureBehavior( int vfbFlags ); | |
893 | ||
effb029c JS |
894 | /** |
895 | Returns editor pointer of editor with given name; | |
896 | */ | |
1c4293cb | 897 | static wxPGEditor* GetEditorByName( const wxString& editorName ); |
1c4293cb VZ |
898 | }; |
899 |