KiCad PCB EDA Suite
property.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2020 CERN
5 * Copyright (C) 2020-2021 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Tomasz Wlostowski <[email protected]>
8 * @author Maciej Suminski <[email protected]>
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version 3
13 * of the License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along
21 * with this program. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#ifndef PROPERTY_H
25#define PROPERTY_H
26
27#include <core/wx_stl_compat.h>
28#include <origin_transforms.h>
29
30#include <wx/any.h>
31#include <wx/string.h>
32#include <wx/bitmap.h>
33#include <wx/font.h> // required for propgrid
34#include <wx/validate.h> // required for propgrid
35#include <wx/propgrid/property.h>
36
37#include <functional>
38#include <map>
39#include <memory>
40#include <typeindex>
41#include <type_traits>
42
43class wxPGProperty;
44class INSPECTABLE;
45class PROPERTY_BASE;
46
47template<typename T>
48class ENUM_MAP;
49
52{
58};
59
61#define TYPE_HASH( x ) typeid( x ).hash_code()
62#define TYPE_NAME( x ) typeid( x ).name()
63//#define TYPE_HASH( x ) typeid( std::decay<x>::type ).hash_code()
64
65template<typename Owner, typename T>
67{
68public:
69 virtual ~GETTER_BASE() {}
70
71 virtual T operator()( const Owner* aOwner ) const = 0;
72};
73
74template<typename Owner, typename T, typename FuncType>
75class GETTER : public GETTER_BASE<Owner, T>
76{
77public:
78 GETTER( FuncType aFunc )
79 : m_func( aFunc )
80 {
81 wxCHECK( m_func, /*void*/ );
82 }
83
84 T operator()( const Owner* aOwner ) const override
85 {
86 return ( aOwner->*m_func )();
87 }
88
89private:
90 FuncType m_func;
91};
92
93template<typename Owner, typename T>
95{
96public:
97 virtual ~SETTER_BASE() {}
98
99 virtual void operator()( Owner* aOwner, T aValue ) = 0;
100};
101
102template<typename Owner, typename T, typename FuncType>
103class SETTER : public SETTER_BASE<Owner, T>
104{
105public:
106 SETTER( FuncType aFunc )
107 : m_func( aFunc )
108 {
109 wxCHECK( m_func, /*void*/ );
110 }
111
112 void operator()( Owner* aOwner, T aValue ) override
113 {
114 ( aOwner->*m_func )( aValue );
115 }
116
117private:
118 FuncType m_func;
119};
120
121
122template<typename Owner, typename T, typename Base = Owner>
124{
125public:
126 static GETTER_BASE<Owner, T>* Wrap( T (Base::*aFunc)() )
127 {
128 return new GETTER<Owner, T, T (Base::*)()>( aFunc );
129 }
130
131 constexpr static GETTER_BASE<Owner, T>* Wrap( const T (Base::*aFunc)() )
132 {
133 return new GETTER<Owner, T, T (Base::*)()>( aFunc );
134 }
135
136 constexpr static GETTER_BASE<Owner, T>* Wrap( const T& (Base::*aFunc)() )
137 {
138 return new GETTER<Owner, T, const T& (Base::*)()>( aFunc );
139 }
140
141 constexpr static GETTER_BASE<Owner, T>* Wrap( T (Base::*aFunc)() const )
142 {
143 return new GETTER<Owner, T, T (Base::*)() const>( aFunc );
144 }
145
146 constexpr static GETTER_BASE<Owner, T>* Wrap( const T (Base::*aFunc)() const )
147 {
148 return new GETTER<Owner, T, T (Base::*)() const>( aFunc );
149 }
150
151 constexpr static GETTER_BASE<Owner, T>* Wrap( const T& (Base::*aFunc)() const )
152 {
154 }
155
156 constexpr static SETTER_BASE<Owner, T>* Wrap( void (Base::*aFunc)( T ) )
157 {
158 return aFunc ? new SETTER<Owner, T, void (Base::*)( T )>( aFunc ) : nullptr;
159 }
160
161 constexpr static SETTER_BASE<Owner, T>* Wrap( void (Base::*aFunc)( T& ) )
162 {
163 return aFunc ? new SETTER<Owner, T, void (Base::*)( T& )>( aFunc ) : nullptr;
164 }
165
166 constexpr static SETTER_BASE<Owner, T>* Wrap( void (Base::*aFunc)( const T& ) )
167 {
168 return aFunc ? new SETTER<Owner, T, void (Base::*)( const T& )>( aFunc ) : nullptr;
169 }
170
171 METHOD() = delete;
172};
173
174
176{
177private:
179
180public:
181PROPERTY_BASE( const wxString& aName, PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
183 m_name( aName ),
184 m_display( aDisplay ),
185 m_coordType( aCoordType ),
186 m_availFunc( [](INSPECTABLE*)->bool { return true; } )
187 {
188 }
189
191 {
192 }
193
194 const wxString& Name() const
195 {
196 return m_name;
197 }
198
203 virtual const wxPGChoices& Choices() const
204 {
205 static wxPGChoices empty;
206 return empty;
207 }
208
212 virtual void SetChoices( const wxPGChoices& aChoices )
213 {
214 wxFAIL; // only possible for PROPERTY_ENUM
215 }
216
221 virtual bool HasChoices() const
222 {
223 return false;
224 }
225
229 bool Available( INSPECTABLE* aObject ) const
230 {
231 return m_availFunc( aObject );
232 }
233
237 void SetAvailableFunc( std::function<bool(INSPECTABLE*)> aFunc )
238 {
239 m_availFunc = aFunc;
240 }
241
245 virtual size_t OwnerHash() const = 0;
246
250 virtual size_t BaseHash() const = 0;
251
255 virtual size_t TypeHash() const = 0;
256
257 virtual bool IsReadOnly() const = 0;
258
260 {
261 return m_display;
262 }
263
264 ORIGIN_TRANSFORMS::COORD_TYPES_T CoordType() const { return m_coordType; }
265
266protected:
267 template<typename T>
268 void set( void* aObject, T aValue )
269 {
270 wxAny a = aValue;
271 setter( aObject, a );
272 }
273
274 template<typename T>
275 T get( const void* aObject ) const
276 {
277 wxAny a = getter( aObject );
278
279 if ( !( std::is_enum<T>::value && a.CheckType<int>() ) && !a.CheckType<T>() )
280 throw std::invalid_argument( "Invalid requested type" );
281
282 return wxANY_AS( a, T );
283 }
284
285private:
286 virtual void setter( void* aObject, wxAny& aValue ) = 0;
287 virtual wxAny getter( const void* aObject ) const = 0;
288
289private:
290 const wxString m_name;
293
294 std::function<bool(INSPECTABLE*)> m_availFunc;
295
296 friend class INSPECTABLE;
297};
298
299
300template<typename Owner, typename T, typename Base = Owner>
302{
303public:
304 using BASE_TYPE = typename std::decay<T>::type;
305
306 template<typename SetType, typename GetType>
307 PROPERTY( const wxString& aName,
308 void ( Base::*aSetter )( SetType ), GetType( Base::*aGetter )(),
309 PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
311 : PROPERTY( aName, METHOD<Owner, T, Base>::Wrap( aSetter ),
312 METHOD<Owner, T, Base>::Wrap( aGetter ), aDisplay, aCoordType )
313 {
314 }
315
316 template<typename SetType, typename GetType>
317 PROPERTY( const wxString& aName,
318 void ( Base::*aSetter )( SetType ), GetType( Base::*aGetter )() const,
319 PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
321 : PROPERTY( aName, METHOD<Owner, T, Base>::Wrap( aSetter ),
322 METHOD<Owner, T, Base>::Wrap( aGetter ), aDisplay, aCoordType )
323 {
324 }
325
326 size_t OwnerHash() const override
327 {
328 return m_ownerHash;
329 }
330
331 size_t BaseHash() const override
332 {
333 return m_baseHash;
334 }
335
336 size_t TypeHash() const override
337 {
338 return m_typeHash;
339 }
340
341 bool IsReadOnly() const override
342 {
343 return !m_setter;
344 }
345
346protected:
349 : PROPERTY_BASE( aName, aDisplay, aCoordType ), m_setter( s ), m_getter( g ),
350 m_ownerHash( TYPE_HASH( Owner ) ), m_baseHash( TYPE_HASH( Base ) ),
352 {
353 }
354
355 virtual ~PROPERTY() {}
356
357 virtual void setter( void* obj, wxAny& v ) override
358 {
359 wxCHECK( !IsReadOnly(), /*void*/ );
360
361 if( !v.CheckType<T>() )
362 throw std::invalid_argument( "Invalid type requested" );
363
364 Owner* o = reinterpret_cast<Owner*>( obj );
365 BASE_TYPE value = wxANY_AS(v, BASE_TYPE);
366 (*m_setter)( o, value );
367 }
368
369 virtual wxAny getter( const void* obj ) const override
370 {
371 const Owner* o = reinterpret_cast<const Owner*>( obj );
372 wxAny res = (*m_getter)( o );
373 return res;
374 }
375
377 std::unique_ptr<SETTER_BASE<Owner, T>> m_setter;
378
380 std::unique_ptr<GETTER_BASE<Owner, T>> m_getter;
381
383 const size_t m_ownerHash;
384
386 const size_t m_baseHash;
387
389 const size_t m_typeHash;
390};
391
392
393template<typename Owner, typename T, typename Base = Owner>
394class PROPERTY_ENUM : public PROPERTY<Owner, T, Base>
395{
396public:
397 template<typename SetType, typename GetType>
398 PROPERTY_ENUM( const wxString& aName,
399 void ( Base::*aSetter )( SetType ), GetType( Base::*aGetter )(),
400 PROPERTY_DISPLAY aDisplay = PT_DEFAULT )
401 : PROPERTY<Owner, T, Base>( aName, METHOD<Owner, T, Base>::Wrap( aSetter ),
402 METHOD<Owner, T, Base>::Wrap( aGetter ), aDisplay )
403 {
404 if ( std::is_enum<T>::value )
405 {
406 m_choices = ENUM_MAP<T>::Instance().Choices();
407 wxASSERT_MSG( m_choices.GetCount() > 0, wxT( "No enum choices defined" ) );
408 }
409 }
410
411 template<typename SetType, typename GetType>
412 PROPERTY_ENUM( const wxString& aName,
413 void ( Base::*aSetter )( SetType ), GetType( Base::*aGetter )() const,
414 PROPERTY_DISPLAY aDisplay = PT_DEFAULT,
416 : PROPERTY<Owner, T, Base>( aName, METHOD<Owner, T, Base>::Wrap( aSetter ),
417 METHOD<Owner, T, Base>::Wrap( aGetter ), aDisplay, aCoordType )
418 {
419 if ( std::is_enum<T>::value )
420 {
421 m_choices = ENUM_MAP<T>::Instance().Choices();
422 wxASSERT_MSG( m_choices.GetCount() > 0, wxT( "No enum choices defined" ) );
423 }
424 }
425
426 void setter( void* obj, wxAny& v ) override
427 {
428 wxCHECK( !( PROPERTY<Owner, T, Base>::IsReadOnly() ), /*void*/ );
429 Owner* o = reinterpret_cast<Owner*>( obj );
430
431 if( v.CheckType<T>() )
432 {
433 T value = wxANY_AS(v, T);
435 }
436 else if (v.CheckType<int>() )
437 {
438 int value = wxANY_AS(v, int);
439 (*PROPERTY<Owner, T, Base>::m_setter)( o, static_cast<T>( value ) );
440 }
441 else
442 {
443 throw std::invalid_argument( "Invalid type requested" );
444 }
445 }
446
447 wxAny getter( const void* obj ) const override
448 {
449 const Owner* o = reinterpret_cast<const Owner*>( obj );
450 wxAny res = static_cast<T>( (*PROPERTY<Owner, T, Base>::m_getter)( o ) );
451 return res;
452 }
453
454 const wxPGChoices& Choices() const override
455 {
456 return m_choices.GetCount() > 0 ? m_choices : ENUM_MAP<T>::Instance().Choices();
457 }
458
459 void SetChoices( const wxPGChoices& aChoices ) override
460 {
461 m_choices = aChoices;
462 }
463
464 bool HasChoices() const override
465 {
466 return Choices().GetCount() > 0;
467 }
468
469protected:
470 wxPGChoices m_choices;
471};
472
473
475{
476public:
477 virtual ~TYPE_CAST_BASE() {}
478 virtual void* operator()( void* aPointer ) const = 0;
479 virtual const void* operator()( const void* aPointer ) const = 0;
480 virtual size_t BaseHash() const = 0;
481 virtual size_t DerivedHash() const = 0;
482};
483
484
485template<typename Base, typename Derived>
487{
488public:
490 {
491 }
492
493 void* operator()( void* aPointer ) const override
494 {
495 Base* base = reinterpret_cast<Base*>( aPointer );
496 return static_cast<Derived*>( base );
497 }
498
499 const void* operator()( const void* aPointer ) const override
500 {
501 const Base* base = reinterpret_cast<const Base*>( aPointer );
502 return static_cast<const Derived*>( base );
503 }
504
505 size_t BaseHash() const override
506 {
507 return TYPE_HASH( Base );
508 }
509
510 size_t DerivedHash() const override
511 {
512 return TYPE_HASH( Derived );
513 }
514};
515
516
517template<typename T>
519{
520public:
522 {
523 static ENUM_MAP<T> inst;
524 return inst;
525 }
526
527 ENUM_MAP& Map( T aValue, const wxString& aName )
528 {
529 m_choices.Add( aName, static_cast<int>( aValue ) );
530 m_reverseMap[ aName ] = aValue;
531 return *this;
532 }
533
534 ENUM_MAP& Undefined( T aValue )
535 {
536 m_undefined = aValue;
537 return *this;
538 }
539
540 const wxString& ToString( T value ) const
541 {
542 static const wxString s_undef = "UNDEFINED";
543
544 int idx = m_choices.Index( static_cast<int>( value ) );
545
546 if( idx >= 0 && idx < (int) m_choices.GetCount() )
547 return m_choices.GetLabel( static_cast<int>( idx ) );
548 else
549 return s_undef;
550 }
551
552 bool IsValueDefined( T value ) const
553 {
554 int idx = m_choices.Index( static_cast<int>( value ) );
555
556 if( idx >= 0 && idx < (int) m_choices.GetCount() )
557 return true;
558
559 return false;
560 }
561
562 const T ToEnum( const wxString value )
563 {
564 if( m_reverseMap.count( value ) )
565 return m_reverseMap[ value ];
566 else
567 return m_undefined;
568 }
569
570 wxPGChoices& Choices()
571 {
572 return m_choices;
573 }
574
575private:
576 wxPGChoices m_choices;
577 std::unordered_map<wxString, T> m_reverseMap;
578 T m_undefined; // Returned if the string is not recognized
579
581 {
582 }
583};
584
585
586// Helper macros to handle enum types
587#define DECLARE_ENUM_TO_WXANY( type ) \
588 template <> \
589 class wxAnyValueTypeImpl<type> : public wxAnyValueTypeImplBase<type> \
590 { \
591 WX_DECLARE_ANY_VALUE_TYPE( wxAnyValueTypeImpl<type> ) \
592 public: \
593 wxAnyValueTypeImpl() : wxAnyValueTypeImplBase<type>() {} \
594 virtual ~wxAnyValueTypeImpl() {} \
595 virtual bool ConvertValue( const wxAnyValueBuffer& src, wxAnyValueType* dstType, \
596 wxAnyValueBuffer& dst ) const override \
597 { \
598 type value = GetValue( src ); \
599 ENUM_MAP<type>& conv = ENUM_MAP<type>::Instance(); \
600 if( ! conv.IsValueDefined( value ) ) \
601 { \
602 return false; \
603 } \
604 if( dstType->CheckType<wxString>() ) \
605 { \
606 wxAnyValueTypeImpl<wxString>::SetValue( conv.ToString( value ), dst ); \
607 return true; \
608 } \
609 if( dstType->CheckType<int>() ) \
610 { \
611 wxAnyValueTypeImpl<int>::SetValue( static_cast<int>( value ), dst ); \
612 return true; \
613 } \
614 else \
615 { \
616 return false; \
617 } \
618 } \
619 };
620
621#define IMPLEMENT_ENUM_TO_WXANY( type ) WX_IMPLEMENT_ANY_VALUE_TYPE( wxAnyValueTypeImpl<type> )
622
623#define ENUM_TO_WXANY( type ) \
624 DECLARE_ENUM_TO_WXANY( type ) \
625 IMPLEMENT_ENUM_TO_WXANY( type )
626
628#define NO_SETTER( owner, type ) ( ( void ( owner::* )( type ) ) nullptr )
629
630/*
631#define DECLARE_PROPERTY(owner,type,name,getter,setter) \
632namespace anonymous {\
633static PROPERTY<owner,type> prop##_owner##_name_( "##name#", setter, getter );\
634};
635*/
636#endif /* PROPERTY_H */
ENUM_MAP & Map(T aValue, const wxString &aName)
Definition: property.h:527
std::unordered_map< wxString, T > m_reverseMap
Definition: property.h:577
T m_undefined
Definition: property.h:578
static ENUM_MAP< T > & Instance()
Definition: property.h:521
const wxString & ToString(T value) const
Definition: property.h:540
bool IsValueDefined(T value) const
Definition: property.h:552
ENUM_MAP & Undefined(T aValue)
Definition: property.h:534
wxPGChoices & Choices()
Definition: property.h:570
wxPGChoices m_choices
Definition: property.h:576
const T ToEnum(const wxString value)
Definition: property.h:562
virtual ~GETTER_BASE()
Definition: property.h:69
virtual T operator()(const Owner *aOwner) const =0
GETTER(FuncType aFunc)
Definition: property.h:78
FuncType m_func
Definition: property.h:90
T operator()(const Owner *aOwner) const override
Definition: property.h:84
Class that other classes need to inherit from, in order to be inspectable.
Definition: inspectable.h:36
static constexpr GETTER_BASE< Owner, T > * Wrap(const T(Base::*aFunc)())
Definition: property.h:131
static GETTER_BASE< Owner, T > * Wrap(T(Base::*aFunc)())
Definition: property.h:126
static constexpr GETTER_BASE< Owner, T > * Wrap(const T(Base::*aFunc)() const)
Definition: property.h:146
static constexpr GETTER_BASE< Owner, T > * Wrap(T(Base::*aFunc)() const)
Definition: property.h:141
static constexpr SETTER_BASE< Owner, T > * Wrap(void(Base::*aFunc)(const T &))
Definition: property.h:166
static constexpr GETTER_BASE< Owner, T > * Wrap(const T &(Base::*aFunc)())
Definition: property.h:136
static constexpr GETTER_BASE< Owner, T > * Wrap(const T &(Base::*aFunc)() const)
Definition: property.h:151
static constexpr SETTER_BASE< Owner, T > * Wrap(void(Base::*aFunc)(T))
Definition: property.h:156
static constexpr SETTER_BASE< Owner, T > * Wrap(void(Base::*aFunc)(T &))
Definition: property.h:161
METHOD()=delete
COORD_TYPES_T
The supported Display Origin Transform types.
const PROPERTY_DISPLAY m_display
Definition: property.h:291
const ORIGIN_TRANSFORMS::COORD_TYPES_T m_coordType
Definition: property.h:292
void SetAvailableFunc(std::function< bool(INSPECTABLE *)> aFunc)
Set a callback function to determine whether an object provides this property.
Definition: property.h:237
virtual size_t TypeHash() const =0
Return type-id of the property type.
const wxString m_name
Definition: property.h:290
std::function< bool(INSPECTABLE *)> m_availFunc
Eval to determine if prop is available.
Definition: property.h:294
PROPERTY_DISPLAY Display() const
Definition: property.h:259
PROPERTY_BASE(const wxString &aName, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
< Used to generate unique IDs. Must come up front so it's initialized before ctor.
Definition: property.h:181
ORIGIN_TRANSFORMS::COORD_TYPES_T CoordType() const
Definition: property.h:264
virtual wxAny getter(const void *aObject) const =0
virtual size_t BaseHash() const =0
Return type-id of the Base class.
virtual bool HasChoices() const
Return true if this PROPERTY has a limited set of possible values.
Definition: property.h:221
virtual void setter(void *aObject, wxAny &aValue)=0
virtual ~PROPERTY_BASE()
Definition: property.h:190
bool Available(INSPECTABLE *aObject) const
Return true if aObject offers this PROPERTY.
Definition: property.h:229
virtual bool IsReadOnly() const =0
void set(void *aObject, T aValue)
Definition: property.h:268
const wxString & Name() const
Definition: property.h:194
virtual const wxPGChoices & Choices() const
Return a limited set of possible values (e.g.
Definition: property.h:203
virtual void SetChoices(const wxPGChoices &aChoices)
Set the possible values for for the property.
Definition: property.h:212
virtual size_t OwnerHash() const =0
Return type-id of the Owner class.
T get(const void *aObject) const
Definition: property.h:275
const wxPGChoices & Choices() const override
Return a limited set of possible values (e.g.
Definition: property.h:454
bool HasChoices() const override
Return true if this PROPERTY has a limited set of possible values.
Definition: property.h:464
PROPERTY_ENUM(const wxString &aName, void(Base::*aSetter)(SetType), GetType(Base::*aGetter)() const, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
Definition: property.h:412
void setter(void *obj, wxAny &v) override
Definition: property.h:426
PROPERTY_ENUM(const wxString &aName, void(Base::*aSetter)(SetType), GetType(Base::*aGetter)(), PROPERTY_DISPLAY aDisplay=PT_DEFAULT)
Definition: property.h:398
wxPGChoices m_choices
Definition: property.h:470
wxAny getter(const void *obj) const override
Set method.
Definition: property.h:447
void SetChoices(const wxPGChoices &aChoices) override
Set the possible values for for the property.
Definition: property.h:459
std::unique_ptr< SETTER_BASE< Owner, T > > m_setter
Get method.
Definition: property.h:377
const size_t m_baseHash
Property value type-id.
Definition: property.h:386
size_t TypeHash() const override
Return type-id of the property type.
Definition: property.h:336
typename std::decay< T >::type BASE_TYPE
Definition: property.h:304
const size_t m_typeHash
Definition: property.h:389
virtual ~PROPERTY()
Definition: property.h:355
virtual void setter(void *obj, wxAny &v) override
Definition: property.h:357
size_t BaseHash() const override
Return type-id of the Base class.
Definition: property.h:331
virtual wxAny getter(const void *obj) const override
Set method.
Definition: property.h:369
PROPERTY(const wxString &aName, void(Base::*aSetter)(SetType), GetType(Base::*aGetter)() const, PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
Definition: property.h:317
std::unique_ptr< GETTER_BASE< Owner, T > > m_getter
Owner class type-id.
Definition: property.h:380
PROPERTY(const wxString &aName, void(Base::*aSetter)(SetType), GetType(Base::*aGetter)(), PROPERTY_DISPLAY aDisplay=PT_DEFAULT, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType=ORIGIN_TRANSFORMS::NOT_A_COORD)
Definition: property.h:307
PROPERTY(const wxString &aName, SETTER_BASE< Owner, T > *s, GETTER_BASE< Owner, T > *g, PROPERTY_DISPLAY aDisplay, ORIGIN_TRANSFORMS::COORD_TYPES_T aCoordType)
Definition: property.h:347
size_t OwnerHash() const override
Return type-id of the Owner class.
Definition: property.h:326
bool IsReadOnly() const override
Definition: property.h:341
const size_t m_ownerHash
Base class type-id.
Definition: property.h:383
virtual void operator()(Owner *aOwner, T aValue)=0
virtual ~SETTER_BASE()
Definition: property.h:97
void operator()(Owner *aOwner, T aValue) override
Definition: property.h:112
FuncType m_func
Definition: property.h:118
SETTER(FuncType aFunc)
Definition: property.h:106
virtual const void * operator()(const void *aPointer) const =0
virtual size_t BaseHash() const =0
virtual void * operator()(void *aPointer) const =0
virtual ~TYPE_CAST_BASE()
Definition: property.h:477
virtual size_t DerivedHash() const =0
TYPE_CAST()
Definition: property.h:489
size_t DerivedHash() const override
Definition: property.h:510
const void * operator()(const void *aPointer) const override
Definition: property.h:499
size_t BaseHash() const override
Definition: property.h:505
void * operator()(void *aPointer) const override
Definition: property.h:493
static bool empty(const wxTextEntryBase *aCtrl)
#define TYPE_HASH(x)
Definition: property.h:61
PROPERTY_DISPLAY
Common property types.
Definition: property.h:52
@ PT_DEGREE
Angle expressed in degrees.
Definition: property.h:56
@ PT_COORD
Coordinate expressed in distance units (mm/inch)
Definition: property.h:55
@ PT_DECIDEGREE
Angle expressed in decidegrees.
Definition: property.h:57
@ PT_DEFAULT
Default property for a given type.
Definition: property.h:53
@ PT_SIZE
Size expressed in distance units (mm/inch)
Definition: property.h:54