2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2011-03-19 20:14:35 -04:00
|
|
|
// Name: wx/propgrid/propgridiface.h
|
2008-09-12 16:57:41 -04:00
|
|
|
// Purpose: wxPropertyGridInterface class
|
|
|
|
// Author: Jaakko Salli
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2008-08-24
|
|
|
|
// Copyright: (c) Jaakko Salli
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-09-12 16:57:41 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __WX_PROPGRID_PROPGRIDIFACE_H__
|
|
|
|
#define __WX_PROPGRID_PROPGRIDIFACE_H__
|
|
|
|
|
2019-08-15 20:27:07 -04:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2008-09-17 11:00:00 -04:00
|
|
|
#if wxUSE_PROPGRID
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
#include "wx/propgrid/property.h"
|
|
|
|
#include "wx/propgrid/propgridpagestate.h"
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Most property grid functions have this type as their argument, as it can
|
|
|
|
// convey a property by either a pointer or name.
|
2008-09-12 16:57:41 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxPGPropArgCls
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
wxPGPropArgCls( const wxPGProperty* property )
|
|
|
|
{
|
2020-02-03 01:50:32 -05:00
|
|
|
m_ptr.property = const_cast<wxPGProperty*>(property);
|
2008-09-14 12:48:20 -04:00
|
|
|
m_flags = IsProperty;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
wxPGPropArgCls( const wxString& str )
|
|
|
|
{
|
2008-09-14 12:48:20 -04:00
|
|
|
m_ptr.stringName = &str;
|
|
|
|
m_flags = IsWxString;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
wxPGPropArgCls( const wxPGPropArgCls& id )
|
|
|
|
{
|
|
|
|
m_ptr = id.m_ptr;
|
2008-09-14 12:48:20 -04:00
|
|
|
m_flags = id.m_flags;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
2016-06-25 12:17:56 -04:00
|
|
|
// This is only needed for wxPython bindings.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGPropArgCls( wxString* str, bool WXUNUSED(deallocPtr) )
|
|
|
|
{
|
2008-09-14 12:48:20 -04:00
|
|
|
m_ptr.stringName = str;
|
|
|
|
m_flags = IsWxString | OwnsWxString;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
~wxPGPropArgCls()
|
|
|
|
{
|
2008-09-14 12:48:20 -04:00
|
|
|
if ( m_flags & OwnsWxString )
|
|
|
|
delete m_ptr.stringName;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
wxPGProperty* GetPtr() const
|
|
|
|
{
|
2008-09-14 12:48:20 -04:00
|
|
|
wxCHECK( m_flags == IsProperty, NULL );
|
2008-09-12 16:57:41 -04:00
|
|
|
return m_ptr.property;
|
|
|
|
}
|
2008-09-14 12:48:20 -04:00
|
|
|
wxPGPropArgCls( const char* str )
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
2008-09-14 12:48:20 -04:00
|
|
|
m_ptr.charName = str;
|
|
|
|
m_flags = IsCharPtr;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
2008-09-14 12:48:20 -04:00
|
|
|
wxPGPropArgCls( const wchar_t* str )
|
|
|
|
{
|
|
|
|
m_ptr.wcharName = str;
|
|
|
|
m_flags = IsWCharPtr;
|
|
|
|
}
|
2016-06-25 12:17:56 -04:00
|
|
|
// This constructor is required for NULL.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGPropArgCls( int )
|
|
|
|
{
|
2009-01-19 08:55:27 -05:00
|
|
|
m_ptr.property = NULL;
|
2008-09-14 12:48:20 -04:00
|
|
|
m_flags = IsProperty;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
2008-09-14 12:48:20 -04:00
|
|
|
wxPGProperty* GetPtr( wxPropertyGridInterface* iface ) const;
|
|
|
|
wxPGProperty* GetPtr( const wxPropertyGridInterface* iface ) const
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
2019-06-16 11:09:23 -04:00
|
|
|
return GetPtr(const_cast<wxPropertyGridInterface*>(iface));
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
wxPGProperty* GetPtr0() const { return m_ptr.property; }
|
2008-09-14 12:48:20 -04:00
|
|
|
bool HasName() const { return (m_flags != IsProperty); }
|
|
|
|
const wxString& GetName() const { return *m_ptr.stringName; }
|
2008-09-12 16:57:41 -04:00
|
|
|
private:
|
2008-09-14 12:48:20 -04:00
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
IsProperty = 0x00,
|
|
|
|
IsWxString = 0x01,
|
|
|
|
IsCharPtr = 0x02,
|
|
|
|
IsWCharPtr = 0x04,
|
2009-01-31 23:48:19 -05:00
|
|
|
OwnsWxString = 0x10
|
2008-09-14 12:48:20 -04:00
|
|
|
};
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
union
|
|
|
|
{
|
|
|
|
wxPGProperty* property;
|
2008-09-14 12:48:20 -04:00
|
|
|
const char* charName;
|
|
|
|
const wchar_t* wcharName;
|
|
|
|
const wxString* stringName;
|
2008-09-12 16:57:41 -04:00
|
|
|
} m_ptr;
|
2008-09-14 12:48:20 -04:00
|
|
|
unsigned char m_flags;
|
2008-09-12 16:57:41 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef const wxPGPropArgCls& wxPGPropArg;
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
WXDLLIMPEXP_PROPGRID
|
|
|
|
void wxPGTypeOperationFailed( const wxPGProperty* p,
|
2008-09-16 11:55:53 -04:00
|
|
|
const wxString& typestr,
|
|
|
|
const wxString& op );
|
2008-09-12 16:57:41 -04:00
|
|
|
WXDLLIMPEXP_PROPGRID
|
2008-09-16 11:55:53 -04:00
|
|
|
void wxPGGetFailed( const wxPGProperty* p, const wxString& typestr );
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Helper macro that does necessary preparations when calling
|
|
|
|
// some wxPGProperty's member function.
|
|
|
|
#define wxPG_PROP_ARG_CALL_PROLOG_0(PROPERTY) \
|
|
|
|
PROPERTY *p = (PROPERTY*)id.GetPtr(this); \
|
|
|
|
if ( !p ) return;
|
|
|
|
|
|
|
|
#define wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(PROPERTY, RETVAL) \
|
|
|
|
PROPERTY *p = (PROPERTY*)id.GetPtr(this); \
|
|
|
|
if ( !p ) return RETVAL;
|
|
|
|
|
|
|
|
#define wxPG_PROP_ARG_CALL_PROLOG() \
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_0(wxPGProperty)
|
|
|
|
|
|
|
|
#define wxPG_PROP_ARG_CALL_PROLOG_RETVAL(RVAL) \
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(wxPGProperty, RVAL)
|
|
|
|
|
|
|
|
#define wxPG_PROP_ID_CONST_CALL_PROLOG() \
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_0(const wxPGProperty)
|
|
|
|
|
|
|
|
#define wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(RVAL) \
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL_0(const wxPGProperty, RVAL)
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Most of the shared property manipulation interface shared by wxPropertyGrid,
|
|
|
|
// wxPropertyGridPage, and wxPropertyGridManager is defined in this class.
|
|
|
|
// In separate wxPropertyGrid component this class was known as
|
|
|
|
// wxPropertyContainerMethods.
|
|
|
|
// wxPropertyGridInterface's property operation member functions all accept
|
|
|
|
// a special wxPGPropArg id argument, using which you can refer to properties
|
|
|
|
// either by their pointer (for performance) or by their name (for conveniency).
|
2008-09-12 16:57:41 -04:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxPropertyGridInterface
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Destructor.
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual ~wxPropertyGridInterface() { }
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Appends property to the list.
|
|
|
|
// wxPropertyGrid assumes ownership of the object.
|
|
|
|
// Becomes child of most recently added category.
|
|
|
|
// wxPropertyGrid takes the ownership of the property pointer.
|
|
|
|
// If appending a category with name identical to a category already in
|
|
|
|
// the wxPropertyGrid, then newly created category is deleted, and most
|
|
|
|
// recently added category (under which properties are appended) is set
|
|
|
|
// to the one with same name. This allows easier adding of items to same
|
|
|
|
// categories in multiple passes.
|
|
|
|
// Does not automatically redraw the control, so you may need to call
|
|
|
|
// Refresh when calling this function after control has been shown for
|
|
|
|
// the first time.
|
|
|
|
// This functions deselects selected property, if any. Validation
|
|
|
|
// failure option wxPG_VFB_STAY_IN_PROPERTY is not respected, ie.
|
|
|
|
// selection is cleared even if editor had invalid value.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* Append( wxPGProperty* property );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Same as Append(), but appends under given parent property.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* AppendIn( wxPGPropArg id, wxPGProperty* newproperty );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// In order to add new items into a property with fixed children (for
|
|
|
|
// instance, wxFlagsProperty), you need to call this method. After
|
|
|
|
// populating has been finished, you need to call EndAddChildren.
|
2008-09-12 16:57:41 -04:00
|
|
|
void BeginAddChildren( wxPGPropArg id );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Deletes all properties.
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual void Clear() = 0;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Clears current selection, if any.
|
|
|
|
// validation - If set to false, deselecting the property will always work,
|
|
|
|
// even if its editor had invalid value in it.
|
|
|
|
// Returns true if successful or if there was no selection. May
|
|
|
|
// fail if validation was enabled and active editor had invalid
|
|
|
|
// value.
|
2009-08-11 12:53:05 -04:00
|
|
|
bool ClearSelection( bool validation = false );
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Resets modified status of all properties.
|
2008-10-02 11:36:24 -04:00
|
|
|
void ClearModifiedStatus();
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Collapses given category or property with children.
|
|
|
|
// Returns true if actually collapses.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool Collapse( wxPGPropArg id );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Collapses all items that can be collapsed.
|
|
|
|
// Return false if failed (may fail if editor value cannot be validated).
|
2008-09-12 16:57:41 -04:00
|
|
|
bool CollapseAll() { return ExpandAll(false); }
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Changes value of a property, as if from an editor.
|
|
|
|
// Use this instead of SetPropertyValue() if you need the value to run
|
|
|
|
// through validation process, and also send the property change event.
|
|
|
|
// Returns true if value was successfully changed.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Removes and deletes a property and any children.
|
|
|
|
// id - Pointer or name of a property.
|
|
|
|
// If you delete a property in a wxPropertyGrid event
|
|
|
|
// handler, the actual deletion is postponed until the next
|
|
|
|
// idle event.
|
|
|
|
// This functions deselects selected property, if any.
|
|
|
|
// Validation failure option wxPG_VFB_STAY_IN_PROPERTY is not
|
|
|
|
// respected, ie. selection is cleared even if editor had
|
|
|
|
// invalid value.
|
2008-09-12 16:57:41 -04:00
|
|
|
void DeleteProperty( wxPGPropArg id );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Removes a property. Does not delete the property object, but
|
|
|
|
// instead returns it.
|
|
|
|
// id - Pointer or name of a property.
|
|
|
|
// Removed property cannot have any children.
|
|
|
|
// Also, if you remove property in a wxPropertyGrid event
|
|
|
|
// handler, the actual removal is postponed until the next
|
|
|
|
// idle event.
|
2008-12-11 12:11:35 -05:00
|
|
|
wxPGProperty* RemoveProperty( wxPGPropArg id );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Disables a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool DisableProperty( wxPGPropArg id ) { return EnableProperty(id,false); }
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if all property grid data changes have been committed.
|
|
|
|
// Usually only returns false if value in active editor has been
|
|
|
|
// invalidated by a wxValidator.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool EditorValidate();
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Enables or disables property, depending on whether enable is true or
|
|
|
|
// false. Disabled property usually appears as having grey text.
|
|
|
|
// id - Name or pointer to a property.
|
|
|
|
// enable - If false, property is disabled instead.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool EnableProperty( wxPGPropArg id, bool enable = true );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Called after population of property with fixed children has finished.
|
2008-09-12 16:57:41 -04:00
|
|
|
void EndAddChildren( wxPGPropArg id );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Expands given category or property with children.
|
|
|
|
// Returns true if actually expands.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool Expand( wxPGPropArg id );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Expands all items that can be expanded.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool ExpandAll( bool expand = true );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns id of first child of given property.
|
|
|
|
// Does not return sub-properties!
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetFirstChild( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
|
|
|
|
|
|
|
|
if ( !p->GetChildCount() || p->HasFlag(wxPG_PROP_AGGREGATE) )
|
|
|
|
return wxNullProperty;
|
|
|
|
|
|
|
|
return p->Item(0);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns iterator class instance.
|
|
|
|
// flags - See wxPG_ITERATOR_FLAGS. Value wxPG_ITERATE_DEFAULT causes
|
|
|
|
// iteration over everything except private child properties.
|
|
|
|
// firstProp - Property to start iteration from. If NULL, then first
|
|
|
|
// child of root is used.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPropertyGridIterator GetIterator( int flags = wxPG_ITERATE_DEFAULT,
|
|
|
|
wxPGProperty* firstProp = NULL )
|
|
|
|
{
|
|
|
|
return wxPropertyGridIterator( m_pState, flags, firstProp );
|
|
|
|
}
|
|
|
|
|
|
|
|
wxPropertyGridConstIterator
|
|
|
|
GetIterator( int flags = wxPG_ITERATE_DEFAULT,
|
|
|
|
wxPGProperty* firstProp = NULL ) const
|
|
|
|
{
|
|
|
|
return wxPropertyGridConstIterator( m_pState, flags, firstProp );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns iterator class instance.
|
|
|
|
// flags - See wxPG_ITERATOR_FLAGS. Value wxPG_ITERATE_DEFAULT causes
|
|
|
|
// iteration over everything except private child properties.
|
|
|
|
// startPos - Either wxTOP or wxBOTTOM. wxTOP will indicate that iterations start
|
|
|
|
// from the first property from the top, and wxBOTTOM means that the
|
|
|
|
// iteration will instead begin from bottommost valid item.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPropertyGridIterator GetIterator( int flags, int startPos )
|
|
|
|
{
|
|
|
|
return wxPropertyGridIterator( m_pState, flags, startPos );
|
|
|
|
}
|
|
|
|
|
|
|
|
wxPropertyGridConstIterator GetIterator( int flags, int startPos ) const
|
|
|
|
{
|
|
|
|
return wxPropertyGridConstIterator( m_pState, flags, startPos );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns id of first item that matches given criteria.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL )
|
|
|
|
{
|
|
|
|
wxPropertyGridIterator it( m_pState, flags, wxNullProperty, 1 );
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
|
|
|
|
const wxPGProperty* GetFirst( int flags = wxPG_ITERATE_ALL ) const
|
|
|
|
{
|
2019-06-29 04:33:32 -04:00
|
|
|
return const_cast<wxPropertyGridInterface*>(this)->GetFirst(flags);
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns pointer to a property with given name (case-sensitive).
|
|
|
|
// If there is no property with such name, NULL pointer is returned.
|
|
|
|
// Properties which have non-category, non-root parent
|
|
|
|
// cannot be accessed globally by their name. Instead, use
|
|
|
|
// "<property>.<subproperty>" instead of "<subproperty>".
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetProperty( const wxString& name ) const
|
|
|
|
{
|
|
|
|
return GetPropertyByName(name);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns map-like storage of property's attributes.
|
|
|
|
// Note that if extra style wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES is set,
|
|
|
|
// then builtin-attributes are not included in the storage.
|
2008-09-12 16:57:41 -04:00
|
|
|
const wxPGAttributeStorage& GetPropertyAttributes( wxPGPropArg id ) const
|
|
|
|
{
|
2008-11-15 05:34:36 -05:00
|
|
|
// If 'id' refers to invalid property, then we will return dummy
|
2021-10-02 14:46:08 -04:00
|
|
|
// attributes (i.e. root property's attributes, which contents
|
2008-11-15 05:34:36 -05:00
|
|
|
// should always be empty and of no consequence).
|
2019-07-21 09:15:36 -04:00
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_pState->DoGetRoot()->GetAttributes())
|
2008-09-12 16:57:41 -04:00
|
|
|
return p->GetAttributes();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Adds to 'targetArr' pointers to properties that have given
|
|
|
|
// flags 'flags' set. However, if 'inverse' is set to true, then
|
|
|
|
// only properties without given flags are stored.
|
|
|
|
// flags - Property flags to use.
|
|
|
|
// iterFlags - Iterator flags to use. Default is everything expect private children.
|
2008-09-12 16:57:41 -04:00
|
|
|
void GetPropertiesWithFlag( wxArrayPGProperty* targetArr,
|
|
|
|
wxPGProperty::FlagType flags,
|
|
|
|
bool inverse = false,
|
|
|
|
int iterFlags = wxPG_ITERATE_PROPERTIES |
|
|
|
|
wxPG_ITERATE_HIDDEN |
|
|
|
|
wxPG_ITERATE_CATEGORIES) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns value of given attribute. If none found, returns wxNullVariant.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxVariant GetPropertyAttribute( wxPGPropArg id,
|
|
|
|
const wxString& attrName ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullVariant)
|
|
|
|
return p->GetAttribute(attrName);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns pointer of property's nearest parent category. If no category
|
|
|
|
// found, returns NULL.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPropertyCategory* GetPropertyCategory( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ID_CONST_CALL_PROLOG_RETVAL(NULL)
|
|
|
|
return m_pState->GetPropertyCategory(p);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns client data (void*) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void* GetPropertyClientData( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
|
|
|
|
return p->GetClientData();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns first property which label matches given string.
|
|
|
|
// NULL if none found. Note that this operation is extremely slow when
|
|
|
|
// compared to GetPropertyByName().
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetPropertyByLabel( const wxString& label ) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns pointer to a property with given name (case-sensitive).
|
|
|
|
// If there is no property with such name, @NULL pointer is returned.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetPropertyByName( const wxString& name ) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns child property 'subname' of property 'name'. Same as
|
|
|
|
// calling GetPropertyByName("name.subname"), albeit slightly faster.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetPropertyByName( const wxString& name,
|
|
|
|
const wxString& subname ) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns property's editor.
|
2008-09-12 16:57:41 -04:00
|
|
|
const wxPGEditor* GetPropertyEditor( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
|
|
|
|
return p->GetEditorClass();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns help string associated with a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxString GetPropertyHelpString( wxPGPropArg id ) const
|
|
|
|
{
|
2015-07-16 15:00:38 -04:00
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxEmptyString)
|
2008-09-12 16:57:41 -04:00
|
|
|
return p->GetHelpString();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns property's custom value image (NULL of none).
|
2008-09-12 16:57:41 -04:00
|
|
|
wxBitmap* GetPropertyImage( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
|
|
|
|
return p->GetValueImage();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns label of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
const wxString& GetPropertyLabel( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(m_emptyString)
|
|
|
|
return p->GetLabel();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns name of a property, by which it is globally accessible.
|
2008-09-27 11:09:33 -04:00
|
|
|
wxString GetPropertyName( wxPGProperty* property )
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
2008-09-27 11:09:33 -04:00
|
|
|
return property->GetName();
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns parent item of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetPropertyParent( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxNullProperty)
|
|
|
|
return p->GetParent();
|
|
|
|
}
|
|
|
|
|
|
|
|
#if wxUSE_VALIDATORS
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns validator of a property as a reference, which you
|
|
|
|
// can pass to any number of SetPropertyValidator.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxValidator* GetPropertyValidator( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(NULL)
|
|
|
|
return p->GetValidator();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns value as wxVariant. To get wxObject pointer from it,
|
|
|
|
// you will have to use WX_PG_VARIANT_TO_WXOBJECT(VARIANT,CLASSNAME) macro.
|
|
|
|
// If property value is unspecified, wxNullVariant is returned.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxVariant GetPropertyValue( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxVariant())
|
|
|
|
return p->GetValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
wxString GetPropertyValueAsString( wxPGPropArg id ) const;
|
|
|
|
long GetPropertyValueAsLong( wxPGPropArg id ) const;
|
|
|
|
unsigned long GetPropertyValueAsULong( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
return (unsigned long) GetPropertyValueAsLong(id);
|
|
|
|
}
|
|
|
|
int GetPropertyValueAsInt( wxPGPropArg id ) const
|
|
|
|
{ return (int)GetPropertyValueAsLong(id); }
|
|
|
|
bool GetPropertyValueAsBool( wxPGPropArg id ) const;
|
|
|
|
double GetPropertyValueAsDouble( wxPGPropArg id ) const;
|
|
|
|
|
2015-04-03 15:09:13 -04:00
|
|
|
#define wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(PGTypeName, DEFVAL) \
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFVAL) \
|
2008-09-16 11:55:53 -04:00
|
|
|
wxVariant value = p->GetValue(); \
|
2015-04-03 15:09:13 -04:00
|
|
|
if ( !value.IsType(PGTypeName) ) \
|
2008-09-12 16:57:41 -04:00
|
|
|
{ \
|
2015-04-03 15:09:13 -04:00
|
|
|
wxPGGetFailed(p, PGTypeName); \
|
2008-09-12 16:57:41 -04:00
|
|
|
return DEFVAL; \
|
|
|
|
}
|
|
|
|
|
2015-04-03 15:09:13 -04:00
|
|
|
#define wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL_WFALLBACK(PGTypeName, DEFVAL) \
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(DEFVAL) \
|
2008-09-16 11:55:53 -04:00
|
|
|
wxVariant value = p->GetValue(); \
|
2015-04-03 15:09:13 -04:00
|
|
|
if ( !value.IsType(PGTypeName) ) \
|
2008-09-12 16:57:41 -04:00
|
|
|
return DEFVAL; \
|
|
|
|
|
|
|
|
wxArrayString GetPropertyValueAsArrayString( wxPGPropArg id ) const
|
|
|
|
{
|
2015-04-03 15:09:13 -04:00
|
|
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_ARRSTRING,
|
2008-09-12 16:57:41 -04:00
|
|
|
wxArrayString())
|
2008-09-16 11:55:53 -04:00
|
|
|
return value.GetArrayString();
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
2015-04-03 15:12:19 -04:00
|
|
|
#if defined(wxLongLong_t) && wxUSE_LONGLONG
|
2008-09-12 16:57:41 -04:00
|
|
|
wxLongLong_t GetPropertyValueAsLongLong( wxPGPropArg id ) const
|
|
|
|
{
|
2009-06-15 18:43:27 -04:00
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
|
|
|
|
return p->GetValue().GetLongLong().GetValue();
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
wxULongLong_t GetPropertyValueAsULongLong( wxPGPropArg id ) const
|
|
|
|
{
|
2009-06-15 18:43:27 -04:00
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(0)
|
|
|
|
return p->GetValue().GetULongLong().GetValue();
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
2008-09-27 11:13:12 -04:00
|
|
|
#endif
|
2008-09-12 16:57:41 -04:00
|
|
|
|
|
|
|
wxArrayInt GetPropertyValueAsArrayInt( wxPGPropArg id ) const
|
|
|
|
{
|
2015-04-03 15:09:13 -04:00
|
|
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxArrayInt_VariantType,
|
2008-09-12 16:57:41 -04:00
|
|
|
wxArrayInt())
|
2008-09-16 11:55:53 -04:00
|
|
|
wxArrayInt arr;
|
|
|
|
arr << value;
|
2008-09-12 16:57:41 -04:00
|
|
|
return arr;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if wxUSE_DATETIME
|
|
|
|
wxDateTime GetPropertyValueAsDateTime( wxPGPropArg id ) const
|
|
|
|
{
|
2015-04-03 15:09:13 -04:00
|
|
|
wxPG_PROP_ID_GETPROPVAL_CALL_PROLOG_RETVAL(wxPG_VARIANT_TYPE_DATETIME,
|
2008-09-16 11:55:53 -04:00
|
|
|
wxDateTime())
|
|
|
|
return value.GetDateTime();
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns a wxVariant list containing wxVariant versions of all
|
|
|
|
// property values. Order is not guaranteed.
|
|
|
|
// flags - Use wxPG_KEEP_STRUCTURE to retain category structure; each sub
|
|
|
|
// category will be its own wxVariantList of wxVariant.
|
|
|
|
// Use wxPG_INC_ATTRIBUTES to include property attributes as well.
|
|
|
|
// Each attribute will be stored as list variant named
|
2017-03-27 12:54:16 -04:00
|
|
|
// "@<propname>@attr."
|
2008-09-12 16:57:41 -04:00
|
|
|
wxVariant GetPropertyValues( const wxString& listname = wxEmptyString,
|
|
|
|
wxPGProperty* baseparent = NULL, long flags = 0 ) const
|
|
|
|
{
|
|
|
|
return m_pState->DoGetPropertyValues(listname, baseparent, flags);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns currently selected property. NULL if none.
|
|
|
|
// When wxPG_EX_MULTIPLE_SELECTION extra style is used, this
|
|
|
|
// member function returns the focused property, that is the
|
|
|
|
// one which can have active editor.
|
2009-08-17 14:36:00 -04:00
|
|
|
wxPGProperty* GetSelection() const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns list of currently selected properties.
|
|
|
|
// wxArrayPGProperty should be compatible with std::vector API.
|
2009-08-17 14:36:00 -04:00
|
|
|
const wxArrayPGProperty& GetSelectedProperties() const
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
2009-08-17 14:36:00 -04:00
|
|
|
return m_pState->m_selection;
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
wxPropertyGridPageState* GetState() const { return m_pState; }
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Similar to GetIterator(), but instead returns wxPGVIterator instance,
|
|
|
|
// which can be useful for forward-iterating through arbitrary property
|
|
|
|
// containers.
|
|
|
|
// flags - See wxPG_ITERATOR_FLAGS.
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual wxPGVIterator GetVIterator( int flags ) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Hides or reveals a property.
|
|
|
|
// hide - If true, hides property, otherwise reveals it.
|
2020-06-27 14:19:59 -04:00
|
|
|
// flags - By default changes are applied recursively. Set this parameter
|
2016-06-25 12:17:56 -04:00
|
|
|
// wxPG_DONT_RECURSE to prevent this.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool HideProperty( wxPGPropArg id,
|
|
|
|
bool hide = true,
|
|
|
|
int flags = wxPG_RECURSE );
|
|
|
|
|
|
|
|
#if wxPG_INCLUDE_ADVPROPS
|
2016-06-25 12:17:56 -04:00
|
|
|
// Initializes *all* property types. Causes references to most object
|
|
|
|
// files in the library, so calling this may cause significant increase
|
|
|
|
// in executable size when linking with static library.
|
2008-09-12 16:57:41 -04:00
|
|
|
static void InitAllTypeHandlers();
|
|
|
|
#else
|
|
|
|
static void InitAllTypeHandlers() { }
|
|
|
|
#endif
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Inserts property to the property container.
|
|
|
|
// priorThis - New property is inserted just prior to this. Available only
|
|
|
|
// in the first variant. There are two versions of this function
|
|
|
|
// to allow this parameter to be either an id or name to
|
|
|
|
// a property.
|
|
|
|
// newproperty - Pointer to the inserted property. wxPropertyGrid will take
|
|
|
|
// ownership of this object.
|
|
|
|
// Returns id for the property,
|
|
|
|
// wxPropertyGrid takes the ownership of the property pointer.
|
|
|
|
// While Append may be faster way to add items, make note that when
|
|
|
|
// both types of data storage (categoric and
|
|
|
|
// non-categoric) are active, Insert becomes even more slow. This is
|
|
|
|
// especially true if current mode is non-categoric.
|
|
|
|
// Example of use:
|
|
|
|
// // append category
|
|
|
|
// wxPGProperty* my_cat_id = propertygrid->Append(
|
|
|
|
// new wxPropertyCategory("My Category") );
|
|
|
|
// ...
|
|
|
|
// // insert into category - using second variant
|
|
|
|
// wxPGProperty* my_item_id_1 = propertygrid->Insert(
|
|
|
|
// my_cat_id, 0, new wxStringProperty("My String 1") );
|
|
|
|
// // insert before to first item - using first variant
|
|
|
|
// wxPGProperty* my_item_id_2 = propertygrid->Insert(
|
|
|
|
// my_item_id, new wxStringProperty("My String 2") );
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* Insert( wxPGPropArg priorThis, wxPGProperty* newproperty );
|
2016-06-25 12:17:56 -04:00
|
|
|
|
|
|
|
// Inserts property to the property container.
|
|
|
|
//See the other overload for more details.
|
|
|
|
// parent - New property is inserted under this category. Available only
|
|
|
|
// in the second variant. There are two versions of this function
|
|
|
|
// to allow this parameter to be either an id or name to
|
|
|
|
// a property.
|
|
|
|
// index - Index under category. Available only in the second variant.
|
|
|
|
// If index is < 0, property is appended in category.
|
|
|
|
// newproperty - Pointer to the inserted property. wxPropertyGrid will take
|
|
|
|
// ownership of this object.
|
|
|
|
// Returns id for the property.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* Insert( wxPGPropArg parent,
|
|
|
|
int index,
|
|
|
|
wxPGProperty* newproperty );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if property is a category.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool IsPropertyCategory( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
|
|
|
return p->IsCategory();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if property is enabled.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool IsPropertyEnabled( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
2015-01-31 16:42:17 -05:00
|
|
|
return !p->HasFlag(wxPG_PROP_DISABLED);
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if given property is expanded.
|
|
|
|
// Naturally, always returns false for properties that cannot be expanded.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool IsPropertyExpanded( wxPGPropArg id ) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if property has been modified after value set or modify
|
|
|
|
// flag clear by software.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool IsPropertyModified( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
2015-01-31 16:42:17 -05:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
return p->HasFlag(wxPG_PROP_MODIFIED)?true:false;
|
|
|
|
#else
|
|
|
|
return p->HasFlag(wxPG_PROP_MODIFIED);
|
|
|
|
#endif
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if property is selected.
|
2009-08-17 14:36:00 -04:00
|
|
|
bool IsPropertySelected( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
|
|
|
return m_pState->DoIsPropertySelected(p);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if property is shown (i.e. HideProperty with true not
|
|
|
|
// called for it).
|
2008-09-12 16:57:41 -04:00
|
|
|
bool IsPropertyShown( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
2015-01-31 16:42:17 -05:00
|
|
|
return !p->HasFlag(wxPG_PROP_HIDDEN);
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns true if property value is set to unspecified.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool IsPropertyValueUnspecified( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
|
|
|
return p->IsValueUnspecified();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Disables (limit = true) or enables (limit = false) wxTextCtrl editor
|
|
|
|
// of a property, if it is not the sole mean to edit the value.
|
2008-09-12 16:57:41 -04:00
|
|
|
void LimitPropertyEditing( wxPGPropArg id, bool limit = true );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// If state is shown in it's grid, refresh it now.
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual void RefreshGrid( wxPropertyGridPageState* state = NULL );
|
|
|
|
|
|
|
|
#if wxPG_INCLUDE_ADVPROPS
|
2016-06-25 12:17:56 -04:00
|
|
|
// Initializes additional property editors (SpinCtrl etc.). Causes
|
|
|
|
// references to most object files in the library, so calling this may
|
|
|
|
// cause significant increase in executable size when linking with static
|
|
|
|
// library.
|
2008-09-12 16:57:41 -04:00
|
|
|
static void RegisterAdditionalEditors();
|
|
|
|
#else
|
|
|
|
static void RegisterAdditionalEditors() { }
|
|
|
|
#endif
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Replaces property with id with newly created property. For example,
|
|
|
|
// this code replaces existing property named "Flags" with one that
|
|
|
|
// will have different set of items:
|
|
|
|
// pg->ReplaceProperty("Flags",
|
|
|
|
// wxFlagsProperty("Flags", wxPG_LABEL, newItems))
|
|
|
|
// For more info, see wxPropertyGrid::Insert.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* ReplaceProperty( wxPGPropArg id, wxPGProperty* property );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Flags for wxPropertyGridInterface::SaveEditableState()
|
|
|
|
// and wxPropertyGridInterface::RestoreEditableState().
|
2008-09-12 16:57:41 -04:00
|
|
|
enum EditableStateFlags
|
|
|
|
{
|
2016-06-25 12:17:56 -04:00
|
|
|
// Include selected property.
|
2008-09-12 16:57:41 -04:00
|
|
|
SelectionState = 0x01,
|
2016-06-25 12:17:56 -04:00
|
|
|
// Include expanded/collapsed property information.
|
2008-09-12 16:57:41 -04:00
|
|
|
ExpandedState = 0x02,
|
2016-06-25 12:17:56 -04:00
|
|
|
// Include scrolled position.
|
2008-09-12 16:57:41 -04:00
|
|
|
ScrollPosState = 0x04,
|
2016-06-25 12:17:56 -04:00
|
|
|
// Include selected page information.
|
|
|
|
// Only applies to wxPropertyGridManager.
|
2008-09-12 16:57:41 -04:00
|
|
|
PageState = 0x08,
|
2016-06-25 12:17:56 -04:00
|
|
|
// Include splitter position. Stored for each page.
|
2008-09-12 16:57:41 -04:00
|
|
|
SplitterPosState = 0x10,
|
2016-06-25 12:17:56 -04:00
|
|
|
// Include description box size.
|
|
|
|
// Only applies to wxPropertyGridManager.
|
2008-10-04 06:59:06 -04:00
|
|
|
DescBoxState = 0x20,
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Include all supported user editable state information.
|
|
|
|
// This is usually the default value.
|
2008-09-12 16:57:41 -04:00
|
|
|
AllStates = SelectionState |
|
|
|
|
ExpandedState |
|
|
|
|
ScrollPosState |
|
|
|
|
PageState |
|
2008-10-04 06:59:06 -04:00
|
|
|
SplitterPosState |
|
|
|
|
DescBoxState
|
2008-09-12 16:57:41 -04:00
|
|
|
};
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Restores user-editable state.
|
|
|
|
// See also wxPropertyGridInterface::SaveEditableState().
|
|
|
|
// src - String generated by SaveEditableState.
|
|
|
|
// restoreStates - Which parts to restore from source string. See @ref
|
|
|
|
// propgridinterface_editablestate_flags "list of editable state
|
|
|
|
// flags".
|
|
|
|
// Returns false if there was problem reading the string.
|
|
|
|
// If some parts of state (such as scrolled or splitter position) fail to
|
|
|
|
// restore correctly, please make sure that you call this function after
|
|
|
|
// wxPropertyGrid size has been set (this may sometimes be tricky when
|
|
|
|
// sizers are used).
|
2008-09-12 16:57:41 -04:00
|
|
|
bool RestoreEditableState( const wxString& src,
|
|
|
|
int restoreStates = AllStates );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Used to acquire user-editable state (selected property, expanded
|
|
|
|
// properties, scrolled position, splitter positions).
|
|
|
|
// includedStates - Which parts of state to include. See EditableStateFlags.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxString SaveEditableState( int includedStates = AllStates ) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Lets user set the strings listed in the choice dropdown of a
|
|
|
|
// wxBoolProperty. Defaults are "True" and "False", so changing them to,
|
|
|
|
// say, "Yes" and "No" may be useful in some less technical applications.
|
2008-09-12 16:57:41 -04:00
|
|
|
static void SetBoolChoices( const wxString& trueChoice,
|
|
|
|
const wxString& falseChoice );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Set proportion of a auto-stretchable column. wxPG_SPLITTER_AUTO_CENTER
|
|
|
|
// window style needs to be used to indicate that columns are auto-
|
|
|
|
// resizable.
|
|
|
|
// Returns false on failure.
|
|
|
|
// You should call this for individual pages of wxPropertyGridManager
|
|
|
|
// (if used).
|
2010-02-14 09:09:06 -05:00
|
|
|
bool SetColumnProportion( unsigned int column, int proportion );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns auto-resize proportion of the given column.
|
2010-02-16 10:38:12 -05:00
|
|
|
int GetColumnProportion( unsigned int column ) const
|
|
|
|
{
|
|
|
|
return m_pState->DoGetColumnProportion(column);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets an attribute for this property.
|
|
|
|
// name - Text identifier of attribute. See @ref propgrid_property_attributes.
|
|
|
|
// value - Value of attribute.
|
|
|
|
// argFlags - Optional. Use wxPG_RECURSE to set the attribute to child
|
|
|
|
// properties recursively.
|
|
|
|
// Setting attribute's value to wxNullVariant will simply remove it
|
|
|
|
// from property's set of attributes.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyAttribute( wxPGPropArg id,
|
|
|
|
const wxString& attrName,
|
|
|
|
wxVariant value,
|
|
|
|
long argFlags = 0 )
|
|
|
|
{
|
|
|
|
DoSetPropertyAttribute(id,attrName,value,argFlags);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets property attribute for all applicable properties.
|
|
|
|
// Be sure to use this method only after all properties have been
|
|
|
|
// added to the grid.
|
2008-09-21 11:42:08 -04:00
|
|
|
void SetPropertyAttributeAll( const wxString& attrName, wxVariant value );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets background colour of a property.
|
|
|
|
// id - Property name or pointer.
|
|
|
|
// colour - New background colour.
|
|
|
|
// flags - Default is wxPG_RECURSE which causes colour to be set recursively.
|
|
|
|
// Omit this flag to only set colour for the property in question
|
|
|
|
// and not any of its children.
|
2008-11-03 12:02:04 -05:00
|
|
|
void SetPropertyBackgroundColour( wxPGPropArg id,
|
|
|
|
const wxColour& colour,
|
2009-10-15 12:39:19 -04:00
|
|
|
int flags = wxPG_RECURSE );
|
2008-11-03 12:02:04 -05:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Resets text and background colours of given property.
|
|
|
|
// id - Property name or pointer.
|
|
|
|
// flags - Default is wxPG_DONT_RECURSE which causes colour to be reset
|
|
|
|
// only for the property in question (for backward compatibility).
|
2015-08-27 13:14:52 -04:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
void SetPropertyColoursToDefault(wxPGPropArg id);
|
|
|
|
void SetPropertyColoursToDefault(wxPGPropArg id, int flags);
|
|
|
|
#else
|
|
|
|
void SetPropertyColoursToDefault(wxPGPropArg id, int flags = wxPG_DONT_RECURSE);
|
|
|
|
#endif // WXWIN_COMPATIBILITY_3_0
|
2008-11-03 12:02:04 -05:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets text colour of a property.
|
|
|
|
// id - Property name or pointer.
|
|
|
|
// colour - New background colour.
|
|
|
|
// flags - Default is wxPG_RECURSE which causes colour to be set recursively.
|
|
|
|
// Omit this flag to only set colour for the property in question
|
|
|
|
// and not any of its children.
|
2008-11-03 12:02:04 -05:00
|
|
|
void SetPropertyTextColour( wxPGPropArg id,
|
|
|
|
const wxColour& col,
|
2009-10-15 12:39:19 -04:00
|
|
|
int flags = wxPG_RECURSE );
|
2008-11-03 12:02:04 -05:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns background colour of first cell of a property.
|
2008-11-03 12:02:04 -05:00
|
|
|
wxColour GetPropertyBackgroundColour( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxColour())
|
|
|
|
return p->GetCell(0).GetBgCol();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns text colour of first cell of a property.
|
2008-11-03 12:02:04 -05:00
|
|
|
wxColour GetPropertyTextColour( wxPGPropArg id ) const
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(wxColour())
|
|
|
|
return p->GetCell(0).GetFgCol();
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets text, bitmap, and colours for given column's cell.
|
|
|
|
// You can set label cell by setting column to 0.
|
|
|
|
// You can use wxPG_LABEL as text to use default text for column.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyCell( wxPGPropArg id,
|
|
|
|
int column,
|
|
|
|
const wxString& text = wxEmptyString,
|
|
|
|
const wxBitmap& bitmap = wxNullBitmap,
|
|
|
|
const wxColour& fgCol = wxNullColour,
|
2008-10-31 14:53:37 -04:00
|
|
|
const wxColour& bgCol = wxNullColour );
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets client data (void*) of a property.
|
|
|
|
// This untyped client data has to be deleted manually.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyClientData( wxPGPropArg id, void* clientData )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
|
|
|
p->SetClientData(clientData);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets editor for a property.
|
|
|
|
// editor - For builtin editors, use wxPGEditor_X, where X is builtin editor's
|
|
|
|
// name (TextCtrl, Choice, etc. see wxPGEditor documentation for full
|
|
|
|
// list).
|
|
|
|
// For custom editors, use pointer you received from
|
|
|
|
// wxPropertyGrid::RegisterEditorClass().
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyEditor( wxPGPropArg id, const wxPGEditor* editor )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
2015-05-31 13:12:29 -04:00
|
|
|
wxCHECK_RET( editor, wxS("unknown/NULL editor") );
|
2008-09-12 16:57:41 -04:00
|
|
|
p->SetEditor(editor);
|
|
|
|
RefreshProperty(p);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets editor control of a property. As editor argument, use
|
|
|
|
// editor name string, such as "TextCtrl" or "Choice".
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyEditor( wxPGPropArg id, const wxString& editorName )
|
|
|
|
{
|
|
|
|
SetPropertyEditor(id,GetEditorByName(editorName));
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets label of a property.
|
|
|
|
// Properties under same parent may have same labels. However,
|
|
|
|
// property names must still remain unique.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyLabel( wxPGPropArg id, const wxString& newproplabel );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets name of a property.
|
|
|
|
// id - Name or pointer of property which name to change.
|
|
|
|
// newName - New name for property.
|
2008-09-29 13:01:04 -04:00
|
|
|
void SetPropertyName( wxPGPropArg id, const wxString& newName )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
|
|
|
m_pState->DoSetPropertyName( p, newName );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets property (and, recursively, its children) to have read-only value.
|
|
|
|
// In other words, user cannot change the value in the editor, but they
|
|
|
|
// can still copy it.
|
|
|
|
// This is mainly for use with textctrl editor. Not all other editors fully
|
|
|
|
// support it.
|
|
|
|
// By default changes are applied recursively. Set parameter "flags"
|
|
|
|
// to wxPG_DONT_RECURSE to prevent this.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyReadOnly( wxPGPropArg id,
|
|
|
|
bool set = true,
|
2014-07-07 18:32:57 -04:00
|
|
|
int flags = wxPG_RECURSE );
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets property's value to unspecified.
|
|
|
|
// If it has children (it may be category), then the same thing is done to
|
|
|
|
// them.
|
2009-01-11 11:24:00 -05:00
|
|
|
void SetPropertyValueUnspecified( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
2009-12-14 10:15:35 -05:00
|
|
|
p->SetValueToUnspecified();
|
2009-01-11 11:24:00 -05:00
|
|
|
}
|
2008-09-12 16:57:41 -04:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets property values from a list of wxVariants.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValues( const wxVariantList& list,
|
|
|
|
wxPGPropArg defaultCategory = wxNullProperty )
|
|
|
|
{
|
|
|
|
wxPGProperty *p;
|
|
|
|
if ( defaultCategory.HasName() ) p = defaultCategory.GetPtr(this);
|
|
|
|
else p = defaultCategory.GetPtr0();
|
|
|
|
m_pState->DoSetPropertyValues(list, p);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets property values from a list of wxVariants.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValues( const wxVariant& list,
|
|
|
|
wxPGPropArg defaultCategory = wxNullProperty )
|
|
|
|
{
|
|
|
|
SetPropertyValues(list.GetList(),defaultCategory);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Associates the help string with property.
|
|
|
|
// By default, text is shown either in the manager's "description"
|
|
|
|
// text box or in the status bar. If extra window style
|
|
|
|
// wxPG_EX_HELP_AS_TOOLTIPS is used, then the text will appear as a
|
|
|
|
// tooltip.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyHelpString( wxPGPropArg id, const wxString& helpString )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
|
|
|
p->SetHelpString(helpString);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Set wxBitmap in front of the value.
|
|
|
|
// Bitmap will be scaled to a size returned by
|
|
|
|
// wxPropertyGrid::GetImageSize();
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyImage( wxPGPropArg id, wxBitmap& bmp )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
|
|
|
p->SetValueImage(bmp);
|
|
|
|
RefreshProperty(p);
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets max length of property's text.
|
2008-09-12 16:57:41 -04:00
|
|
|
bool SetPropertyMaxLength( wxPGPropArg id, int maxLen );
|
|
|
|
|
|
|
|
#if wxUSE_VALIDATORS
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets validator of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValidator( wxPGPropArg id, const wxValidator& validator )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
|
|
|
p->SetValidator(validator);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (long integer) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, long value )
|
|
|
|
{
|
|
|
|
wxVariant v(value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (integer) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, int value )
|
|
|
|
{
|
|
|
|
wxVariant v((long)value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
2016-06-25 12:17:56 -04:00
|
|
|
|
|
|
|
// Sets value (floating point) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, double value )
|
|
|
|
{
|
|
|
|
wxVariant v(value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
2016-06-25 12:17:56 -04:00
|
|
|
|
|
|
|
// Sets value (bool) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, bool value )
|
|
|
|
{
|
|
|
|
wxVariant v(value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
2016-06-25 12:17:56 -04:00
|
|
|
|
|
|
|
// Sets value (wchar_t*) of a property.
|
2008-09-29 13:04:38 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, const wchar_t* value )
|
|
|
|
{
|
|
|
|
SetPropertyValueString( id, wxString(value) );
|
|
|
|
}
|
2016-06-25 12:17:56 -04:00
|
|
|
|
|
|
|
// Sets value (char*) of a property.
|
2008-09-29 13:04:38 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, const char* value )
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
|
|
|
SetPropertyValueString( id, wxString(value) );
|
|
|
|
}
|
2016-06-25 12:17:56 -04:00
|
|
|
|
|
|
|
// Sets value (string) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, const wxString& value )
|
|
|
|
{
|
|
|
|
SetPropertyValueString( id, value );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxArrayString) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, const wxArrayString& value )
|
|
|
|
{
|
|
|
|
wxVariant v(value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
|
|
|
|
|
|
|
#if wxUSE_DATETIME
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxDateTime) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, const wxDateTime& value )
|
|
|
|
{
|
|
|
|
wxVariant v(value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxObject*) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, wxObject* value )
|
|
|
|
{
|
|
|
|
wxVariant v(value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxObject&) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, wxObject& value )
|
|
|
|
{
|
|
|
|
wxVariant v(&value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
|
|
|
|
2015-04-03 15:12:19 -04:00
|
|
|
#if wxUSE_LONGLONG
|
2015-04-03 18:33:25 -04:00
|
|
|
#ifdef wxLongLong_t
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (native 64-bit int) of a property.
|
2015-04-03 18:33:25 -04:00
|
|
|
void SetPropertyValue(wxPGPropArg id, wxLongLong_t value)
|
|
|
|
{
|
2019-06-15 14:19:34 -04:00
|
|
|
wxVariant v = wxLongLong(value);
|
2015-04-03 18:33:25 -04:00
|
|
|
SetPropVal(id, v);
|
|
|
|
}
|
|
|
|
#endif
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxLongLong) of a property.
|
2015-04-03 15:12:19 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, wxLongLong value )
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
2019-06-15 14:19:34 -04:00
|
|
|
wxVariant v(value);
|
2008-09-12 16:57:41 -04:00
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
2015-04-03 18:33:25 -04:00
|
|
|
#ifdef wxULongLong_t
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (native 64-bit unsigned int) of a property.
|
2015-04-03 18:33:25 -04:00
|
|
|
void SetPropertyValue(wxPGPropArg id, wxULongLong_t value)
|
|
|
|
{
|
2019-06-15 14:19:34 -04:00
|
|
|
wxVariant v = wxULongLong(value);
|
2015-04-03 18:33:25 -04:00
|
|
|
SetPropVal(id, v);
|
|
|
|
}
|
|
|
|
#endif
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxULongLong) of a property.
|
2015-04-03 15:12:19 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, wxULongLong value )
|
2008-09-12 16:57:41 -04:00
|
|
|
{
|
2019-06-15 14:19:34 -04:00
|
|
|
wxVariant v(value);
|
2008-09-12 16:57:41 -04:00
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
2008-09-27 11:13:12 -04:00
|
|
|
#endif
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxArrayInt&) of a property.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, const wxArrayInt& value )
|
|
|
|
{
|
|
|
|
wxVariant v = WXVARIANT(value);
|
|
|
|
SetPropVal( id, v );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxString) of a property.
|
|
|
|
// This method uses wxPGProperty::SetValueFromString, which all properties
|
|
|
|
// should implement. This means that there should not be a type error,
|
|
|
|
// and instead the string is converted to property's actual value type.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValueString( wxPGPropArg id, const wxString& value );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxVariant) of a property.
|
|
|
|
// Use wxPropertyGrid::ChangePropertyValue() instead if you need to run
|
|
|
|
// through validation process and send property change event.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropertyValue( wxPGPropArg id, wxVariant value )
|
|
|
|
{
|
|
|
|
SetPropVal( id, value );
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sets value (wxVariant&) of a property. Same as SetPropertyValue,
|
|
|
|
// but accepts reference.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetPropVal( wxPGPropArg id, wxVariant& value );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Adjusts how wxPropertyGrid behaves when invalid value is entered
|
|
|
|
// in a property.
|
|
|
|
// vfbFlags - See wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS for possible values.
|
2008-09-12 16:57:41 -04:00
|
|
|
void SetValidationFailureBehavior( int vfbFlags );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sorts all properties recursively.
|
|
|
|
// flags - This can contain any of the following options:
|
|
|
|
// wxPG_SORT_TOP_LEVEL_ONLY: Only sort categories and their
|
|
|
|
// immediate children. Sorting done by wxPG_AUTO_SORT option
|
|
|
|
// uses this.
|
|
|
|
// See SortChildren, wxPropertyGrid::SetSortFunction
|
2009-01-10 10:16:03 -05:00
|
|
|
void Sort( int flags = 0 );
|
2009-01-07 13:53:09 -05:00
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Sorts children of a property.
|
|
|
|
// id - Name or pointer to a property.
|
|
|
|
// flags - This can contain any of the following options:
|
|
|
|
// wxPG_RECURSE: Sorts recursively.
|
|
|
|
// See Sort, wxPropertyGrid::SetSortFunction
|
2009-01-10 10:16:03 -05:00
|
|
|
void SortChildren( wxPGPropArg id, int flags = 0 )
|
2009-01-07 13:53:09 -05:00
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
2009-01-10 10:16:03 -05:00
|
|
|
m_pState->DoSortChildren(p, flags);
|
2009-01-07 13:53:09 -05:00
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// GetPropertyByName() with nice assertion error message.
|
2008-09-12 16:57:41 -04:00
|
|
|
wxPGProperty* GetPropertyByNameA( const wxString& name ) const;
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// Returns editor pointer of editor with given name.
|
2008-09-12 16:57:41 -04:00
|
|
|
static wxPGEditor* GetEditorByName( const wxString& editorName );
|
|
|
|
|
2009-08-23 11:31:03 -04:00
|
|
|
// NOTE: This function reselects the property and may cause
|
|
|
|
// excess flicker, so to just call Refresh() on a rect
|
|
|
|
// of single property, call DrawItem() instead.
|
2008-09-12 16:57:41 -04:00
|
|
|
virtual void RefreshProperty( wxPGProperty* p ) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2009-08-17 14:36:00 -04:00
|
|
|
bool DoClearSelection( bool validation = false,
|
|
|
|
int selFlags = 0 );
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// In derived class, implement to set editable state component with
|
|
|
|
// given name to given value.
|
2008-10-04 06:59:06 -04:00
|
|
|
virtual bool SetEditableStateItem( const wxString& name, wxVariant value )
|
|
|
|
{
|
|
|
|
wxUnusedVar(name);
|
|
|
|
wxUnusedVar(value);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-06-25 12:17:56 -04:00
|
|
|
// In derived class, implement to return editable state component with
|
|
|
|
// given name.
|
2008-10-04 06:59:06 -04:00
|
|
|
virtual wxVariant GetEditableStateItem( const wxString& name ) const
|
|
|
|
{
|
|
|
|
wxUnusedVar(name);
|
|
|
|
return wxNullVariant;
|
|
|
|
}
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
// Returns page state data for given (sub) page (-1 means current page).
|
|
|
|
virtual wxPropertyGridPageState* GetPageState( int pageIndex ) const
|
|
|
|
{
|
|
|
|
if ( pageIndex <= 0 )
|
|
|
|
return m_pState;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool DoSelectPage( int WXUNUSED(index) ) { return true; }
|
|
|
|
|
|
|
|
// Default call's m_pState's BaseGetPropertyByName
|
|
|
|
virtual wxPGProperty* DoGetPropertyByName( const wxString& name ) const;
|
|
|
|
|
|
|
|
// Deriving classes must set this (it must be only or current page).
|
|
|
|
wxPropertyGridPageState* m_pState;
|
|
|
|
|
|
|
|
// Intermediate version needed due to wxVariant copying inefficiency
|
|
|
|
void DoSetPropertyAttribute( wxPGPropArg id,
|
|
|
|
const wxString& name,
|
|
|
|
wxVariant& value, long argFlags );
|
|
|
|
|
|
|
|
// Empty string object to return from member functions returning const
|
|
|
|
// wxString&.
|
|
|
|
wxString m_emptyString;
|
|
|
|
|
|
|
|
private:
|
|
|
|
// Cannot be GetGrid() due to ambiguity issues.
|
|
|
|
wxPropertyGrid* GetPropertyGrid()
|
|
|
|
{
|
2009-09-01 09:13:58 -04:00
|
|
|
if ( !m_pState )
|
|
|
|
return NULL;
|
2008-09-12 16:57:41 -04:00
|
|
|
return m_pState->GetGrid();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Cannot be GetGrid() due to ambiguity issues.
|
|
|
|
const wxPropertyGrid* GetPropertyGrid() const
|
|
|
|
{
|
2009-09-01 09:13:58 -04:00
|
|
|
if ( !m_pState )
|
|
|
|
return NULL;
|
2010-11-07 08:16:20 -05:00
|
|
|
|
|
|
|
return m_pState->GetGrid();
|
2008-09-12 16:57:41 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
friend class wxPropertyGrid;
|
|
|
|
friend class wxPropertyGridManager;
|
|
|
|
};
|
|
|
|
|
2008-09-17 11:00:00 -04:00
|
|
|
#endif // wxUSE_PROPGRID
|
|
|
|
|
2008-09-12 16:57:41 -04:00
|
|
|
#endif // __WX_PROPGRID_PROPGRIDIFACE_H__
|