]>
git.saurik.com Git - wxWidgets.git/blob - utils/framelayout/src/pf_sample.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Contrib. demo
4 // Author: Aleksandras Gluchovas
8 // Copyright: (c) Aleksandras Gluchovas
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef __PF_SAMPLE_G__
13 #define __PF_SAMPLE_G__
23 class notStorableClass
26 class classA
: public wxObject
28 DECLARE_DYNAMIC_CLASS( classA
)
33 notStorableClass
* mpBackRef
;
36 class classB
: public wxObject
38 DECLARE_DYNAMIC_CLASS( classB
)
43 notStorableClass
* mpBackRef
;
46 // serialization handlers for the above classes
48 class classASerializer
: public wxSerializerBase
50 DECLARE_SERIALIZER_CLASS( classASerializer
)
52 static void Serialize( wxObject
* pObj
, wxObjectStorage
& store
)
54 classA
* pA
= (classA
*)pObj
; // cast
56 store
.XchgInt ( pA
->x
);
57 store
.XchgObjPtr( (wxObject
**) &(pA
->mpBObj
) );
58 store
.XchgObjPtr( (wxObject
**) &(pA
->mpBackRef
) );
62 class classBSerializer
: public wxSerializerBase
64 DECLARE_SERIALIZER_CLASS( classBSerializer
)
66 static void Serialize( wxObject
* pObj
, wxObjectStorage
& store
)
68 classB
* pB
= (classB
*)pObj
; // cast
70 store
.XchgInt ( pB
->y
);
71 store
.XchgObjPtr( (wxObject
**) &(pB
->mpAObj
) );
72 store
.XchgObjPtr( (wxObject
**) &(pB
->mpBackRef
) );
76 /*---------------------------*/
77 /* Main testing function */
78 /*---------------------------*/
80 // include this header and .cpp file into any of your
81 // wxWindows projects, and invoke the below function
84 void test_obj_storage();