]> git.saurik.com Git - wxWidgets.git/blob - include/wx/serbase.h
SetBackground for ListBox and others
[wxWidgets.git] / include / wx / serbase.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: serbase.h
3 // Purpose: Serialization plug-ins
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: July 1998
7 // RCS-ID: $Id$
8 // Copyright: (c) Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_WX_SERBASEH_H__
12 #define _WX_WX_SERBASEH_H__
13
14 #include <wx/dynlib.h>
15
16 #define WXSERIAL(classname) classname##_Serialize
17
18 class wxObject_Serialize : public wxObject {
19 DECLARE_DYNAMIC_CLASS(wxObject_Serialize)
20 public:
21 wxObject_Serialize() {}
22 virtual ~wxObject_Serialize() {}
23
24 void SetObject(wxObject *obj) { m_object = obj; }
25 wxObject *Object() { return m_object; }
26
27 protected:
28 wxObject *m_object;
29 };
30
31
32 #define DECLARE_SERIAL_CLASS(classname, parent) \
33 class WXSERIAL(classname) : public WXSERIAL(parent) { \
34 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
35 public: \
36 WXSERIAL(classname)() { } \
37 virtual ~WXSERIAL(classname)() { } \
38 \
39 virtual void StoreObject(wxObjectOutputStream& stream); \
40 virtual void LoadObject(wxObjectInputStream& stream); \
41 };
42
43 #define DECLARE_ALIAS_SERIAL_CLASS(classname, parent) \
44 class WXSERIAL(classname) : public WXSERIAL(parent) { \
45 DECLARE_DYNAMIC_CLASS(classname##_Serialize) \
46 public: \
47 WXSERIAL(classname)() { } \
48 virtual ~WXSERIAL(classname)() { } \
49 };
50
51 #define IMPLEMENT_SERIAL_CLASS(classname, parent) \
52 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
53
54 #define IMPLEMENT_ALIAS_SERIAL_CLASS(classname, parent) \
55 IMPLEMENT_DYNAMIC_CLASS(classname##_Serialize, parent##_Serialize)
56
57 #endif