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