00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __WXDOCPROP_H__
00021 #define __WXDOCPROP_H__
00022
00023
00024 #include "wx/filename.h"
00025 #include "wx/colour.h"
00026
00027
00028 #include <wx/mstream.h>
00029
00030 #include "wx/general/smrtptr.h"
00031 #include "wx/general/a2dmemmgr.h"
00032 #include "wx/general/id.h"
00033
00034
00035 #include <wx/txtstrm.h>
00036
00037 #if defined(__VISUALC__) && (_MSC_VER <= 1300)
00038 #define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 1
00039 #define _CRT_SECURE_NO_DEPRECATE 1
00040
00041 #undef wxSTD
00042 #define wxSTD std::
00043 #endif // VC++ >= 7
00044
00045 #if wxUSE_STD_IOSTREAM
00046 #include "wx/ioswrap.h"
00047 #include <fstream>
00048 #include <sstream>
00049 #else
00050 #include "wx/wfstream.h"
00051 #include <wx/sstream.h>
00052 #endif
00053
00054
00055 #undef wxDynamicCast
00056 #if wxCHECK_VERSION(2, 5, 0)
00057 #define wxDynamicCast(obj, className) \
00058 ((className *) wxCheckDynamicCast(const_cast<className*>(static_cast<const className*>(obj)), &className::ms_classInfo))
00059 #else
00060 #define wxDynamicCast(obj, className) \
00061 ((className *) wxCheckDynamicCast(const_cast<className*>(static_cast<const className*>(obj)), &className::sm_class##className))
00062 #endif
00063
00064
00065
00066 #undef wxStaticCast
00067
00068 #ifdef __WXDEBUG__
00069
00070 inline void* wxCheckCastFixed(void *ptr)
00071 {
00072 wxASSERT_MSG( ptr, _T("wxStaticCast() used incorrectly") );
00073 return ptr;
00074 }
00075 #define wxStaticCast(obj, className) \
00076 ((className *)wxCheckCastFixed(wxDynamicCast(obj, className)))
00077
00078 #define wxStaticCastConst(obj, className) \
00079 ((const className *)wxCheckCastFixed(wxDynamicCast(obj, className)))
00080
00081
00082 inline wxObject* wxCheckCastNull(wxObject *obj, wxClassInfo *clssInfo)
00083 {
00084 if(!obj) return 0;
00085 wxASSERT_MSG( wxCheckDynamicCast(obj, clssInfo), _T("wxStaticCast() used incorrectly") );
00086 return obj;
00087 }
00088
00089 #if wxCHECK_VERSION(2, 5, 0)
00090 #define wxStaticCastNull(obj, className) \
00091 ((className *)wxCheckCastNull(const_cast<wxObject*>(static_cast<const wxObject*>(obj)), &className::ms_classInfo))
00092 #else
00093 #define wxStaticCastNull(obj, className) \
00094 ((className *)wxCheckCastNull(const_cast<wxObject*>(static_cast<const wxObject*>(obj)), &className::sm_class##className))
00095 #endif
00096
00097
00098 #if wxCHECK_VERSION(2, 5, 0)
00099 #define wxStaticCastTmpl(obj, className) wxStaticCast(obj, className)
00100 #define wxStaticCastNullTmpl(obj, className) wxStaticCastNull(obj, className)
00101 #else
00102 #define wxStaticCastTmpl(obj, className) ((className *)(wxObject*)(obj))
00103 #define wxStaticCastNullTmpl(obj, className) ((className *)(wxObject*)(obj))
00104 #endif
00105
00106 #else // !__WXDEBUG__
00107
00108 #define wxStaticCast(obj, className) ((className *)(wxObject*)(obj))
00109 #define wxStaticCastConst(obj, className) ((const className *)(wxObject*)(obj))
00110 #define wxStaticCastNull(obj, className) ((className *)(wxObject*)(obj))
00111 #define wxStaticCastTmpl(obj, className) ((className *)(wxObject*)(obj))
00112 #define wxStaticCastNullTmpl(obj, className) ((className *)(wxObject*)(obj))
00113
00114 #endif // __WXDEBUG__
00115
00116
00117
00118
00119
00120
00121 A2DGENERALDLLEXP long wxGenNewId();
00122
00123
00124
00125
00126
00127
00128 A2DGENERALDLLEXP void wxGenRegisterId( long id );
00129
00130 class A2DGENERALDLLEXP a2dObjectList;
00131 class A2DGENERALDLLEXP a2dResolveIdList;
00132 class A2DGENERALDLLEXP a2dIOHandler;
00133
00134 #if wxART2D_USE_CVGIO
00135
00136 class a2dIOHandlerXmlSerIn;
00137 class a2dIOHandlerXmlSerOut;
00138
00139
00140 enum a2dXmlSer_flag {
00141 a2dXmlSer_attrib,
00142 a2dXmlSer_Content
00143 };
00144
00145 #endif //wxART2D_USE_CVGIO
00146
00147 class A2DGENERALDLLEXP a2dWalkerIOHandler;
00148
00149
00150 typedef int a2dErrorWarningCode;
00151
00152
00153 #include "wx/xrc/xmlres.h"
00154
00155 #include <map>
00156 class A2DGENERALDLLEXP a2dError;
00157 typedef std::map< wxString, a2dError* > a2dErrorHash;
00158 #include <vector>
00159 typedef std::vector< a2dError > a2dErrorVector;
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170 class A2DGENERALDLLEXP a2dError: public wxObject
00171 {
00172 public:
00173
00174
00175 a2dError( const wxString& errorIdName = wxEmptyString, const wxString &error = wxEmptyString, bool warning = false )
00176 {
00177 if ( errorIdName == wxEmptyString )
00178 m_code = wxXmlResource::GetXRCID( wxT("a2dError_NoError") );
00179 else
00180 m_code = wxXmlResource::GetXRCID( errorIdName );
00181 m_error = error;
00182 m_warning = warning;
00183 }
00184
00185 a2dError( const a2dError& error )
00186 {
00187 m_code = error.m_code;
00188 m_error = error.m_error;
00189 m_warning = error.m_warning;
00190 }
00191
00192 bool operator==(const a2dError& a)
00193 {
00194 return m_code == a.m_code;
00195 }
00196
00197 bool operator!=(const a2dError& a)
00198 {
00199 return m_code != a.m_code;
00200 }
00201
00202 friend inline bool operator==(const a2dError& a, const a2dError& b)
00203 {
00204 return a.m_code == b.m_code;
00205 }
00206
00207 friend inline bool operator!=(const a2dError& a, const a2dError& b)
00208 {
00209 return a.m_code != b.m_code;
00210 }
00211
00212
00213 wxString GetIdName() const { return m_errorIdName; }
00214
00215
00216 inline wxString GetErrorMessage() const { return m_error; }
00217
00218 inline a2dErrorWarningCode GetErrorCode() const { return m_code; }
00219
00220
00221 inline void SetErrorMessage( const wxString& error ) { m_error = error; }
00222
00223 inline void SetErrorCode( a2dErrorWarningCode code ) { m_code = code; }
00224
00225 static a2dErrorHash& GetHashMap();
00226
00227 private:
00228
00229 wxString m_errorIdName;
00230
00231
00232 wxString m_error;
00233
00234
00235 wxString m_format;
00236
00237
00238 a2dErrorWarningCode m_code;
00239
00240
00241 bool m_warning;
00242 };
00243
00244 extern const a2dError a2dError_NoError;
00245 extern const a2dError a2dError_CommandError;
00246 extern const a2dError a2dError_NotSpecified;
00247 extern const a2dError a2dError_CanceledFileDialog;
00248 extern const a2dError a2dError_FileCouldNotOpen;
00249 extern const a2dError a2dError_CouldNotCreateDocument;
00250 extern const a2dError a2dError_NoDocTemplateRef;
00251 extern const a2dError a2dError_DocumentsOpened;
00252 extern const a2dError a2dError_SetEnv;
00253 extern const a2dError a2dError_GetEnv;
00254 extern const a2dError a2dError_GetVar;
00255 extern const a2dError a2dError_SaveFile;
00256 extern const a2dError a2dError_LoadFile;
00257 extern const a2dError a2dError_ExportFile;
00258 extern const a2dError a2dError_ImportFile;
00259 extern const a2dError a2dError_IOHandler;
00260 extern const a2dError a2dError_SaveObject;
00261 extern const a2dError a2dError_LoadObject;
00262 extern const a2dError a2dError_FileHistory;
00263 extern const a2dError a2dError_ImportObject;
00264 extern const a2dError a2dError_XMLparse;
00265 extern const a2dError a2dError_LoadLayers;
00266 extern const a2dError a2dError_property;
00267 extern const a2dError a2dError_NoView;
00268 extern const a2dError a2dError_NoDocument;
00269 extern const a2dError a2dError_NoController;
00270 extern const a2dError a2dError_NoTool;
00271 extern const a2dError a2dError_LinkRef;
00272 extern const a2dError a2dError_NoWrapper;
00273 extern const a2dError a2dError_LinkPin;
00274 extern const a2dError a2dError_NoPinClass;
00275 extern const a2dError a2dError_CouldNotEvaluatePath;
00276 extern const a2dError a2dError_Canceled;
00277 extern const a2dError a2dError_CouldNotLoad;
00278 extern const a2dError a2dError_NoSelection;
00279 extern const a2dError a2dError_ToManyOpen;
00280 extern const a2dError a2dError_canvasObjectRelease;
00281
00282
00283 class A2DGENERALDLLEXP a2dObject;
00284 class A2DGENERALDLLEXP a2dHashMapIntToObject;
00285 class A2DGENERALDLLEXP a2dHashMapIntToObject_wxImplementation_HashTable;
00286 class A2DGENERALDLLEXP a2dHashMapIntToObject_wxImplementation_KeyEx;
00287
00288 class A2DGENERALDLLEXP a2dHashMapCreateObject;
00289 class A2DGENERALDLLEXP a2dHashMapCreateObject_wxImplementation_HashTable;
00290 class A2DGENERALDLLEXP a2dHashMapCreateObject_wxImplementation_KeyEx;
00291
00292 class A2DGENERALDLLEXP a2dNamedProperty;
00293
00294
00295 WX_DECLARE_HASH_MAP_WITH_DECL( wxString, class a2dObject*, wxStringHash, wxStringEqual, a2dHashMapIntToObject, class A2DGENERALDLLEXP );
00296
00297
00298 WX_DECLARE_HASH_MAP_WITH_DECL( wxString, wxString, wxStringHash, wxStringEqual, a2dHashMapCreateObject, class A2DGENERALDLLEXP );
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312 class A2DGENERALDLLEXP a2dResolveIdInfo : public wxObject
00313 {
00314 public:
00315 a2dResolveIdInfo( const wxString& idStr, a2dSmrtPtr<a2dObject>* storedHere )
00316 {
00317 m_mode = mode_a2dObjectSmrtPtr;
00318 m_idStr = idStr;
00319 m_storedHere.m_a2dObjectSmrtPtr = storedHere;
00320 }
00321
00322 a2dResolveIdInfo( const wxString& idStr, a2dAutoZeroPtr<a2dObject>* storedHere )
00323 {
00324 m_mode = mode_a2dObjectAutoZeroPtr;
00325 m_idStr = idStr;
00326 m_storedHere.m_a2dObjectAutoZeroPtr = storedHere;
00327 }
00328
00329 a2dResolveIdInfo( const wxString& idStr, a2dObject *link )
00330 {
00331 m_mode = mode_link;
00332 m_idStr = idStr;
00333 m_storedHere.m_link = link;
00334 }
00335
00336 a2dResolveIdInfo( a2dObject *inform )
00337 {
00338 m_mode = mode_inform;
00339 m_storedHere.m_inform = inform;
00340 }
00341
00342 private:
00343 bool Assign( a2dObject *ptr );
00344
00345 enum Mode {
00346 mode_a2dObjectSmrtPtr,
00347 mode_a2dObjectAutoZeroPtr,
00348 mode_link,
00349 mode_inform
00350 };
00351
00352 Mode m_mode;
00353
00354 wxString m_idStr;
00355
00356 union UPtr
00357 {
00358 a2dSmrtPtr<a2dObject> *m_a2dObjectSmrtPtr;
00359 a2dAutoZeroPtr<a2dObject> *m_a2dObjectAutoZeroPtr;
00360 a2dObject *m_link;
00361 a2dObject *m_inform;
00362 } m_storedHere;
00363
00364 friend class a2dResolveIdList;
00365 friend class a2dIOHandler;
00366 };
00367
00368 WX_DECLARE_LIST_WITH_DECL( a2dResolveIdInfo, a2dResolveIdList, class A2DGENERALDLLEXP );
00369
00370 #include <map>
00371 typedef a2dSmrtPtr<a2dPropertyId> a2dPropertyIdPtr;
00372 typedef std::map< wxString, a2dPropertyIdPtr > a2dDynamicIdMap;
00373
00374
00375
00376
00377
00378 #define DECLARE_PROPERTIES() \
00379 static bool InitializePropertyIds();\
00380 static a2dDynamicIdMap& GetPropertyIdMap();\
00381 static bool AddPropertyId( a2dPropertyId *dynproperty );\
00382 virtual bool HasPropertyId( const a2dPropertyId* id ) const;\
00383 virtual a2dPropertyId* HasPropertyId( const wxString& name );\
00384 virtual const a2dNamedProperty* FindProperty( const wxString &idName ) const;\
00385 virtual void CollectProperties2( a2dNamedPropertyList *total, const a2dPropertyId *id = NULL, a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) const;\
00386 private:\
00387 static a2dDynamicIdMap sm_dymPropIds;
00388
00389 #define INITIALIZE_PROPERTIES_BASE( classname ) \
00390 a2dDynamicIdMap& classname::GetPropertyIdMap() \
00391 {\
00392 return sm_dymPropIds;\
00393 }\
00394 bool classname::AddPropertyId( a2dPropertyId *dynproperty )\
00395 {\
00396 if ( sm_dymPropIds.find( dynproperty->GetName() ) == sm_dymPropIds.end() )\
00397 sm_dymPropIds[ dynproperty->GetName() ]= dynproperty;\
00398 else\
00399 wxASSERT_MSG( 0, _("The property id name '") + dynproperty->GetName() + _("' already exists in #classname") );\
00400 return true;\
00401 }\
00402 bool classname::HasPropertyId( const a2dPropertyId* id ) const\
00403 {\
00404 for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
00405 {\
00406 wxString name = (*i).first;\
00407 a2dPropertyIdPtr propId = (*i).second;\
00408 if ( propId == id )\
00409 return true;\
00410 }\
00411 return false;\
00412 }\
00413 a2dPropertyId* classname::HasPropertyId( const wxString& name )\
00414 {\
00415 if ( sm_dymPropIds.find( name ) != sm_dymPropIds.end() )\
00416 return sm_dymPropIds[ name ];\
00417 return NULL;\
00418 }\
00419 const a2dNamedProperty *classname::FindProperty( const wxString &idName ) const\
00420 {\
00421 for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
00422 {\
00423 wxString name = (*i).first;\
00424 a2dPropertyIdPtr propId = (*i).second;\
00425 if ( propId->GetName() == idName )\
00426 return GetProperty( propId );\
00427 }\
00428 return 0;\
00429 }\
00430 void classname::CollectProperties2( a2dNamedPropertyList *total, const a2dPropertyId *id, a2dPropertyId::Flags flags ) const\
00431 {\
00432 for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
00433 {\
00434 wxString name = (*i).first;\
00435 a2dPropertyIdPtr p = (*i).second;\
00436 if( p->CheckCollect( id, flags ) )\
00437 {\
00438 a2dNamedProperty* dprop = p->GetPropertyAsNamedProperty( this );\
00439 if ( dprop )\
00440 total->push_back( dprop );\
00441 }\
00442 }\
00443 }\
00444 a2dDynamicIdMap classname::sm_dymPropIds; \
00445 static bool initProp##classname = classname::InitializePropertyIds(); \
00446 bool classname::InitializePropertyIds()
00447
00448
00449 #define INITIALIZE_PROPERTIES( classname, baseclassname ) \
00450 a2dDynamicIdMap& classname::GetPropertyIdMap() \
00451 {\
00452 return sm_dymPropIds;\
00453 }\
00454 bool classname::AddPropertyId( a2dPropertyId *dynproperty )\
00455 {\
00456 if ( sm_dymPropIds.find( dynproperty->GetName() ) == sm_dymPropIds.end() )\
00457 sm_dymPropIds[ dynproperty->GetName() ]= dynproperty;\
00458 else\
00459 wxASSERT_MSG( 0, _("The property id name '") + dynproperty->GetName() + _("' already exists in #classname") );\
00460 return true;\
00461 }\
00462 bool classname::HasPropertyId( const a2dPropertyId* id ) const\
00463 {\
00464 for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
00465 {\
00466 wxString name = (*i).first;\
00467 a2dPropertyIdPtr propId = (*i).second;\
00468 if ( propId == id )\
00469 return true;\
00470 }\
00471 return baseclassname::HasPropertyId( id );\
00472 }\
00473 a2dPropertyId* classname::HasPropertyId( const wxString& name )\
00474 {\
00475 if ( sm_dymPropIds.find( name ) != sm_dymPropIds.end() )\
00476 return sm_dymPropIds[ name ];\
00477 return baseclassname::HasPropertyId( name );\
00478 }\
00479 const a2dNamedProperty *classname::FindProperty( const wxString &idName ) const\
00480 {\
00481 for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
00482 {\
00483 wxString name = (*i).first;\
00484 a2dPropertyIdPtr propId = (*i).second;\
00485 if ( propId->GetName() == idName )\
00486 return GetProperty( propId );\
00487 }\
00488 return baseclassname::FindProperty( idName );\
00489 }\
00490 void classname::CollectProperties2( a2dNamedPropertyList *total, const a2dPropertyId *id, a2dPropertyId::Flags flags ) const\
00491 {\
00492 for ( a2dDynamicIdMap::iterator i = sm_dymPropIds.begin(); i != sm_dymPropIds.end(); i++ )\
00493 {\
00494 wxString name = (*i).first;\
00495 a2dPropertyIdPtr p = (*i).second;\
00496 if( p->CheckCollect( id, flags ) )\
00497 {\
00498 a2dNamedProperty* dprop = p->GetPropertyAsNamedProperty( this );\
00499 if ( dprop )\
00500 total->push_back( dprop );\
00501 }\
00502 }\
00503 return baseclassname::CollectProperties2( total, id, flags );\
00504 }\
00505 a2dDynamicIdMap classname::sm_dymPropIds; \
00506 static bool initProp##classname = classname::InitializePropertyIds(); \
00507 bool classname::InitializePropertyIds()
00508
00509
00510
00511
00512
00513
00514
00515
00516
00517
00518
00519
00520
00521
00522
00523
00524
00525
00526
00527
00528
00529
00530
00531
00532 class A2DGENERALDLLEXP a2dObject : public wxObject
00533 {
00534
00535 DECLARE_ABSTRACT_CLASS(a2dObject)
00536
00537 public:
00538
00539
00540 a2dObject();
00541
00542
00543 a2dObject( const a2dObject &other );
00544
00545
00546 virtual ~a2dObject();
00547
00548
00549 void operator = ( const a2dObject &other );
00550
00551
00552
00553
00554
00555 #if wxUSE_STD_IOSTREAM && (defined(__WXDEBUG__) || wxUSE_DEBUG_CONTEXT)
00556 virtual void Dump(wxSTD ostream& str);
00557 #endif
00558
00559
00560
00561
00562
00563
00564
00565 inline int GetOwnedBy() { return m_refcount; }
00566
00567
00568
00569
00570
00571
00572
00573
00574
00575 virtual a2dObject* SetNonDynamic();
00576
00577
00578
00579
00580
00581
00582 void CheckReferences();
00583
00584
00585
00586
00587
00588
00589
00590
00591
00592 enum CloneOptions {
00593
00594 clone_members = 0x00000001,
00595
00596 clone_properties = 0x00000002,
00597
00598 clone_childs = 0x00000004,
00599
00600 clone_reconnectable = 0x00000008,
00601
00602
00603 clone_setoriginal = 0x00000010,
00604
00605
00606 clone_seteditcopy = 0x00000020,
00607
00608 clone_flat = 0x00000000,
00609 clone_deep = clone_members|clone_properties|clone_childs,
00610 };
00611 friend inline CloneOptions operator|( CloneOptions a, CloneOptions b) {
00612 return (CloneOptions)((int)a | (int) b ); }
00613
00614
00615 virtual a2dObject* Clone( CloneOptions options ) const = 0;
00616
00617
00618 virtual wxString GetName() const;
00619
00620
00621
00622
00623
00624 virtual void SetName(const wxString& WXUNUSED(name)) {}
00625
00626
00627 virtual bool IsTemporary_DontSave() const { return false; }
00628
00629 #if wxART2D_USE_CVGIO
00630
00631
00632
00633
00634
00635
00636 virtual void Save( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dObjectList* towrite );
00637
00638
00639
00640
00641
00642
00643 virtual void Load( wxObject* parent, a2dIOHandlerXmlSerIn& parser );
00644
00645 #endif //wxART2D_USE_CVGIO
00646
00647
00648
00649
00650 wxInt64 GetUniqueSerializationId() const;
00651
00652
00653
00654
00655
00656
00657 virtual bool AlwaysWriteSerializationId() const;
00658
00659
00660
00661 virtual bool LinkReference( a2dObject *other );
00662
00663
00664
00665 virtual void ResolveInform( );
00666
00667
00668 void Walker( wxObject* parent, a2dWalkerIOHandler& handler );
00669
00670
00671
00672
00673
00674
00675
00676
00677
00678
00679
00680
00681 inline void SetCheck(bool check) { m_check = check; }
00682
00683
00684 inline bool GetCheck() const {return m_check;}
00685
00686
00687
00688 void SetRelease( bool value ) { m_release = value; }
00689
00690
00691
00692 bool GetRelease( ) const { return m_release; }
00693
00694
00695
00696
00697
00698
00699
00700
00701 a2dNamedProperty* GetProperty( const a2dPropertyId* propertyId, a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) const;
00702
00703
00704
00705
00706
00707
00708
00709
00710
00711
00712
00713 void SetProperty( a2dNamedProperty *propertyHolder, a2dPropertyId::SetFlags flags = a2dPropertyId::set_none );
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725 void SetProperty( const a2dNamedProperty& propertyHolder, a2dPropertyId::SetFlags flags = a2dPropertyId::set_none );
00726
00727 #ifdef DOXYGEN
00728
00729
00730
00731
00732
00733 const a2dNamedProperty *classname::FindProperty( const wxString &idName ) const;
00734 #endif // DOXYGEN
00735
00736
00737
00738 virtual a2dNamedProperty *FindProperty( const a2dPropertyId* WXUNUSED(id), a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) { return 0; }
00739
00740
00741
00742 virtual const a2dNamedProperty *FindProperty( const a2dPropertyId* WXUNUSED(id), a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) const { return 0; }
00743
00744
00745
00746
00747
00748
00749
00750 virtual bool HasProperty( const a2dPropertyId* id, const wxString &stringvalue = wxEmptyString ) const;
00751
00752
00753
00754
00755
00756 virtual bool AddProperty( a2dNamedProperty *property );
00757
00758
00759
00760 virtual bool RemoveProperty( const a2dPropertyId* WXUNUSED(id), bool all = true );
00761
00762
00763
00764
00765 virtual void OnPropertyChanged( const a2dPropertyId* WXUNUSED(id) ) {}
00766
00767
00768
00769
00770
00771
00772
00773
00774 virtual bool ProcessEvent(wxEvent& WXUNUSED(event)) { return false; }
00775
00776
00777 bool DistributeEvent( wxEvent& event );
00778
00779 public:
00780
00781
00782
00783
00784
00785
00786 a2dAutoZeroPtr<a2dObject> **GetAutoZeroPtrList() { return &m_autozeroptrlist; }
00787
00788 typedef a2dAutoZeroPtr<a2dObject> TAutoZeroPtrListClass;
00789
00790 private:
00791
00792
00793
00794
00795
00796
00797
00798
00799
00800
00801
00802 virtual a2dObject* SmrtPtrOwn() {
00803 m_refcount++; return this; }
00804
00805
00806
00807
00808 virtual bool SmrtPtrRelease();
00809
00810
00811 friend class a2dPropertyId;
00812
00813 protected:
00814
00815
00816
00817
00818 virtual bool DoIgnoreIfNotMember( const a2dPropertyId* id ) const { return id->IsOnlyMember(); }
00819
00820 protected:
00821 virtual void DoWalker( wxObject *parent, a2dWalkerIOHandler& handler );
00822
00823 #if wxART2D_USE_CVGIO
00824
00825 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite ) = 0;
00826
00827 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts ) = 0;
00828 #endif //wxART2D_USE_CVGIO
00829
00830
00831 int m_refcount;
00832
00833
00834 bool m_check:1;
00835
00836
00837 bool m_release:1;
00838
00839
00840 bool m_recursion_active:1;
00841
00842
00843 a2dAutoZeroPtr<a2dObject> *m_autozeroptrlist;
00844
00845
00846 enum { refcount_nondynamic = 0x76543210 };
00847
00848 public:
00849
00850 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
00851
00852 a2dSmrtPtr<a2dObject> *m_ownerlist;
00853
00854 typedef a2dSmrtPtr<a2dObject> TOwnerListClass;
00855
00856
00857 void DumpOwners();
00858 #endif
00859
00860 public:
00861
00862 static a2dPropertyIdBool* PROPID_Check;
00863
00864 DECLARE_PROPERTIES();
00865
00866 private:
00867 friend class a2dSmrtPtrBase;
00868 };
00869
00870
00871 typedef a2dSmrtPtr<a2dObject> a2dObjectPtr;
00872
00873 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
00874
00875
00876
00877 #define a2dREFOBJECTPTR_KEEPALIVE CurrentSmartPointerOwner = this;\
00878 a2dObjectPtr keepalive(__FILE__, __LINE__,(this->m_refcount != 0 ? this : NULL ))
00879 #else
00880
00881
00882
00883 #define a2dREFOBJECTPTR_KEEPALIVE a2dObjectPtr keepalive = (this->m_refcount != 0 ? this : NULL )
00884 #endif
00885
00886
00887 typedef a2dAutoZeroPtr<a2dObject> a2dObjectAutoZeroPtr;
00888
00889
00890
00891
00892
00893
00894
00895
00896
00897
00898
00899
00900 class a2dRefCount
00901 {
00902
00903 public:
00904
00905
00906 a2dRefCount( wxObject* theObjectToWrap )
00907 {
00908 m_refcount = 0;
00909 m_object = theObjectToWrap;
00910 }
00911
00912
00913 virtual ~a2dRefCount()
00914 {
00915 wxASSERT_MSG( m_refcount == 0, wxT("deleting a2dRefCount while referenced") );
00916 delete m_object;
00917 }
00918
00919 wxObject* GetObj() { return m_object; }
00920
00921 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
00922
00923 a2dSmrtPtr<a2dRefCount> *m_ownerlist;
00924
00925 typedef a2dSmrtPtr<a2dRefCount> TOwnerListClass;
00926
00927
00928 void DumpOwners();
00929 #endif
00930
00931 private:
00932
00933
00934
00935
00936
00937
00938
00939
00940
00941
00942
00943 virtual a2dRefCount* SmrtPtrOwn()
00944 {
00945 m_refcount++; return this;
00946 }
00947
00948
00949
00950
00951 virtual bool SmrtPtrRelease()
00952 {
00953 m_refcount--;
00954 wxASSERT_MSG( m_refcount >= 0, wxT("wxRefCount Own/Release not matched (extra Release calls)") );
00955 if ( m_refcount <= 0 )
00956 {
00957 delete this;
00958 return true;
00959 }
00960 return false;
00961 }
00962
00963 friend class a2dSmrtPtrBase;
00964
00965 protected:
00966
00967
00968 int m_refcount;
00969
00970
00971 wxObject* m_object;
00972 };
00973
00974
00975
00976
00977
00978
00979
00980
00981
00982 class a2dRefCountList: public a2dSmrtPtrList< a2dRefCount >
00983 {
00984
00985 public:
00986
00987
00988 a2dRefCountList(){}
00989
00990
00991 ~a2dRefCountList(){}
00992
00993
00994 void push_backobj( wxObject* obj )
00995 {
00996 push_back( new a2dRefCount( obj ) );
00997 }
00998
00999
01000 void push_frontobj( wxObject* obj )
01001 {
01002 push_front( new a2dRefCount( obj ) );
01003 }
01004
01005 };
01006
01007
01008 typedef a2dSmrtPtr< a2dRefCount > a2dRefCountPtr;
01009
01010
01011
01012
01013
01014
01015
01016
01017
01018
01019
01020
01021
01022
01023
01024
01025
01026
01027
01028
01029
01030
01031
01032
01033
01034
01035
01036
01037 class A2DGENERALDLLEXP a2dNamedProperty : public a2dObject
01038 {
01039
01040 #ifdef CLASS_MEM_MANAGEMENT
01041
01042
01043 static a2dMemManager sm_memManager;
01044
01045 public:
01046
01047
01048 void* operator new(size_t bytes )
01049 {
01050 return sm_memManager.Allocate(bytes);
01051 }
01052
01053
01054
01055
01056
01057
01058
01059 void operator delete(void *space, size_t bytes)
01060 {
01061 sm_memManager.Deallocate(space, bytes);
01062 }
01063
01064 #endif //CLASS_MEM_MANAGEMENT
01065
01066 public:
01067
01068 a2dNamedProperty();
01069
01070
01071 a2dNamedProperty( const a2dPropertyId* id );
01072
01073
01074 a2dNamedProperty( const a2dNamedProperty &other );
01075
01076
01077 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const = 0;
01078
01079
01080 virtual void Assign( const a2dNamedProperty &other ) = 0;
01081
01082
01083 virtual ~a2dNamedProperty();
01084
01085
01086
01087 inline void SetToObject ( a2dObject *obj, a2dPropertyId::SetFlags setflags = a2dPropertyId::set_none ) { obj->SetProperty( this, setflags ); }
01088
01089
01090
01091 inline void SetToObjectClone( a2dObject *obj, a2dPropertyId::SetFlags setflags = a2dPropertyId::set_none ) const { obj->SetProperty( *this, setflags ); }
01092
01093
01094 const a2dPropertyId* GetId() const { wxASSERT_MSG( m_id, wxT("id not set in property")); return m_id; }
01095
01096
01097 wxString GetName() const { return m_id->GetName(); }
01098
01099
01100 virtual wxString GetString() const;
01101
01102
01103 virtual double GetDouble() const;
01104
01105
01106 virtual float GetFloat() const;
01107
01108
01109 virtual bool GetBool() const;
01110
01111
01112 virtual wxInt16 GetInt16() const;
01113
01114
01115 virtual wxUint16 GetUint16() const;
01116
01117
01118 virtual wxInt32 GetInt32() const;
01119
01120
01121 virtual wxUint32 GetUint32() const;
01122
01123
01124 virtual void* GetVoidPtr() const;
01125
01126
01127 virtual a2dObject* GetRefObject() const;
01128
01129
01130 virtual a2dObject* GetRefObjectNA() const;
01131
01132
01133
01134 virtual wxString StringRepresentation() const { return m_id->GetName(); }
01135
01136
01137
01138 virtual wxString StringValueRepresentation() const { wxASSERT(0); return wxT(""); }
01139
01140
01141 virtual bool GetVisible() const { return true; }
01142
01143
01144
01145
01146
01147
01148
01149 virtual bool GetCanRender() const { return false; }
01150
01151
01152 double ParseDouble( unsigned int& position );
01153
01154 void SkipCommaSpaces( unsigned int& position );
01155
01156 void SkipSpaces( unsigned int& position );
01157
01158
01159
01160
01161 void Walker( wxObject* parent, a2dWalkerIOHandler& handler );
01162 virtual void DoWalker( wxObject *parent, a2dWalkerIOHandler& handler );
01163
01164 #if wxART2D_USE_CVGIO
01165 virtual void Save( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dObjectList* towrite );
01166 virtual void Load( wxObject* parent, a2dIOHandlerXmlSerIn& parser );
01167 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01168 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01169 #endif //wxART2D_USE_CVGIO
01170
01171 DECLARE_CLASS(a2dNamedProperty)
01172
01173 protected:
01174
01175 const a2dPropertyId* m_id;
01176
01177 friend class a2dPropertyId;
01178
01179 #ifdef _DEBUG
01180 int _debug_id;
01181 #endif
01182
01183 public:
01184 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
01185 a2dNamedPropertyList *m_ownerlist;
01186 #endif
01187 };
01188
01189
01190 typedef a2dSmrtPtr<a2dNamedProperty> a2dNamedPropertyPtr;
01191
01192
01193
01194
01195
01196
01197
01198
01199 class A2DGENERALDLLEXP a2dNamedPropertyList : public a2dSmrtPtrList<a2dNamedProperty>
01200 {
01201 public:
01202
01203 a2dNamedPropertyList()
01204 {
01205 }
01206
01207 a2dNamedPropertyList( const a2dNamedPropertyList &other );
01208
01209 ~a2dNamedPropertyList();
01210
01211
01212 bool Remove( const a2dPropertyId* id, bool all = true );
01213
01214 void RemoveTemporary();
01215
01216
01217 void Walker( wxObject* parent, a2dWalkerIOHandler& handler );
01218
01219
01220 #if defined(_DEBUG) && defined (SMART_POINTER_DEBUG)
01221 wxObject *m_owner;
01222 #endif
01223
01224 };
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236
01237
01238
01239
01240
01241
01242
01243
01244
01245
01246
01247
01248
01249
01250
01251
01252
01253
01254
01255
01256 class A2DGENERALDLLEXP a2dPropObject: public a2dObject
01257 {
01258
01259 protected:
01260
01261 public:
01262
01263 DECLARE_DYNAMIC_CLASS(a2dPropObject)
01264
01265
01266 a2dPropObject();
01267
01268
01269 a2dPropObject( const a2dPropObject &other, CloneOptions options );
01270
01271
01272 virtual a2dObject* Clone( CloneOptions options ) const;
01273
01274
01275 virtual ~a2dPropObject();
01276
01277
01278
01279
01280
01281 void TakeOverProperties( a2dPropObject* from, a2dPropertyIdList* listOfIds );
01282
01283 public:
01284
01285 #if wxART2D_USE_CVGIO
01286
01287
01288 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01289
01290
01291 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01292
01293 #endif //wxART2D_USE_CVGIO
01294
01295
01296
01297
01298
01299
01300 public:
01301
01302
01303
01304
01305
01306
01307 wxString GetURL() const;
01308
01309
01310
01311
01312
01313
01314
01315
01316
01317
01318
01319
01320 void SetURL( const wxString& url );
01321
01322
01323
01324
01325 const a2dNamedPropertyList& GetPropertyList() const { return m_propertylist; }
01326
01327
01328 bool HasDynamicProperties() const
01329 {
01330 return !m_propertylist.empty();
01331 }
01332
01333
01334
01335
01336
01337
01338 virtual bool EditProperties( const a2dPropertyId *id, bool withUndo = true );
01339
01340
01341
01342
01343
01344
01345
01346
01347 bool RemoveProperty( const a2dPropertyId* id, bool all = true );
01348
01349
01350
01351
01352
01353 void RemoveTemporaryProperties( );
01354
01355
01356
01357
01358
01359
01360 virtual a2dNamedProperty *FindProperty( const a2dPropertyId* id, a2dPropertyId::Flags flags = a2dPropertyId::flag_none );
01361
01362
01363
01364
01365
01366
01367 virtual const a2dNamedProperty *FindProperty( const a2dPropertyId* id, a2dPropertyId::Flags flags = a2dPropertyId::flag_none ) const;
01368
01369
01370
01371
01372
01373
01374
01375
01376
01377
01378
01379
01380
01381
01382 virtual wxString GetName() const;
01383
01384
01385
01386
01387
01388 virtual void SetName(const wxString& name);
01389
01390 protected:
01391
01392 virtual bool AddProperty( a2dNamedProperty *property );
01393
01394 friend class a2dPropertyId;
01395
01396
01397
01398
01399
01400
01401
01402
01403
01404
01405
01406
01407
01408
01409
01410
01411
01412
01413
01414
01415 virtual void DoWalker( wxObject *parent, a2dWalkerIOHandler& handler );
01416
01417
01418 a2dNamedPropertyList m_propertylist;
01419
01420 public:
01421
01422
01423 static a2dPropertyIdString* PROPID_URL;
01424 static a2dPropertyIdString* PROPID_Name;
01425 static a2dPropertyIdVoidPtr* PROPID_autozeroptrlist;
01426
01427
01428 static const wxEventType sm_Edit_properties;
01429
01430 DECLARE_PROPERTIES();
01431
01432 private:
01433
01434
01435 a2dPropObject( const a2dPropObject &other );
01436 };
01437
01438 #if defined(WXDOCVIEW_USINGDLL)
01439 template class A2DGENERALDLLEXP a2dSmrtPtr< a2dPropObject >;
01440 #endif
01441
01442
01443
01444
01445
01446
01447 class A2DGENERALDLLEXP a2dBoolProperty: public a2dNamedProperty
01448 {
01449 public:
01450
01451 a2dBoolProperty();
01452
01453 a2dBoolProperty( const a2dPropertyIdBool* id, bool deep = true );
01454
01455 a2dBoolProperty(const a2dBoolProperty &other, a2dObject::CloneOptions options );
01456
01457 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01458
01459 virtual void Assign( const a2dNamedProperty &other );
01460
01461 virtual ~a2dBoolProperty();
01462
01463
01464
01465
01466
01467
01468
01469
01470
01471
01472 static a2dBoolProperty *CreatePropertyFromString( const a2dPropertyIdBool* id, const wxString &value );
01473
01474 void SetValue( bool value );
01475
01476 bool GetValue() const { return m_value; }
01477
01478 virtual bool GetBool() const { return m_value; }
01479
01480 bool* GetValuePtr() { return &m_value; }
01481
01482 bool& GetValueRef() { return m_value; }
01483
01484 const bool* GetValuePtr() const { return &m_value; }
01485
01486 const bool& GetValueRef() const { return m_value; }
01487
01488 virtual wxString StringRepresentation() const;
01489
01490 virtual wxString StringValueRepresentation() const;
01491
01492 #if wxART2D_USE_CVGIO
01493 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01494 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01495 #endif //wxART2D_USE_CVGIO
01496
01497 DECLARE_DYNAMIC_CLASS(a2dBoolProperty)
01498
01499 protected:
01500
01501 bool m_value;
01502 };
01503
01504
01505
01506
01507
01508 class A2DGENERALDLLEXP a2dStringProperty: public a2dNamedProperty
01509 {
01510 public:
01511
01512 a2dStringProperty();
01513
01514 a2dStringProperty( const a2dPropertyIdString* id, const wxString& value );
01515
01516 a2dStringProperty(const a2dStringProperty &other, a2dObject::CloneOptions options );
01517
01518 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01519
01520 virtual void Assign( const a2dNamedProperty &other );
01521
01522 virtual ~a2dStringProperty();
01523
01524
01525
01526 static a2dStringProperty *CreatePropertyFromString( const a2dPropertyIdString* id, const wxString &value );
01527
01528 void SetValue( const wxString& value );
01529
01530 wxString& GetValue() { return m_value; }
01531 const wxString& GetValue() const { return m_value; }
01532
01533 virtual wxString GetString() const { return m_value; }
01534
01535 wxString* GetValuePtr() { return &m_value; }
01536
01537 virtual wxString StringRepresentation() const { return m_id->GetName() + m_value; };
01538
01539 virtual wxString StringValueRepresentation() const { return m_value; };
01540
01541 #if wxART2D_USE_CVGIO
01542 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01543 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01544 #endif //wxART2D_USE_CVGIO
01545
01546 DECLARE_DYNAMIC_CLASS(a2dStringProperty)
01547
01548 protected:
01549
01550 wxString m_value;
01551 };
01552
01553
01554
01555
01556
01557 class A2DGENERALDLLEXP a2dVoidPtrProperty: public a2dNamedProperty
01558 {
01559 public:
01560
01561 a2dVoidPtrProperty();
01562
01563 a2dVoidPtrProperty( const a2dPropertyIdVoidPtr* id, void* value );
01564
01565 a2dVoidPtrProperty(const a2dVoidPtrProperty &other );
01566
01567 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01568
01569 virtual void Assign( const a2dNamedProperty &other );
01570
01571 virtual ~a2dVoidPtrProperty();
01572
01573
01574
01575 static a2dVoidPtrProperty *CreatePropertyFromString( const a2dPropertyIdVoidPtr* id, const wxString &value );
01576
01577 void SetValue( void* value );
01578
01579 void* GetValue() const { return m_value; }
01580
01581 virtual void* GetVoidPtr() const { return m_value; }
01582
01583 void** GetValuePtr() { return &m_value; }
01584
01585 virtual wxString StringRepresentation() const;
01586
01587 virtual wxString StringValueRepresentation() const;
01588
01589 #if wxART2D_USE_CVGIO
01590 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01591 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01592 #endif //wxART2D_USE_CVGIO
01593
01594 DECLARE_DYNAMIC_CLASS(a2dVoidPtrProperty)
01595
01596 protected:
01597
01598 void* m_value;
01599 };
01600
01601
01602
01603
01604
01605 class A2DGENERALDLLEXP a2dObjectProperty: public a2dNamedProperty
01606 {
01607 public:
01608
01609 a2dObjectProperty();
01610
01611 a2dObjectProperty( const a2dPropertyIdObject* id, const wxObject& value );
01612
01613 a2dObjectProperty( const a2dObjectProperty &other );
01614
01615 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01616
01617 virtual void Assign( const a2dNamedProperty &other );
01618
01619 virtual ~a2dObjectProperty();
01620
01621
01622
01623 static a2dObjectProperty *CreatePropertyFromString( const a2dPropertyIdObject* id, const wxString &value );
01624
01625 void SetValue( const wxObject& value );
01626
01627 const wxObject& GetValue() const { return m_value; }
01628
01629 DECLARE_DYNAMIC_CLASS(a2dObjectProperty)
01630
01631 protected:
01632
01633 wxObject m_value;
01634 };
01635
01636
01637
01638
01639
01640 class A2DGENERALDLLEXP a2dProperty: public a2dNamedProperty
01641 {
01642 public:
01643
01644 a2dProperty();
01645
01646 a2dProperty( const a2dPropertyIdRefObject* id, a2dObject *value );
01647
01648 a2dProperty(const a2dProperty &other, a2dObject::CloneOptions options );
01649
01650 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01651
01652 virtual void Assign( const a2dNamedProperty &other );
01653
01654 virtual ~a2dProperty();
01655
01656
01657
01658 static a2dProperty *CreatePropertyFromString( const a2dPropertyIdRefObject* id, const wxString &value );
01659
01660 void SetValue( a2dObject *value );
01661
01662 virtual a2dObject* GetRefObject() const { return m_value; }
01663 virtual a2dObject* GetRefObjectNA() const { return m_value; }
01664
01665 a2dObject *GetValue() const { return m_value; }
01666
01667 a2dObjectPtr *GetValuePtr() { return &m_value; }
01668
01669 a2dObjectPtr &GetValueRef() { return m_value; }
01670
01671 virtual wxString StringRepresentation() const;
01672
01673 virtual wxString StringValueRepresentation() const;
01674
01675 #if wxART2D_USE_CVGIO
01676 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01677 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01678 #endif //wxART2D_USE_CVGIO
01679
01680 DECLARE_DYNAMIC_CLASS(a2dProperty)
01681
01682 protected:
01683
01684 a2dObjectPtr m_value;
01685 };
01686
01687
01688
01689
01690
01691 class A2DGENERALDLLEXP a2dAutoZeroProperty: public a2dNamedProperty
01692 {
01693 public:
01694
01695 a2dAutoZeroProperty();
01696
01697 a2dAutoZeroProperty( const a2dPropertyIdRefObjectAutoZero* id, a2dObject *value );
01698
01699 a2dAutoZeroProperty(const a2dAutoZeroProperty &other, a2dObject::CloneOptions options );
01700
01701 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01702
01703 virtual void Assign( const a2dNamedProperty &other );
01704
01705 virtual ~a2dAutoZeroProperty();
01706
01707
01708
01709 static a2dAutoZeroProperty *CreatePropertyFromString( const a2dPropertyIdRefObjectAutoZero* id, const wxString &value );
01710
01711 void SetValue( a2dObject *value );
01712
01713 virtual a2dObject* GetRefObject() const { return m_value; }
01714 virtual a2dObject* GetRefObjectNA() const { return m_value; }
01715
01716 a2dObject *GetValue() const { return m_value; }
01717
01718 a2dObjectAutoZeroPtr *GetValuePtr() { return &m_value; }
01719
01720 a2dObjectAutoZeroPtr &GetValueRef() { return m_value; }
01721
01722 virtual wxString StringRepresentation() const;
01723
01724 virtual wxString StringValueRepresentation() const;
01725
01726 #if wxART2D_USE_CVGIO
01727 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01728 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01729 #endif //wxART2D_USE_CVGIO
01730
01731 DECLARE_DYNAMIC_CLASS(a2dAutoZeroProperty)
01732
01733 protected:
01734
01735 a2dObjectAutoZeroPtr m_value;
01736 };
01737
01738
01739
01740
01741
01742 class A2DGENERALDLLEXP a2dInt16Property: public a2dNamedProperty
01743 {
01744 public:
01745
01746 a2dInt16Property();
01747
01748 a2dInt16Property( const a2dPropertyIdInt16* id, wxInt16 value );
01749
01750 a2dInt16Property(const a2dInt16Property &other);
01751
01752 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01753
01754 virtual void Assign( const a2dNamedProperty &other );
01755
01756 virtual ~a2dInt16Property();
01757
01758
01759
01760 static a2dInt16Property *CreatePropertyFromString( const a2dPropertyIdInt16* id, const wxString &value );
01761
01762 void SetValue( wxInt16 value );
01763
01764 wxInt16 GetValue() const { return m_value; }
01765
01766 virtual wxInt16 GetInt16() const { return m_value; }
01767
01768 wxInt16* GetValuePtr() { return &m_value; }
01769
01770 wxInt16& GetValueRef() { return m_value; }
01771
01772 virtual wxString StringRepresentation() const;
01773
01774 virtual wxString StringValueRepresentation() const;
01775
01776 #if wxART2D_USE_CVGIO
01777 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01778 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01779 #endif //wxART2D_USE_CVGIO
01780
01781 DECLARE_DYNAMIC_CLASS(a2dInt16Property)
01782
01783 protected:
01784
01785 wxInt16 m_value;
01786 };
01787
01788
01789
01790
01791
01792 class A2DGENERALDLLEXP a2dUint16Property: public a2dNamedProperty
01793 {
01794 public:
01795
01796 a2dUint16Property();
01797
01798 a2dUint16Property( const a2dPropertyIdUint16* id, wxUint16 value );
01799
01800 a2dUint16Property(const a2dUint16Property &other );
01801
01802 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01803
01804 virtual void Assign( const a2dNamedProperty &other );
01805
01806 virtual ~a2dUint16Property();
01807
01808
01809
01810 static a2dUint16Property *CreatePropertyFromString( const a2dPropertyIdUint16* id, const wxString &value );
01811
01812 void SetValue( wxUint16 value );
01813
01814 wxUint16 GetValue() const { return m_value; }
01815
01816 virtual wxUint16 GetUint16() const { return m_value; }
01817
01818 wxUint16* GetValuePtr() { return &m_value; }
01819
01820 wxUint16& GetValueRef() { return m_value; }
01821
01822 virtual wxString StringRepresentation() const;
01823
01824 virtual wxString StringValueRepresentation() const;
01825
01826 #if wxART2D_USE_CVGIO
01827 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01828 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01829 #endif //wxART2D_USE_CVGIO
01830
01831 DECLARE_DYNAMIC_CLASS(a2dUint16Property)
01832
01833 protected:
01834
01835 wxUint16 m_value;
01836 };
01837
01838
01839
01840
01841
01842 class A2DGENERALDLLEXP a2dInt32Property: public a2dNamedProperty
01843 {
01844 public:
01845
01846 a2dInt32Property();
01847
01848 a2dInt32Property( const a2dPropertyIdInt32* id, wxInt32 value );
01849
01850 a2dInt32Property(const a2dInt32Property &other);
01851
01852 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01853
01854 virtual void Assign( const a2dNamedProperty &other );
01855
01856 virtual ~a2dInt32Property();
01857
01858
01859
01860 static a2dInt32Property *CreatePropertyFromString( const a2dPropertyIdInt32* id, const wxString &value );
01861
01862 void SetValue( wxInt32 value );
01863
01864 wxInt32 GetValue() const { return m_value; }
01865
01866 virtual wxInt32 GetInt32() const { return m_value; }
01867
01868 wxInt32* GetValuePtr() { return &m_value; }
01869
01870 wxInt32& GetValueRef() { return m_value; }
01871
01872 virtual wxString StringRepresentation() const;
01873
01874 virtual wxString StringValueRepresentation() const;
01875
01876 #if wxART2D_USE_CVGIO
01877 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01878 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01879 #endif //wxART2D_USE_CVGIO
01880
01881 DECLARE_DYNAMIC_CLASS(a2dInt32Property)
01882
01883 protected:
01884
01885 wxInt32 m_value;
01886 };
01887
01888
01889
01890
01891
01892 class A2DGENERALDLLEXP a2dUint32Property: public a2dNamedProperty
01893 {
01894 public:
01895
01896 a2dUint32Property();
01897
01898 a2dUint32Property( const a2dPropertyIdUint32* id, wxUint32 value );
01899
01900 a2dUint32Property(const a2dUint32Property &other );
01901
01902 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01903
01904 virtual void Assign( const a2dNamedProperty &other );
01905
01906 virtual ~a2dUint32Property();
01907
01908
01909
01910 static a2dUint32Property *CreatePropertyFromString( const a2dPropertyIdUint32* id, const wxString &value );
01911
01912 void SetValue( wxUint32 value );
01913
01914 wxUint32 GetValue() const { return m_value; }
01915
01916 virtual wxUint32 GetUint32() const { return m_value; }
01917
01918 wxUint32* GetValuePtr() { return &m_value; }
01919
01920 wxUint32& GetValueRef() { return m_value; }
01921
01922 virtual wxString StringRepresentation() const;
01923
01924 virtual wxString StringValueRepresentation() const;
01925
01926 #if wxART2D_USE_CVGIO
01927 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01928 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01929 #endif //wxART2D_USE_CVGIO
01930
01931 DECLARE_DYNAMIC_CLASS(a2dUint32Property)
01932
01933 protected:
01934
01935 wxUint32 m_value;
01936 };
01937
01938
01939
01940
01941
01942 class A2DGENERALDLLEXP a2dDoubleProperty: public a2dNamedProperty
01943 {
01944 public:
01945
01946 a2dDoubleProperty();
01947
01948 a2dDoubleProperty( const a2dPropertyIdDouble* id, double value );
01949
01950 a2dDoubleProperty(const a2dDoubleProperty &other );
01951
01952 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
01953
01954 virtual void Assign( const a2dNamedProperty &other );
01955
01956 virtual ~a2dDoubleProperty();
01957
01958
01959
01960 static a2dDoubleProperty *CreatePropertyFromString( const a2dPropertyIdDouble* id, const wxString &value );
01961
01962 void SetValue( double value );
01963
01964 double GetValue() const { return m_value; }
01965
01966 virtual double GetDouble() const { return m_value; }
01967
01968 double* GetValuePtr() { return &m_value; }
01969
01970 double& GetValueRef() { return m_value; }
01971
01972 virtual wxString StringRepresentation() const;
01973
01974 virtual wxString StringValueRepresentation() const;
01975
01976 #if wxART2D_USE_CVGIO
01977 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
01978 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
01979 #endif //wxART2D_USE_CVGIO
01980
01981 DECLARE_DYNAMIC_CLASS(a2dDoubleProperty)
01982
01983 protected:
01984
01985 double m_value;
01986 };
01987
01988
01989
01990
01991
01992 class A2DGENERALDLLEXP a2dFloatProperty: public a2dNamedProperty
01993 {
01994 public:
01995
01996 a2dFloatProperty();
01997
01998 a2dFloatProperty( const a2dPropertyIdFloat* id, float value );
01999
02000 a2dFloatProperty(const a2dFloatProperty &other );
02001
02002 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02003
02004 virtual void Assign( const a2dNamedProperty &other );
02005
02006 virtual ~a2dFloatProperty();
02007
02008
02009
02010 static a2dFloatProperty *CreatePropertyFromString( const a2dPropertyIdFloat* id, const wxString &value );
02011
02012 void SetValue( float value );
02013
02014 float GetValue() const { return m_value; }
02015
02016 virtual float GetFloat() const { return m_value; }
02017
02018 virtual double GetDouble() const { return m_value; }
02019
02020 float* GetValuePtr() { return &m_value; }
02021
02022 float& GetValueRef() { return m_value; }
02023
02024 virtual wxString StringRepresentation() const;
02025
02026 virtual wxString StringValueRepresentation() const;
02027
02028 #if wxART2D_USE_CVGIO
02029 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02030 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02031 #endif //wxART2D_USE_CVGIO
02032
02033 DECLARE_DYNAMIC_CLASS(a2dFloatProperty)
02034
02035 protected:
02036
02037 float m_value;
02038 };
02039
02040
02041
02042
02043
02044 class A2DGENERALDLLEXP a2dArrayStringProperty: public a2dNamedProperty
02045 {
02046 public:
02047
02048 a2dArrayStringProperty();
02049
02050 a2dArrayStringProperty( const a2dPropertyIdArrayString* id, const wxArrayString& value );
02051
02052 a2dArrayStringProperty( const a2dPropertyIdArrayString* id, const wxString& value );
02053
02054 a2dArrayStringProperty( const a2dArrayStringProperty &other );
02055
02056 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02057
02058 virtual void Assign( const a2dNamedProperty &other );
02059
02060 virtual ~a2dArrayStringProperty();
02061
02062
02063
02064 static a2dArrayStringProperty *CreatePropertyFromString( const a2dPropertyIdArrayString* id, const wxString &value );
02065
02066 void Add( const wxString& value );
02067
02068 void SetValue( const wxArrayString& value );
02069
02070 wxArrayString& GetValue() { return m_value; }
02071 const wxArrayString& GetValue() const { return m_value; }
02072
02073 wxArrayString* GetValuePtr() { return &m_value; }
02074
02075 virtual wxString StringRepresentation() const;
02076
02077 virtual wxString StringValueRepresentation() const;
02078
02079 #if wxART2D_USE_CVGIO
02080 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02081 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02082 #endif //wxART2D_USE_CVGIO
02083
02084 DECLARE_DYNAMIC_CLASS(a2dArrayStringProperty)
02085
02086 protected:
02087
02088 wxArrayString m_value;
02089 };
02090
02091
02092
02093
02094
02095 class A2DGENERALDLLEXP a2dFileNameProperty: public a2dNamedProperty
02096 {
02097 public:
02098
02099 a2dFileNameProperty();
02100
02101 a2dFileNameProperty( const a2dPropertyIdFileName* id, const wxFileName& filename );
02102
02103 a2dFileNameProperty(const a2dFileNameProperty &other );
02104
02105 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02106
02107 virtual void Assign( const a2dNamedProperty &other );
02108
02109 virtual ~a2dFileNameProperty();
02110
02111
02112
02113 static a2dFileNameProperty *CreatePropertyFromString( const a2dPropertyIdFileName* id, const wxString &value );
02114
02115 void SetValue( const wxFileName& filenameObject );
02116
02117 wxFileName GetValue() const { return m_filenameObject; }
02118
02119 wxFileName *GetValuePtr() { return &m_filenameObject; }
02120
02121 wxFileName &GetValueRef() { return m_filenameObject; }
02122
02123 void SetFileName( const wxFileName& filenameObject );
02124
02125 wxFileName GetFileName() { return m_filenameObject; }
02126
02127 wxFileName& GetFileNameRef() { return m_filenameObject; }
02128
02129 virtual wxString StringRepresentation() const;
02130
02131 virtual wxString StringValueRepresentation() const;
02132
02133 #if wxART2D_USE_CVGIO
02134 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02135 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02136 #endif //wxART2D_USE_CVGIO
02137
02138 DECLARE_DYNAMIC_CLASS(a2dFileNameProperty)
02139
02140 protected:
02141
02142 wxFileName m_filenameObject;
02143 };
02144
02145
02146
02147
02148
02149 class A2DGENERALDLLEXP a2dDateTimeProperty: public a2dNamedProperty
02150 {
02151 public:
02152
02153 a2dDateTimeProperty();
02154
02155 a2dDateTimeProperty( const a2dPropertyIdDateTime* id, const wxDateTime& datetime );
02156
02157 a2dDateTimeProperty(const a2dDateTimeProperty &other );
02158
02159 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02160
02161 virtual void Assign( const a2dNamedProperty &other );
02162
02163 virtual ~a2dDateTimeProperty();
02164
02165
02166
02167 static a2dDateTimeProperty *CreatePropertyFromString( const a2dPropertyIdDateTime* id, const wxString &value );
02168
02169 void SetValue( const wxDateTime& datetimeObject );
02170
02171 wxDateTime GetValue() const { return m_datetimeObject; }
02172
02173 wxDateTime *GetValuePtr() { return &m_datetimeObject; }
02174
02175 wxDateTime &GetValueRef() { return m_datetimeObject; }
02176
02177 void SetDateTime( const wxDateTime& datetimeObject );
02178
02179 wxDateTime GetDateTime() { return m_datetimeObject; }
02180
02181 wxDateTime& GetDateTimeRef() { return m_datetimeObject; }
02182
02183 virtual wxString StringRepresentation() const;
02184
02185 virtual wxString StringValueRepresentation() const;
02186
02187 #if wxART2D_USE_CVGIO
02188 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02189 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02190 #endif //wxART2D_USE_CVGIO
02191
02192 DECLARE_DYNAMIC_CLASS(a2dDateTimeProperty)
02193
02194 protected:
02195
02196 wxDateTime m_datetimeObject;
02197 };
02198
02199
02200
02201
02202
02203 class A2DGENERALDLLEXP a2dMenuProperty: public a2dNamedProperty
02204 {
02205 public:
02206
02207 a2dMenuProperty();
02208
02209 a2dMenuProperty( const a2dPropertyIdMenu* id, wxMenu* menu );
02210
02211 a2dMenuProperty(const a2dMenuProperty &other );
02212
02213 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02214
02215 virtual void Assign( const a2dNamedProperty &other );
02216
02217 virtual ~a2dMenuProperty();
02218
02219
02220
02221 static a2dMenuProperty *CreatePropertyFromString( const a2dPropertyIdMenu* id, const wxString &value );
02222
02223 void SetValue( wxMenu* menu );
02224
02225 wxMenu* GetValue() const { return m_menu; }
02226
02227 wxMenu** GetValuePtr() { return &m_menu; }
02228
02229 #if wxART2D_USE_CVGIO
02230 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02231 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02232 #endif //wxART2D_USE_CVGIO
02233
02234 DECLARE_DYNAMIC_CLASS(a2dMenuProperty)
02235
02236 protected:
02237
02238 wxMenu* m_menu;
02239 };
02240
02241
02242
02243
02244
02245 class A2DGENERALDLLEXP a2dWindowProperty: public a2dNamedProperty
02246 {
02247 public:
02248
02249 a2dWindowProperty();
02250
02251 a2dWindowProperty( const a2dPropertyIdWindow* id, wxWindow* window );
02252
02253 a2dWindowProperty(const a2dWindowProperty &other );
02254
02255 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02256
02257 virtual void Assign( const a2dNamedProperty &other );
02258
02259 virtual ~a2dWindowProperty();
02260
02261
02262
02263 static a2dWindowProperty *CreatePropertyFromString( const a2dPropertyIdWindow* id, const wxString &value );
02264
02265 void SetValue( wxWindow* window );
02266
02267 wxWindow* GetValue() const { return m_window; }
02268
02269 wxWindow** GetValuePtr() { return &m_window; }
02270
02271 #if wxART2D_USE_CVGIO
02272 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02273 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02274 #endif //wxART2D_USE_CVGIO
02275
02276 DECLARE_DYNAMIC_CLASS(a2dWindowProperty)
02277
02278 protected:
02279
02280 wxWindow* m_window;
02281 };
02282
02283
02284
02285
02286
02287
02288
02289 class A2DGENERALDLLEXP a2dTipWindowProperty: public a2dWindowProperty
02290 {
02291 public:
02292
02293 a2dTipWindowProperty();
02294
02295
02296
02297
02298
02299
02300
02301
02302 a2dTipWindowProperty( const a2dPropertyIdWindow* id, wxTipWindow* window, const wxString& tipstring, bool useObjRect = true );
02303
02304
02305
02306
02307
02308
02309
02310
02311 a2dTipWindowProperty( const a2dPropertyIdWindow* id, wxTipWindow* window, const wxString& tipstring, const wxRect& rect );
02312
02313 a2dTipWindowProperty( const a2dTipWindowProperty* ori );
02314
02315 a2dTipWindowProperty(const a2dTipWindowProperty &other );
02316
02317 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02318
02319 virtual void Assign( const a2dNamedProperty &other );
02320
02321 virtual ~a2dTipWindowProperty();
02322
02323
02324
02325 static a2dTipWindowProperty *CreatePropertyFromString( const a2dPropertyIdWindow* id, const wxString &value );
02326
02327 void SetString( const wxString& tipstring );
02328
02329 const wxString& GetString(void) {
02330 return m_tipstring; }
02331
02332
02333 const wxRect& GetRect() const { return m_rectStay; }
02334
02335
02336 bool GetUseObjRect() const { return m_useObjRect; }
02337
02338 #if wxART2D_USE_CVGIO
02339 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02340 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02341 #endif //wxART2D_USE_CVGIO
02342
02343 DECLARE_DYNAMIC_CLASS(a2dTipWindowProperty)
02344
02345 protected:
02346
02347 wxString m_tipstring;
02348
02349 bool m_useObjRect;
02350
02351 wxRect m_rectStay;
02352 };
02353
02354
02355
02356
02357
02358
02359
02360
02361
02362
02363 class A2DGENERALDLLEXP a2dPathList : public wxPathList
02364 {
02365 public:
02366
02367 a2dPathList();
02368
02369 ~a2dPathList();
02370
02371
02372 wxString FindValidPath(const wxString& filename);
02373
02374
02375 wxString FindAbsoluteValidPath(const wxString& filename);
02376
02377
02378 wxString GetAsString();
02379
02380 bool ExpandPath( wxString& pathToExpand );
02381
02382 private:
02383
02384 bool Name();
02385
02386 void IncC();
02387
02388
02389
02390
02391 bool VarRef( wxChar type);
02392
02393 wxChar a;
02394 wxString m_path;
02395 const wxChar* m_c;
02396 wxString m_b;
02397 wxString m_error_mes;
02398 wxString m_varref;
02399 };
02400
02401
02402 class A2DGENERALDLLEXP a2dPathListProperty;
02403 #if defined(WXDOCVIEW_USINGDLL)
02404 template class A2DGENERALDLLEXP a2dPropertyIdTyped<a2dPathList, a2dPathListProperty>;
02405 #endif
02406 typedef a2dPropertyIdTyped<a2dPathList, a2dPathListProperty> a2dPropertyIdPathList;
02407
02408
02409
02410
02411
02412 class A2DGENERALDLLEXP a2dPathListProperty: public a2dNamedProperty
02413 {
02414 public:
02415
02416 a2dPathListProperty();
02417
02418 a2dPathListProperty( const a2dPropertyIdPathList* id, const a2dPathList& pathlist );
02419
02420 a2dPathListProperty( const a2dPathListProperty* ori );
02421
02422 a2dPathListProperty(const a2dPathListProperty &other );
02423
02424 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02425
02426 virtual void Assign( const a2dNamedProperty &other );
02427
02428 virtual ~a2dPathListProperty();
02429
02430
02431
02432 static a2dPathListProperty *CreatePropertyFromString( const a2dPropertyIdPathList* id, const wxString &value );
02433
02434 void SetValue( const a2dPathList& pathlistObject );
02435
02436 a2dPathList GetValue() const { return m_pathlistObject; }
02437
02438 a2dPathList *GetValuePtr() { return &m_pathlistObject; }
02439
02440 a2dPathList &GetValueRef() { return m_pathlistObject; }
02441
02442 void SetFileName( const a2dPathList& pathlistObject );
02443
02444 a2dPathList GetFileName() { return m_pathlistObject; }
02445
02446 a2dPathList& GetFileNameRef() { return m_pathlistObject; }
02447
02448 virtual wxString StringRepresentation() const;
02449
02450 virtual wxString StringValueRepresentation() const;
02451
02452 #if wxART2D_USE_CVGIO
02453 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02454 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02455 #endif //wxART2D_USE_CVGIO
02456
02457 DECLARE_DYNAMIC_CLASS(a2dPathListProperty)
02458
02459 protected:
02460
02461 a2dPathList m_pathlistObject;
02462 };
02463
02464
02465 extern A2DGENERALDLLEXP wxColour ParseSvgColour( wxString value );
02466
02467
02468
02469
02470
02471 class A2DGENERALDLLEXP a2dColourProperty: public a2dNamedProperty
02472 {
02473 public:
02474
02475 a2dColourProperty();
02476
02477 a2dColourProperty( const a2dPropertyIdColour* id, const wxColour& colour );
02478
02479 a2dColourProperty(const a2dColourProperty &other );
02480
02481 virtual a2dNamedProperty *Clone( a2dObject::CloneOptions options ) const;
02482
02483 virtual void Assign( const a2dNamedProperty &other );
02484
02485 virtual ~a2dColourProperty();
02486
02487
02488
02489
02490
02491
02492
02493
02494 static a2dColourProperty *CreatePropertyFromString( const a2dPropertyIdColour* id, const wxString &value );
02495
02496 void SetValue( const wxColour& colour );
02497
02498 wxColour GetValue() const { return m_colour; }
02499
02500 wxColour *GetValuePtr() { return &m_colour; }
02501
02502 wxColour &GetValueRef() { return m_colour; }
02503
02504 void SetColour( const wxColour& colour );
02505
02506 wxColour GetColour() { return m_colour; }
02507
02508 wxColour& GetColourRef() { return m_colour; }
02509
02510 virtual wxString StringRepresentation() const;
02511
02512 virtual wxString StringValueRepresentation() const;
02513
02514 #if wxART2D_USE_CVGIO
02515 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut &out, a2dXmlSer_flag xmlparts , a2dObjectList* towrite );
02516 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02517 #endif //wxART2D_USE_CVGIO
02518
02519 DECLARE_DYNAMIC_CLASS(a2dColourProperty)
02520
02521 protected:
02522
02523 wxColour m_colour;
02524 };
02525
02526
02527
02528
02529
02530 A2DGENERALDLLEXP_DATA(extern a2dObjectList*) wxNullRefObjectList;
02531
02532 #include <wx/listimpl.cpp>
02533
02534 #if (defined(__WXMSW__) && defined(WXUSINGDLL) )
02535 template class A2DGENERALDLLEXP a2dSmrtPtr<class a2dObject>;
02536 template class A2DGENERALDLLEXP std::allocator<class a2dSmrtPtr<class a2dObject> >;
02537 template class A2DGENERALDLLEXP std::allocator< std::_List_nod<class a2dSmrtPtr<class a2dObject>, std::allocator<class a2dSmrtPtr<class a2dObject> > >::_Node >;
02538 template class A2DGENERALDLLEXP std::allocator< std::_List_ptr<class a2dSmrtPtr<class a2dObject>, std::allocator<class a2dSmrtPtr<class a2dObject> > >::_Nodeptr >;
02539 template class A2DGENERALDLLEXP std::list<class a2dSmrtPtr<class a2dObject> >;
02540 template class A2DGENERALDLLEXP a2dlist<class a2dSmrtPtr<class a2dObject> >;
02541 template class A2DGENERALDLLEXP a2dSmrtPtrList<class a2dObject>;
02542 #endif
02543
02544
02545
02546
02547
02548 class A2DGENERALDLLEXP a2dObjectList: public a2dSmrtPtrList<a2dObject>
02549 {
02550 public:
02551 a2dObjectList();
02552
02553 ~a2dObjectList();
02554
02555
02556 void MakeUnique();
02557
02558
02559
02560 a2dObjectList& operator=( a2dObjectList& other );
02561
02562
02563 a2dObjectList* Clone( a2dObject::CloneOptions options ) const;
02564
02565
02566
02567 bool Release( const wxString& classname = wxT(""), bool all = false );
02568
02569
02570
02571
02572
02573
02574 a2dObject* Find( const wxString& classname=wxT(""), const wxString& name=wxT("") );
02575
02576
02577
02578
02579
02580
02581
02582
02583
02584 int CollectObjects( a2dObjectList* total, const wxString& propertyNameFilter = wxT(""), const wxString& classname = wxT("") );
02585
02586
02587
02588 };
02589
02590 #include <wx/hashmap.h>
02591
02592
02593
02594
02595
02596 class A2DGENERALDLLEXP a2dVariablesHashBase;
02597 class A2DGENERALDLLEXP a2dVariablesHashBase_wxImplementation_HashTable;
02598 class A2DGENERALDLLEXP a2dVariablesHashBase_wxImplementation_KeyEx;
02599 WX_DECLARE_STRING_HASH_MAP_WITH_DECL( a2dNamedProperty*, a2dVariablesHashBase, class A2DGENERALDLLEXP );
02600
02601
02602
02603
02604
02605
02606
02607
02608
02609
02610
02611
02612
02613
02614 class A2DGENERALDLLEXP a2dVariablesHash : private a2dVariablesHashBase
02615 {
02616
02617 public:
02618
02619
02620 a2dVariablesHash();
02621
02622
02623 a2dVariablesHash( const a2dVariablesHash &other );
02624
02625
02626 void operator = ( const a2dVariablesHash &other );
02627
02628
02629 ~a2dVariablesHash();
02630
02631
02632
02633
02634
02635
02636
02637
02638
02639 bool SetVariable( const wxString& variableName, a2dNamedProperty *property );
02640
02641
02642
02643
02644
02645
02646
02647
02648 bool SetVariableRefObject( const wxString& variableName, a2dObject *value );
02649
02650
02651
02652
02653
02654
02655
02656
02657 bool SetVariableString( const wxString& variableName, const wxString &value );
02658
02659
02660
02661
02662
02663
02664
02665
02666 bool SetVariableDouble( const wxString& variableName, double value );
02667
02668
02669
02670
02671
02672
02673
02674
02675 bool SetVariableInt( const wxString& variableName, int value );
02676
02677
02678
02679
02680
02681
02682 const a2dNamedProperty *GetVariable( const wxString& variableName );
02683
02684
02685
02686
02687
02688
02689 a2dNamedProperty *GetVariableClone( const wxString& variableName );
02690
02691
02692
02693
02694
02695
02696 a2dObject* GetVariableRefObject( const wxString& variableName );
02697
02698
02699
02700
02701
02702
02703 wxString* GetVariableString( const wxString& variableName );
02704 };
02705
02706
02707
02708
02709
02710
02711
02712
02713
02714
02715
02716
02717 class A2DGENERALDLLEXP a2dVariablesArray
02718 {
02719
02720 public:
02721
02722
02723 a2dVariablesArray();
02724
02725
02726 ~a2dVariablesArray();
02727
02728
02729 void DeleteAll();
02730
02731
02732
02733
02734
02735 void AppendVariable( a2dNamedProperty *property );
02736
02737
02738
02739
02740
02741 void AppendVariableRefObject( a2dObject *value );
02742
02743
02744
02745
02746
02747 void AppendVariableString( const wxString &value );
02748
02749
02750
02751
02752
02753 void AppendVariableDouble( double value );
02754
02755
02756
02757
02758
02759 void AppendVariableInt( int value );
02760
02761
02762
02763
02764
02765
02766 const a2dNamedProperty &GetVariable( int index );
02767
02768
02769
02770
02771
02772
02773 a2dNamedProperty *GetVariableClone( int index );
02774
02775
02776
02777
02778
02779
02780 a2dObject* GetVariableRefObject( int index );
02781
02782
02783
02784
02785
02786
02787 wxString GetVariableString( int index );
02788
02789
02790
02791
02792
02793
02794 wxString GetVariableAsString( int index );
02795
02796
02797 int GetCount() { return m_nelements; }
02798
02799 protected:
02800
02801 void SetMinSize( int size );
02802
02803 a2dNamedProperty **m_properties;
02804
02805 int m_nelements;
02806
02807 int m_melements;
02808 };
02809
02810
02811 #if wxUSE_STD_IOSTREAM
02812
02813 #if wxUSE_WSTREAM
02814
02815 typedef wxSTD wistringstream a2dDocumentStringInputStream;
02816
02817 typedef wxSTD wostringstream a2dDocumentStringOutputStream;
02818
02819 typedef wxSTD wistream a2dDocumentInputStream;
02820
02821 typedef wxSTD wostream a2dDocumentOutputStream;
02822
02823 typedef wxSTD wifstream a2dDocumentFileInputStream;
02824
02825 typedef wxSTD wofstream a2dDocumentFileOutputStream;
02826 #else
02827
02828 typedef wxSTD istringstream a2dDocumentStringInputStream;
02829
02830 typedef wxSTD ostringstream a2dDocumentStringOutputStream;
02831
02832 typedef wxSTD istream a2dDocumentInputStream;
02833
02834 typedef wxSTD ostream a2dDocumentOutputStream;
02835
02836 typedef wxSTD ifstream a2dDocumentFileInputStream;
02837
02838 typedef wxSTD ofstream a2dDocumentFileOutputStream;
02839 #endif
02840
02841 #else
02842
02843 typedef wxStringInputStream a2dDocumentStringInputStream;
02844
02845 typedef wxStringOutputStream a2dDocumentStringOutputStream;
02846
02847 typedef wxInputStream a2dDocumentInputStream;
02848
02849 typedef wxOutputStream a2dDocumentOutputStream;
02850 #endif
02851
02852
02853
02854
02855
02856
02857
02858
02859
02860
02861
02862
02863
02864
02865
02866
02867
02868
02869
02870
02871
02872
02873 class A2DGENERALDLLEXP a2dIOHandler : public a2dObject
02874 {
02875
02876 public:
02877
02878
02879 a2dIOHandler();
02880
02881
02882 ~a2dIOHandler();
02883
02884
02885
02886
02887 virtual void Initialize();
02888
02889
02890 virtual void Reset();
02891
02892
02893
02894
02895
02896
02897
02898
02899 wxObject* CreateObject( const wxString& symbolicName );
02900
02901
02902 a2dHashMapIntToObject& GetObjectHashMap() { return m_objecthashmap; }
02903
02904
02905 a2dHashMapCreateObject& GetObjectCreateHashMap() { return m_objectCreate; }
02906
02907
02908 a2dResolveIdList& GetResolveIdList() { return m_toResolve; }
02909
02910
02911
02912
02913
02914
02915 bool ResolveOrAdd( a2dSmrtPtr<a2dObject>* storedHere, const wxString &id = wxT("") );
02916
02917
02918 bool ResolveOrAdd( a2dAutoZeroPtr<a2dObject>* storedHere, const wxString &id = wxT("") );
02919
02920
02921
02922 bool ResolveOrAddLink( a2dObject *obj, const wxString &id = wxT("") );
02923
02924
02925 void ResolveInform( a2dObject *obj );
02926
02927
02928 void SetLastObjectLoadedId( const wxString& lastid );
02929
02930
02931
02932
02933
02934
02935
02936
02937
02938
02939
02940
02941
02942
02943
02944
02945
02946
02947
02948
02949
02950
02951
02952
02953
02954
02955 virtual bool LinkReferences();
02956
02957
02958 a2dError GetLastError() const { return m_lastError; }
02959
02960
02961 void SetLastError( a2dError error ) { m_lastError = error; }
02962
02963 protected:
02964
02965 #if wxART2D_USE_CVGIO
02966 virtual void DoSave( wxObject* parent, a2dIOHandlerXmlSerOut& out, a2dXmlSer_flag xmlparts, a2dObjectList* towrite );
02967 virtual void DoLoad( wxObject* parent, a2dIOHandlerXmlSerIn& parser, a2dXmlSer_flag xmlparts );
02968 #endif //wxART2D_USE_CVGIO
02969
02970
02971 virtual a2dObject* Clone( CloneOptions options ) const;
02972
02973
02974 a2dHashMapIntToObject m_objecthashmap;
02975
02976
02977 a2dHashMapCreateObject m_objectCreate;
02978
02979
02980 a2dResolveIdList m_toResolve;
02981
02982 wxString m_lastObjectId;
02983
02984
02985 a2dError m_lastError;
02986 };
02987
02988
02989
02990
02991
02992
02993
02994
02995 class A2DGENERALDLLEXP a2dIOHandlerStrIn : public a2dIOHandler
02996 {
02997
02998 public:
02999
03000
03001 a2dIOHandlerStrIn( wxMBConv& conv = wxConvUTF8 );
03002
03003
03004 ~a2dIOHandlerStrIn();
03005
03006
03007
03008
03009 virtual void InitializeLoad();
03010
03011
03012 virtual void ResetLoad();
03013
03014
03015
03016
03017
03018
03019
03020
03021
03022
03023
03024
03025
03026
03027
03028
03029
03030
03031
03032
03033
03034
03035
03036
03037 virtual bool CanLoad( a2dDocumentInputStream& stream, const wxObject* obj = NULL, wxClassInfo* docClassInfo = NULL ) = 0;
03038
03039
03040
03041
03042
03043
03044
03045
03046
03047 virtual bool Load( a2dDocumentInputStream& stream , wxObject* obj ) = 0;
03048
03049
03050 wxClassInfo* GetDocumentClassInfo() const { return m_docClassInfo; }
03051
03052
03053 void SetDocumentClassInfo( wxClassInfo* docClassInfo ) { m_docClassInfo = docClassInfo; }
03054
03055 protected:
03056
03057
03058 wxMBConv &m_conv;
03059
03060
03061 void SetMode( wxEOL mode = wxEOL_NATIVE );
03062
03063 wxEOL GetMode() { return m_mode; }
03064
03065
03066
03067 char Peek();
03068
03069
03070
03071 char GetC();
03072
03073
03074 a2dIOHandlerStrIn& SeekI(wxFileOffset pos);
03075
03076
03077 bool Eof() const;
03078
03079
03080 bool IsOk() const;
03081
03082
03083
03084
03085
03086 size_t Read( char* buffer, size_t size);
03087
03088
03089
03090 a2dDocumentInputStream* m_streami;
03091
03092
03093 wxClassInfo* m_docClassInfo;
03094
03095
03096 wxEOL m_mode;
03097 };
03098
03099
03100
03101
03102
03103
03104
03105
03106
03107 class A2DGENERALDLLEXP a2dIOHandlerStrOut : public a2dIOHandler
03108 {
03109
03110 public:
03111
03112
03113 a2dIOHandlerStrOut( wxMBConv& conv = wxConvUTF8 );
03114
03115
03116 ~a2dIOHandlerStrOut();
03117
03118
03119 virtual void InitializeSave();
03120
03121
03122 virtual void ResetSave();
03123
03124
03125
03126
03127
03128
03129
03130
03131
03132 virtual bool CanSave( const wxObject* obj = NULL ) = 0;
03133
03134
03135
03136
03137
03138
03139
03140
03141
03142 virtual bool Save( a2dDocumentOutputStream& stream, const wxObject* obj ) = 0;
03143
03144 protected:
03145
03146
03147 void SetMode( wxEOL mode = wxEOL_NATIVE );
03148
03149 wxEOL GetMode() { return m_mode; }
03150
03151
03152 void Write32(wxUint32 i);
03153
03154 void Write16(wxUint16 i);
03155
03156 void Write8(wxUint8 i);
03157
03158 virtual void WriteDouble(double d);
03159
03160 virtual void WriteString(const wxString& string );
03161
03162
03163 bool IsOk() const;
03164
03165
03166 a2dIOHandlerStrOut& PutChar(wxChar c);
03167
03168 protected:
03169
03170
03171 wxMBConv &m_conv;
03172
03173
03174 a2dDocumentOutputStream* m_streamo;
03175
03176
03177 wxEOL m_mode;
03178 };
03179
03180
03181
03182
03183
03184
03185
03186 typedef const long a2dWalkEvent;
03187
03188
03189 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dObjectStart;
03190
03191 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dObjectEnd;
03192
03193 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dPropObjectStart;
03194
03195 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dPropObjectEnd;
03196
03197 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyListStart;
03198
03199 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyListEnd;
03200
03201 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyStart;
03202
03203 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dNamedPropertyEnd;
03204
03205
03206 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectStart;
03207
03208 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectProperties;
03209
03210 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectPreChild;
03211
03212 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectPostChild;
03213
03214 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dCanvasObjectEnd;
03215
03216 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectStart;
03217
03218 A2DGENERALDLLEXP extern a2dWalkEvent a2dWalker_a2dDerivedCanvasObjectEnd;
03219
03220
03221
03222
03223
03224 typedef bool (*a2dObjectIOFn)( wxObject* parent, wxObject* object, a2dWalkEvent );
03225
03226 class A2DGENERALDLLEXP a2dIOHandlerCoupleHash;
03227 class A2DGENERALDLLEXP a2dIOHandlerCoupleHash_wxImplementation_HashTable;
03228 class A2DGENERALDLLEXP a2dIOHandlerCoupleHash_wxImplementation_KeyEx;
03229
03230 #include <wx/hashmap.h>
03231
03232 WX_DECLARE_STRING_HASH_MAP( a2dObjectIOFn*, a2dIOHandlerCoupleHash );
03233
03234
03235
03236
03237
03238
03239
03240
03241
03242
03243
03244
03245
03246
03247
03248
03249
03250
03251
03252
03253
03254
03255 class A2DGENERALDLLEXP a2dWalkerIOHandler : public a2dIOHandler
03256 {
03257 public:
03258
03259
03260 a2dWalkerIOHandler();
03261
03262
03263 ~a2dWalkerIOHandler();
03264
03265
03266 virtual void Initialize();
03267
03268
03269 wxString GetErrorString() { return m_error; }
03270
03271
03272 void SetStopWalking( bool stopWalking ) { m_stopWalking = stopWalking; }
03273
03274
03275 bool GetStopWalking() { return m_stopWalking; }
03276
03277
03278 void IncCurrentDepth() { m_currentDepth++; }
03279
03280
03281 void DecCurrentDepth() { m_currentDepth--; }
03282
03283
03284 int GetCurrentDepth() { return m_currentDepth; }
03285
03286
03287 void SetDepthFirst( bool depthFirst ) { m_depthFirst = depthFirst; }
03288
03289
03290 bool GetDepthFirst() { return m_depthFirst; }
03291
03292
03293 void SetUseCheck( bool useCheck ) { m_useCheck = useCheck; }
03294
03295
03296 bool GetUseCheck() { return m_useCheck; }
03297
03298
03299 void Register( const wxString& classname, a2dObjectIOFn* IOfunc ) { m_register[ classname ] = IOfunc; }
03300
03301
03302 void Unregister( const wxString& classname ) { m_register.erase( classname ); }
03303
03304
03305
03306
03307
03308
03309 virtual bool WalkTask( wxObject* parent, wxObject* object, a2dWalkEvent event );
03310
03311
03312
03313 wxObject* GetParent() { return m_currentParent; }
03314
03315
03316 bool GetResult() { return m_result; }
03317
03318 protected:
03319
03320
03321 bool m_result;
03322
03323
03324 wxObject* m_currentParent;
03325
03326
03327 wxString m_error;
03328
03329
03330 bool m_stopWalking;
03331
03332
03333 int m_currentDepth;
03334
03335
03336
03337 bool m_depthFirst;
03338
03339
03340 bool m_useCheck;
03341
03342
03343 a2dIOHandlerCoupleHash m_register;
03344 };
03345
03346
03347
03348
03349 extern wxColour A2DGENERALDLLEXP HexToColour(const wxString& hex);
03350
03351
03352 extern wxString A2DGENERALDLLEXP ColourToHex(const wxColour& colour);
03353
03354
03355
03356
03357
03358
03359
03360
03361
03362
03363
03364 class A2DGENERALDLLEXP a2dMemoryCriticalSectionHelper
03365 {
03366 public:
03367 a2dMemoryCriticalSectionHelper()
03368 {
03369
03370 int *dummy = new int;
03371 delete dummy;
03372 }
03373 };
03374
03375
03376 #include <wx/sstream.h>
03377
03378
03379 #include "wx/general/id.inl"
03380
03381
03382 #endif
03383