50 aProperty->
setter(
object, aValue );
56 return object !=
nullptr;
67 aProperty->
set<
T>( object, aValue );
73 return object !=
nullptr;
83 wxPGChoices choices = aProperty->
GetChoices(
this );
85 if( choices.GetCount() )
90 aProperty->
set<
int>( object, aValue.GetInteger() );
92 aProperty->
set<wxString>( object, choices.GetLabel( aValue.GetInteger() ) );
95 aProperty->
set<wxVariant>( object, aValue );
101 return object !=
nullptr;
105 bool Set(
const wxString& aProperty,
T aValue,
bool aNotify =
true )
110 void*
object =
nullptr;
118 prop->
set<
T>( object, aValue );
125 return object !=
nullptr;
132 return object ? aProperty->
getter(
object ) : wxAny();
142 throw std::runtime_error(
"Could not cast INSPECTABLE to the requested type" );
144 return aProperty->
get<
T>( object );
148 std::optional<T>
Get(
const wxString& aProperty )
const
153 std::optional<T> ret;
160 ret = prop->
get<
T>( object );
Class that other classes need to inherit from, in order to be inspectable.
T Get(PROPERTY_BASE *aProperty) const
bool Set(PROPERTY_BASE *aProperty, T aValue, bool aNotify=true)
bool Set(PROPERTY_BASE *aProperty, wxVariant aValue, bool aNotify=true)
wxAny Get(PROPERTY_BASE *aProperty) const
bool Set(PROPERTY_BASE *aProperty, wxAny &aValue, bool aNotify=true)
bool Set(const wxString &aProperty, T aValue, bool aNotify=true)
std::optional< T > Get(const wxString &aProperty) const
virtual size_t TypeHash() const =0
Return type-id of the property type.
virtual wxAny getter(const void *aObject) const =0
wxPGChoices GetChoices(INSPECTABLE *aObject) const
virtual void setter(void *aObject, wxAny &aValue)=0
void set(void *aObject, T aValue)
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Provide class metadata.Helper macro to map type hashes to names.
void PropertyChanged(INSPECTABLE *aObject, PROPERTY_BASE *aProperty)
Callback to alert the notification system that a property has changed.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE * GetProperty(TYPE_ID aType, const wxString &aProperty) const
Return a property for a specific type.
const void * TypeCast(const void *aSource, TYPE_ID aBase, TYPE_ID aTarget) const
Cast a type to another type.
size_t TYPE_ID
Unique type identifier.