34 virtual void setA(
int a ) = 0;
35 virtual int getA()
const = 0;
36 virtual const int& getA2()
const {
return m_a; }
38 virtual void setPoint(
const wxPoint& p ) { m_p = p; }
39 void setPoint2( wxPoint& p ) { m_p = p; }
40 void setPoint3( wxPoint p ) { m_p = p; }
41 void setPoint4( wxPoint p ) { m_p = p; }
43 const wxPoint&
getPoint()
const {
return m_p; }
44 wxPoint getPoint2()
const {
return m_p; }
45 wxPoint getPoint3() {
return m_p; }
46 const wxPoint& getPoint4()
const {
return m_p; }
57 void setA(
int a )
override { m_a = a; }
58 int getA()
const override {
return m_a; }
82class D :
public A,
public C
88 virtual void setA(
int a )
override {
m_aa = 2 * a; }
89 virtual int getA()
const override {
return m_aa; }
164 .Map( D::enum_class::TESTA,
"TESTA" )
165 .Map( D::enum_class::TESTB,
"TESTB" )
166 .Map( D::enum_class::TESTC,
"TESTC" );
183 &D::setCond, &D::getCond ) )
198 wxArrayString labels;
201 wxPGChoices newChoices( labels, values );
206 prop->SetChoices( newChoices );
234 ptr->Set(
"A", 100 );
235 ptr->Set(
"point", wxPoint( 100, 200 ) );
241 ptr->Set(
"enumClass", D::enum_class::TESTC );
243 BOOST_CHECK_EQUAL( *ptr->Get<D::enum_class>(
"enumClass" ), D::enum_class::TESTC );
271 BOOST_CHECK_THROW( ptr->Get<wxPoint>(
"A" ), std::invalid_argument );
294 wxArrayString labels;
295 labels.Add(
"TEST1" );
296 labels.Add(
"TEST2" );
297 labels.Add(
"TEST3" );
299 const wxPGChoices& v = prop->
Choices();
303 for (
unsigned int i = 0; i < values.GetCount(); ++i )
308 for (
unsigned int i = 0; i < labels.GetCount(); ++i )
317 wxAny
any = item.Get( prop );
321 any = item.Get( prop );
331 values.Add( D::enum_class::TESTA );
332 values.Add( D::enum_class::TESTB );
333 values.Add( D::enum_class::TESTC );
334 wxArrayString labels;
335 labels.Add(
"TESTA" );
336 labels.Add(
"TESTB" );
337 labels.Add(
"TESTC" );
339 const wxPGChoices& v = prop->
Choices();
343 for (
unsigned int i = 0; i < values.GetCount(); ++i )
348 for (
unsigned int i = 0; i < labels.GetCount(); ++i )
362 BOOST_CHECK( !propCond->
Available( ptr ) );
365 BOOST_CHECK( propCond->
Available( ptr ) );
373 ptr->Set(
"point", wxPoint( 100, 100 ) );
377 ptr->Set(
"point_alias", wxPoint( 300, 300 ) );
387 prop = propMgr.GetProperty(
TYPE_HASH(
D ),
"bool" );
390 prop = propMgr.GetProperty(
TYPE_HASH(
D ),
"replaced_bool" );
403 wxArrayString labels;
407 const wxPGChoices& v = prop->
Choices();
411 for (
unsigned int i = 0; i < values.GetCount(); ++i )
416 for (
unsigned int i = 0; i < labels.GetCount(); ++i )
int getA() const override
void setA(int a) override
virtual int getA() const override
enum_glob getGlobEnum() const
enum_class getClassEnum() const
virtual void setA(int a) override
void setGlobEnum(enum_glob val)
void setClassEnum(enum_class val)
static ENUM_MAP< T > & Instance()
Class that other classes need to inherit from, in order to be inspectable.
wxAny Get(PROPERTY_BASE *aProperty) const
PROPERTY_BASE & SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
virtual bool HasChoices() const
Return true if this PROPERTY has a limited set of possible values.
bool Available(INSPECTABLE *aObject) const
Return true if aObject offers this PROPERTY.
virtual const wxPGChoices & Choices() const
Return a limited set of possible values (e.g.
void InheritsAfter(TYPE_ID aDerived, TYPE_ID aBase)
Declare an inheritance relationship between types.
static PROPERTY_MANAGER & Instance()
PROPERTY_BASE & AddProperty(PROPERTY_BASE *aProperty, const wxString &aGroup=wxEmptyString)
Register a property.
PROPERTY_BASE & ReplaceProperty(size_t aBase, const wxString &aName, PROPERTY_BASE *aNew, const wxString &aGroup=wxEmptyString)
Replace an existing property for a specific type.
void AddTypeCast(TYPE_CAST_BASE *aCast)
Register a type converter.
A type-safe container of any type.
#define TYPE_HASH(x)
Macro to generate unique identifier for a type.
#define ENUM_TO_WXANY(type)
PROPERTY_MANAGER & propMgr
static VECTOR2D getPoint(const float *aPointCoordinates)
BOOST_AUTO_TEST_CASE(HorizontalAlignment)
BOOST_REQUIRE(intersection.has_value()==c.ExpectedIntersection.has_value())
BOOST_AUTO_TEST_SUITE_END()
static struct CLASS_A_DESC _CLASS_A_DESC
static struct CLASS_D_DESC _CLASS_D_DESC
static struct ENUM_GLOB_DESC s_ENUM_GLOB_DESC
static struct CLASS_C_DESC _CLASS_C_DESC
static struct CLASS_E_DESC _CLASS_E_DESC
BOOST_AUTO_TEST_CASE(SetGet)
static struct CLASS_B_DESC _CLASS_B_DESC
BOOST_CHECK_EQUAL(result, "25.4")