1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxPGProperty
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
9 // -----------------------------------------------------------------------
11 /** @class wxPropertyGridInterface
13 Most of the shared property manipulation interface shared by wxPropertyGrid,
14 wxPropertyGridPage, and wxPropertyGridManager is defined in this class.
17 - In separate wxPropertyGrid component this class was known as wxPropertyContainerMethods.
22 class WXDLLIMPEXP_PROPGRID wxPropertyGridInterface
27 virtual ~wxPropertyGridInterface() { }
29 /** Appends property to the list. wxPropertyGrid assumes ownership of the object.
30 Becomes child of most recently added category.
32 - wxPropertyGrid takes the ownership of the property pointer.
33 - If appending a category with name identical to a category already in the
34 wxPropertyGrid, then newly created category is deleted, and most recently
35 added category (under which properties are appended) is set to the one with
36 same name. This allows easier adding of items to same categories in multiple
38 - Does not automatically redraw the control, so you may need to call Refresh
39 when calling this function after control has been shown for the first time.
41 wxPGProperty
* Append( wxPGProperty
* property
);
43 wxPGProperty
* AppendIn( wxPGPropArg id
, wxPGProperty
* newproperty
);
45 /** Inorder to add new items into a property with fixed children (for instance, wxFlagsProperty),
46 you need to call this method. After populating has been finished, you need to call EndAddChildren.
48 void BeginAddChildren( wxPGPropArg id
);
50 /** Deletes all properties.
52 virtual void Clear() = 0;
54 /** Deselect current selection, if any. Returns true if success
55 (ie. validator did not intercept). */
56 bool ClearSelection();
58 /** Resets modified status of all properties.
60 void ClearModifiedStatus()
62 SetPropertyModifiedStatus(m_pState
->m_properties
, false);
63 m_pState
->m_anyModified
= false;
66 /** Collapses given category or property with children.
67 Returns true if actually collapses.
69 bool Collapse( wxPGPropArg id
);
71 /** Collapses all items that can be collapsed.
74 Return false if failed (may fail if editor value cannot be validated).
76 bool CollapseAll() { return ExpandAll(false); }
78 /** Changes value of a property, as if from an editor. Use this instead of SetPropertyValue()
79 if you need the value to run through validation process, and also send the property
83 Returns true if value was successfully changed.
85 bool ChangePropertyValue( wxPGPropArg id
, wxVariant newValue
);
87 /** Resets value of a property to its default. */
88 bool ClearPropertyValue( wxPGPropArg id
)
90 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
91 p
->SetValue(p
->GetDefaultValue());
96 /** Deletes a property by id. If category is deleted, all children are automatically deleted as well. */
97 void DeleteProperty( wxPGPropArg id
);
99 /** Disables property. */
100 bool DisableProperty( wxPGPropArg id
) { return EnableProperty(id
,false); }
102 /** Returns true if all property grid data changes have been committed. Usually
103 only returns false if value in active editor has been invalidated by a
106 bool EditorValidate();
108 /** Enables or disables property, depending on whether enable is true or false. */
109 bool EnableProperty( wxPGPropArg id
, bool enable
= true );
111 /** Called after population of property with fixed children has finished.
113 void EndAddChildren( wxPGPropArg id
);
115 /** Expands given category or property with children.
116 Returns true if actually expands.
118 bool Expand( wxPGPropArg id
);
120 /** Expands all items that can be expanded.
122 bool ExpandAll( bool expand
= true );
124 /** Returns list of expanded properties.
126 wxArrayPGProperty
GetExpandedProperties() const
128 wxArrayPGProperty array
;
129 GetPropertiesWithFlag(&array
, wxPG_PROP_COLLAPSED
, true,
130 wxPG_ITERATE_ALL_PARENTS_RECURSIVELY
|wxPG_ITERATE_HIDDEN
);
134 /** Returns id of first child of given property.
136 Does not return sub-properties!
138 wxPGProperty
* GetFirstChild( wxPGPropArg id
)
140 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty
)
142 if ( !p
->GetChildCount() || p
->HasFlag(wxPG_PROP_AGGREGATE
) )
143 return wxNullProperty
;
149 /** Returns iterator class instance.
151 See @ref propgrid_iterator_flags. Value wxPG_ITERATE_DEFAULT causes
152 iteration over everything except private child properties.
154 Property to start iteration from. If NULL, then first child of root is used.
156 Either wxTOP or wxBOTTOM. wxTOP will indicate that iterations start from
157 the first property from the top, and wxBOTTOM means that the iteration will
158 instead begin from bottommost valid item.
160 wxPropertyGridIterator
GetIterator( int flags
= wxPG_ITERATE_DEFAULT
, wxPGProperty
* firstProp
= NULL
)
162 return wxPropertyGridIterator( m_pState
, flags
, firstProp
);
165 wxPropertyGridConstIterator
GetIterator( int flags
= wxPG_ITERATE_DEFAULT
, wxPGProperty
* firstProp
= NULL
) const
167 return wxPropertyGridConstIterator( m_pState
, flags
, firstProp
);
170 wxPropertyGridIterator
GetIterator( int flags
, int startPos
)
172 return wxPropertyGridIterator( m_pState
, flags
, startPos
);
175 wxPropertyGridConstIterator
GetIterator( int flags
, int startPos
) const
177 return wxPropertyGridConstIterator( m_pState
, flags
, startPos
);
181 /** Returns id of first item, whether it is a category or property.
183 @link iteratorflags List of iterator flags@endlink
185 wxPGProperty
* GetFirst( int flags
= wxPG_ITERATE_ALL
)
187 wxPropertyGridIterator
it( m_pState
, flags
, wxNullProperty
, 1 );
191 const wxPGProperty
* GetFirst( int flags
= wxPG_ITERATE_ALL
) const
193 return ((wxPropertyGridInterface
*)this)->GetFirst(flags
);
196 /** Returns id of property with given name (case-sensitive). If there is no
197 property with such name, returned property id is invalid ( i.e. it will return
198 false with IsOk method).
200 - Sub-properties (i.e. properties which have parent that is not category or
201 root) can not be accessed globally by their name. Instead, use
202 "<property>.<subproperty>" in place of "<subproperty>".
204 wxPGProperty
* GetProperty( const wxString
& name
) const
206 return GetPropertyByName(name
);
209 /** Returns map-like storage of property's attributes.
211 Note that if extra style wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES is set,
212 then builtin-attributes are not included in the storage.
214 const wxPGAttributeStorage
& GetPropertyAttributes( wxPGPropArg id
) const
216 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(*((const wxPGAttributeStorage
*)NULL
));
217 return p
->GetAttributes();
220 /** Adds to 'targetArr' pointers to properties that have given
221 flags 'flags' set. However, if 'inverse' is set to true, then
222 only properties without given flags are stored.
224 Property flags to use.
226 Iterator flags to use. Default is everything expect private children.
228 void GetPropertiesWithFlag( wxArrayPGProperty
* targetArr
,
229 wxPGProperty::FlagType flags
,
230 bool inverse
= false,
231 int iterFlags
= (wxPG_ITERATE_PROPERTIES
|wxPG_ITERATE_HIDDEN
|wxPG_ITERATE_CATEGORIES
) ) const;
233 /** Returns value of given attribute. If none found, returns NULL-variant.
235 wxVariant
GetPropertyAttribute( wxPGPropArg id
, const wxString
& attrName
) const
237 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullVariant
)
238 return p
->GetAttribute(attrName
);
241 /** Returns pointer of property's nearest parent category. If no category
244 wxPropertyCategory
* GetPropertyCategory( wxPGPropArg id
) const
246 wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(NULL
)
247 return m_pState
->GetPropertyCategory(p
);
250 /** Returns client data (void*) of a property. */
251 void* GetPropertyClientData( wxPGPropArg id
) const
253 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL
)
254 return p
->GetClientData();
257 /** Returns first property which label matches given string. NULL if none found.
258 Note that this operation is extremely slow when compared to GetPropertyByName().
260 wxPGProperty
* GetPropertyByLabel( const wxString
& label
) const;
262 /** Returns property with given name. NULL if none found.
264 wxPGProperty
* GetPropertyByName( const wxString
& name
) const;
266 /** Returns child property 'subname' of property 'name'. Same as
267 calling GetPropertyByName("name.subname"), albeit slightly faster.
269 wxPGProperty
* GetPropertyByName( const wxString
& name
, const wxString
& subname
) const;
271 /** Returns property's editor. */
272 const wxPGEditor
* GetPropertyEditor( wxPGPropArg id
) const
274 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL
)
275 return p
->GetEditorClass();
278 /** Returns help string associated with a property. */
279 wxString
GetPropertyHelpString( wxPGPropArg id
) const
281 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString
)
282 return p
->GetHelpString();
285 /** Returns property's custom value image (NULL of none). */
286 wxBitmap
* GetPropertyImage( wxPGPropArg id
) const
288 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL
)
289 return p
->GetValueImage();
292 /** Returns property's position under its parent. */
293 unsigned int GetPropertyIndex( wxPGPropArg id
)
295 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(INT_MAX
)
296 return p
->GetIndexInParent();
299 /** Returns label of a property. */
300 const wxString
& GetPropertyLabel( wxPGPropArg id
)
302 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString
)
303 return p
->GetLabel();
306 /** Returns name of a property, by which it is globally accessible. */
307 wxString
GetPropertyName( wxPGPropArg id
)
309 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString
)
313 /** Returns parent item of a property. */
314 wxPGProperty
* GetPropertyParent( wxPGPropArg id
)
316 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty
)
317 return p
->GetParent();
320 /** Returns validator of a property as a reference, which you
321 can pass to any number of SetPropertyValidator.
323 wxValidator
* GetPropertyValidator( wxPGPropArg id
)
325 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL
)
326 return p
->GetValidator();
329 /** Returns value as wxVariant.
331 If property value is unspecified, Null variant is returned.
333 wxVariant
GetPropertyValue( wxPGPropArg id
)
335 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxVariant())
336 return p
->GetValue();
339 wxString
GetPropertyValueAsString( wxPGPropArg id
) const;
340 long GetPropertyValueAsLong( wxPGPropArg id
) const;
341 unsigned long GetPropertyValueAsULong( wxPGPropArg id
) const
343 return (unsigned long) GetPropertyValueAsLong(id
);
345 int GetPropertyValueAsInt( wxPGPropArg id
) const { return (int)GetPropertyValueAsLong(id
); }
346 bool GetPropertyValueAsBool( wxPGPropArg id
) const;
347 double GetPropertyValueAsDouble( wxPGPropArg id
) const;
348 void* GetPropertyValueAsVoidPtr( wxPGPropArg id
) const;
350 wxArrayString
GetPropertyValueAsArrayString( wxPGPropArg id
) const
352 wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxT("arrstring"), wxArrayString())
353 return p
->m_value
.GetArrayString();
356 wxPoint
GetPropertyValueAsPoint( wxPGPropArg id
) const
358 wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxT("wxPoint"), wxPoint())
359 return WX_PG_VARIANT_GETVALUEREF(p
->GetValue(), wxPoint
);
362 wxSize
GetPropertyValueAsSize( wxPGPropArg id
) const
364 wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxT("wxSize"), wxSize())
365 return WX_PG_VARIANT_GETVALUEREF(p
->GetValue(), wxSize
);
368 wxLongLong_t
GetPropertyValueAsLongLong( wxPGPropArg id
) const
370 wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL_WFALLBACK(wxT("wxLongLong"), (long) GetPropertyValueAsLong(id
))
371 return WX_PG_VARIANT_GETVALUEREF(p
->GetValue(), wxLongLong
).GetValue();
374 wxULongLong_t
GetPropertyValueAsULongLong( wxPGPropArg id
) const
376 wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL_WFALLBACK(wxT("wxULongLong"), (unsigned long) GetPropertyValueAsULong(id
))
377 return WX_PG_VARIANT_GETVALUEREF(p
->GetValue(), wxULongLong
).GetValue();
380 wxArrayInt
GetPropertyValueAsArrayInt( wxPGPropArg id
) const
382 wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxT("wxArrayInt"), wxArrayInt())
383 wxArrayInt arr
= WX_PG_VARIANT_GETVALUEREF(p
->GetValue(), wxArrayInt
);
387 wxDateTime
GetPropertyValueAsDateTime( wxPGPropArg id
) const
389 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxDateTime())
391 if ( wxStrcmp(p
->m_value
.GetType(), wxT("datetime")) != 0 )
393 wxPGGetFailed(p
, wxT("datetime"));
396 return p
->m_value
.GetDateTime();
399 /** Returns a wxVariant list containing wxVariant versions of all
400 property values. Order is not guaranteed.
402 Use wxPG_KEEP_STRUCTURE to retain category structure; each sub
403 category will be its own wxVariantList of wxVariant.
404 Use wxPG_INC_ATTRIBUTES to include property attributes as well.
405 Each attribute will be stored as list variant named "@@<propname>@@attr."
408 wxVariant
GetPropertyValues( const wxString
& listname
= wxEmptyString
,
409 wxPGProperty
* baseparent
= NULL
, long flags
= 0 ) const
411 return m_pState
->DoGetPropertyValues(listname
, baseparent
, flags
);
414 wxString
GetPropertyValueType( wxPGPropArg id
)
416 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString
)
417 return p
->GetValueType();
420 /** Returns currently selected property. */
421 wxPGProperty
* GetSelection() const
423 return m_pState
->GetSelection();
426 /** Similar to GetIterator(), but instead returns wxPGVIterator instance,
427 which can be useful for forward-iterating through arbitrary property
431 See @ref propgrid_iterator_flags.
433 virtual wxPGVIterator
GetVIterator( int flags
) const;
435 /** Hides or reveals a property.
437 If true, hides property, otherwise reveals it.
439 By default changes are applied recursively. Set this paramter wxPG_DONT_RECURSE to prevent this.
441 bool HideProperty( wxPGPropArg id
, bool hide
= true, int flags
= wxPG_RECURSE
);
443 /** Initializes *all* property types. Causes references to most object
444 files in the library, so calling this may cause significant increase
445 in executable size when linking with static library.
447 static void InitAllTypeHandlers();
450 /** Inserts property to the property container.
453 New property is inserted just prior to this. Available only
454 in the first variant. There are two versions of this function
455 to allow this parameter to be either an id or name to
459 Pointer to the inserted property. wxPropertyGrid will take
460 ownership of this object.
463 New property is inserted under this category. Available only
464 in the second variant. There are two versions of this function
465 to allow this parameter to be either an id or name to
469 Index under category. Available only in the second variant.
470 If index is < 0, property is appended in category.
473 Returns id for the property,
477 - wxPropertyGrid takes the ownership of the property pointer.
479 - While Append may be faster way to add items, make note that when
480 both types of data storage (categoric and
481 non-categoric) are active, Insert becomes even more slow. This is
482 especially true if current mode is non-categoric.
489 wxPGProperty* my_cat_id = propertygrid->Append( new wxPropertyCategory("My Category") );
493 // insert into category - using second variant
494 wxPGProperty* my_item_id_1 = propertygrid->Insert( my_cat_id, 0, new wxStringProperty("My String 1") );
496 // insert before to first item - using first variant
497 wxPGProperty* my_item_id_2 = propertygrid->Insert( my_item_id, new wxStringProperty("My String 2") );
502 wxPGProperty
* Insert( wxPGPropArg priorThis
, wxPGProperty
* newproperty
);
503 wxPGProperty
* Insert( wxPGPropArg parent
, int index
, wxPGProperty
* newproperty
);
506 /** Returns true if property is a category. */
507 bool IsPropertyCategory( wxPGPropArg id
) const
509 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
510 return p
->IsCategory();
513 /** Returns true if property is enabled. */
514 bool IsPropertyEnabled( wxPGPropArg id
) const
516 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
517 return (!(p
->GetFlags() & wxPG_PROP_DISABLED
))?true:false;
520 /** Returns true if given property is expanded. Naturally, always returns false
521 for properties that cannot be expanded.
523 bool IsPropertyExpanded( wxPGPropArg id
) const;
525 /** Returns true if property has been modified after value set or modify flag
528 bool IsPropertyModified( wxPGPropArg id
) const
530 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
531 return ( (p
->GetFlags() & wxPG_PROP_MODIFIED
) ? true : false );
534 /** Returns true if property is shown (ie. hideproperty with true not called for it). */
535 bool IsPropertyShown( wxPGPropArg id
) const
537 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
538 return (!(p
->GetFlags() & wxPG_PROP_HIDDEN
))?true:false;
541 /** Returns true if property value is set to unspecified.
543 bool IsPropertyValueUnspecified( wxPGPropArg id
) const
545 wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
546 return p
->IsValueUnspecified();
549 /** Disables (limit = true) or enables (limit = false) wxTextCtrl editor of a property,
550 if it is not the sole mean to edit the value.
552 void LimitPropertyEditing( wxPGPropArg id
, bool limit
= true );
554 /** If state is shown in it's grid, refresh it now.
556 virtual void RefreshGrid();
558 /** Initializes additional property editors (SpinCtrl etc.). Causes references
559 to most object files in the library, so calling this may cause significant increase
560 in executable size when linking with static library.
562 static void RegisterAdditionalEditors();
564 /** Replaces property with id with newly created property. For example,
565 this code replaces existing property named "Flags" with one that
566 will have different set of items:
568 pg->ReplaceProperty("Flags",
569 wxFlagsProperty("Flags", wxPG_LABEL, newItems))
571 For more info, see wxPropertyGrid::Insert.
573 wxPGProperty
* ReplaceProperty( wxPGPropArg id
, wxPGProperty
* property
);
576 /** @anchor propgridinterface_editablestate_flags
578 Flags for wxPropertyGridInterface::SaveEditableState() and
579 wxPropertyGridInterface::RestoreEditableState().
581 enum EditableStateFlags
583 /** Include selected property. */
584 SelectionState
= 0x01,
585 /** Include expanded/collapsed property information. */
586 ExpandedState
= 0x02,
587 /** Include scrolled position. */
588 ScrollPosState
= 0x04,
589 /** Include selected page information. Only applies to wxPropertyGridManager. */
591 /** Include splitter position. Stored for each page. */
592 SplitterPosState
= 0x10,
594 /** Include all supported user editable state information. This is usually the default value. */
595 AllStates
= SelectionState
| ExpandedState
| ScrollPosState
| PageState
| SplitterPosState
598 /** Restores user-editable state. See also wxPropertyGridInterface::SaveEditableState().
601 String generated by SaveEditableState.
604 Which parts to restore from source string. See @ref propgridinterface_editablestate_flags
605 "list of editable state flags".
608 False if there was problem reading the string.
611 If some parts of state (such as scrolled or splitter position) fail to restore correctly,
612 please make sure that you call this function after wxPropertyGrid size has been set
613 (this may sometimes be tricky when sizers are used).
615 bool RestoreEditableState( const wxString
& src
,
616 int restoreStates
= AllStates
);
618 /** Used to acquire user-editable state (selected property, expanded properties, scrolled position,
621 @param includedStates
622 Which parts of state to include. See @ref propgridinterface_editablestate_flags
623 "list of editable state flags".
625 wxString
SaveEditableState( int includedStates
= AllStates
) const;
627 /** Lets user to set the strings listed in the choice dropdown of a wxBoolProperty.
628 Defaults are "True" and "False", so changing them to, say, "Yes" and "No" may
629 be useful in some less technical applications.
631 static void SetBoolChoices( const wxString
& trueChoice
, const wxString
& falseChoice
);
633 /** Sets or clears flag(s) of all properties in given array.
635 Property flags to set or clear.
637 Set to true if you want to clear flag instead of setting them.
639 void SetPropertiesFlag( const wxArrayPGProperty
& srcArr
, wxPGProperty::FlagType flags
,
640 bool inverse
= false );
642 /** Sets an attribute for this property.
644 Text identifier of attribute. See @ref propgrid_property_attributes.
648 Optional. Use wxPG_RECURSE to set the attribute to child properties recursively.
650 void SetPropertyAttribute( wxPGPropArg id
, const wxString
& attrName
, wxVariant value
, long argFlags
= 0 )
652 DoSetPropertyAttribute(id
,attrName
,value
,argFlags
);
655 /** Sets attributes from a wxPGAttributeStorage.
657 void SetPropertyAttributes( wxPGPropArg id
, const wxPGAttributeStorage
& attributes
)
659 wxPG_PROP_ARG_CALL_PROLOG()
660 p
->SetAttributes(attributes
);
663 /** Sets text, bitmap, and colours for given column's cell.
666 - You can set label cell by setting column to 0.
667 - You can use wxPG_LABEL as text to use default text for column.
669 void SetPropertyCell( wxPGPropArg id
,
671 const wxString
& text
= wxEmptyString
,
672 const wxBitmap
& bitmap
= wxNullBitmap
,
673 const wxColour
& fgCol
= wxNullColour
,
674 const wxColour
& bgCol
= wxNullColour
)
676 wxPG_PROP_ARG_CALL_PROLOG()
677 p
->SetCell( column
, new wxPGCell(text
, bitmap
, fgCol
, bgCol
) );
680 /** Sets client data (void*) of a property.
682 This untyped client data has to be deleted manually.
684 void SetPropertyClientData( wxPGPropArg id
, void* clientData
)
686 wxPG_PROP_ARG_CALL_PROLOG()
687 p
->SetClientData(clientData
);
690 /** Sets editor for a property.
693 For builtin editors, use wxPGEditor_X, where X is builtin editor's
694 name (TextCtrl, Choice, etc. see wxPGEditor documentation for full list).
696 For custom editors, use pointer you received from wxPropertyGrid::RegisterEditorClass().
698 void SetPropertyEditor( wxPGPropArg id
, const wxPGEditor
* editor
)
700 wxPG_PROP_ARG_CALL_PROLOG()
701 wxCHECK_RET( editor
, wxT("unknown/NULL editor") );
702 p
->SetEditor(editor
);
706 /** Sets editor control of a property. As editor argument, use
707 editor name string, such as "TextCtrl" or "Choice".
709 void SetPropertyEditor( wxPGPropArg id
, const wxString
& editorName
)
711 SetPropertyEditor(id
,GetEditorByName(editorName
));
714 /** Sets label of a property.
717 - Properties under same parent may have same labels. However,
718 property names must still remain unique.
720 void SetPropertyLabel( wxPGPropArg id
, const wxString
& newproplabel
);
722 /** Set modified status of a property and all its children.
724 void SetPropertyModifiedStatus( wxPGPropArg id
, bool modified
)
726 wxPG_PROP_ARG_CALL_PROLOG()
727 p
->SetModifiedStatus(modified
);
730 /** Sets property (and, recursively, its children) to have read-only value. In other words,
731 user cannot change the value in the editor, but they can still copy it.
733 This is mainly for use with textctrl editor. Not all other editors fully
736 By default changes are applied recursively. Set this paramter wxPG_DONT_RECURSE to prevent this.
738 void SetPropertyReadOnly( wxPGPropArg id
, bool set
= true, int flags
= wxPG_RECURSE
)
740 wxPG_PROP_ARG_CALL_PROLOG()
741 if ( flags
& wxPG_RECURSE
)
742 p
->SetFlagRecursively(wxPG_PROP_READONLY
, set
);
744 p
->SetFlag(wxPG_PROP_READONLY
);
747 /** Sets property's value to unspecified. If it has children (it may be category),
748 then the same thing is done to them.
750 void SetPropertyValueUnspecified( wxPGPropArg id
);
752 /** Sets various property values from a list of wxVariants. If property with
753 name is missing from the grid, new property is created under given default
754 category (or root if omitted).
756 void SetPropertyValues( const wxVariantList
& list
, wxPGPropArg defaultCategory
= wxNullProperty
)
759 if ( defaultCategory
.HasName() ) p
= defaultCategory
.GetPtr(this);
760 else p
= defaultCategory
.GetPtr0();
761 m_pState
->DoSetPropertyValues(list
, p
);
764 void SetPropertyValues( const wxVariant
& list
, wxPGPropArg defaultCategory
= wxNullProperty
)
766 SetPropertyValues(list
.GetList(),defaultCategory
);
769 /** Associates the help string with property.
771 By default, text is shown either in the manager's "description"
772 text box or in the status bar. If extra window style wxPG_EX_HELP_AS_TOOLTIPS
773 is used, then the text will appear as a tooltip.
775 void SetPropertyHelpString( wxPGPropArg id
, const wxString
& helpString
)
777 wxPG_PROP_ARG_CALL_PROLOG()
778 p
->SetHelpString(helpString
);
781 /** Set wxBitmap in front of the value.
783 - Bitmap will be scaled to a size returned by wxPropertyGrid::GetImageSize();
785 void SetPropertyImage( wxPGPropArg id
, wxBitmap
& bmp
)
787 wxPG_PROP_ARG_CALL_PROLOG()
788 p
->SetValueImage(bmp
);
792 /** Sets max length of property's text.
794 bool SetPropertyMaxLength( wxPGPropArg id
, int maxLen
);
796 /** Sets validator of a property.
798 void SetPropertyValidator( wxPGPropArg id
, const wxValidator
& validator
)
800 wxPG_PROP_ARG_CALL_PROLOG()
801 p
->SetValidator(validator
);
804 /** Sets value (long integer) of a property.
806 void SetPropertyValue( wxPGPropArg id
, long value
)
812 /** Sets value (integer) of a property.
814 void SetPropertyValue( wxPGPropArg id
, int value
)
816 wxVariant
v((long)value
);
819 /** Sets value (floating point) of a property.
821 void SetPropertyValue( wxPGPropArg id
, double value
)
826 /** Sets value (bool) of a property.
828 void SetPropertyValue( wxPGPropArg id
, bool value
)
833 void SetPropertyValue( wxPGPropArg id
, const wxChar
* value
)
835 SetPropertyValueString( id
, wxString(value
) );
837 void SetPropertyValue( wxPGPropArg id
, const wxString
& value
)
839 SetPropertyValueString( id
, value
);
842 /** Sets value (wxArrayString) of a property.
844 void SetPropertyValue( wxPGPropArg id
, const wxArrayString
& value
)
850 void SetPropertyValue( wxPGPropArg id
, const wxDateTime
& value
)
856 /** Sets value (wxObject*) of a property.
858 void SetPropertyValue( wxPGPropArg id
, wxObject
* value
)
864 void SetPropertyValue( wxPGPropArg id
, wxObject
& value
)
870 /** Sets value (wxPoint&) of a property.
872 void SetPropertyValue( wxPGPropArg id
, const wxPoint
& value
)
874 wxVariant v
= WXVARIANT(value
);
877 /** Sets value (wxSize&) of a property.
879 void SetPropertyValue( wxPGPropArg id
, const wxSize
& value
)
881 wxVariant v
= WXVARIANT(value
);
884 /** Sets value (wxLongLong&) of a property.
886 void SetPropertyValue( wxPGPropArg id
, wxLongLong_t value
)
888 wxVariant v
= WXVARIANT(wxLongLong(value
));
891 /** Sets value (wxULongLong&) of a property.
893 void SetPropertyValue( wxPGPropArg id
, wxULongLong_t value
)
895 wxVariant v
= WXVARIANT(wxULongLong(value
));
898 /** Sets value (wxArrayInt&) of a property.
900 void SetPropertyValue( wxPGPropArg id
, const wxArrayInt
& value
)
902 wxVariant v
= WXVARIANT(value
);
906 /** Sets value (wxString) of a property.
909 This method uses wxPGProperty::SetValueFromString, which all properties
910 should implement. This means that there should not be a type error,
911 and instead the string is converted to property's actual value type.
913 void SetPropertyValueString( wxPGPropArg id
, const wxString
& value
);
915 /** Sets value (wxVariant&) of a property.
918 Use wxPropertyGrid::ChangePropertyValue() instead if you need to run through
919 validation process and send property change event.
921 void SetPropertyValue( wxPGPropArg id
, wxVariant value
)
923 SetPropVal( id
, value
);
926 /** Adjusts how wxPropertyGrid behaves when invalid value is entered
929 See @link vfbflags list of valid flags values@endlink
931 void SetValidationFailureBehavior( int vfbFlags
);
933 // GetPropertyByName With nice assertion error message.
934 wxPGProperty
* GetPropertyByNameA( const wxString
& name
) const;
936 static wxPGEditor
* GetEditorByName( const wxString
& editorName
);
938 virtual void RefreshProperty( wxPGProperty
* p
) = 0;