]> git.saurik.com Git - wxWidgets.git/blame - include/wx/objstrm.h
Added wxPopupWindow to GTK port, wxComboBox had to
[wxWidgets.git] / include / wx / objstrm.h
CommitLineData
d602f1d8
GL
1/////////////////////////////////////////////////////////////////////////////
2// Name: objstrm.h
3// Purpose: wxObjectStream classes
4// Author: Guilhem Lavaux
5// Modified by:
6// Created: 16/07/98
7// RCS-ID: $Id$
8// Copyright: (c) 1998 Guilhem Lavaux
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
34138703
JS
11#ifndef _WX_WXOBJSTRM_H__
12#define _WX_WXOBJSTRM_H__
d602f1d8
GL
13
14#ifdef __GNUG__
15#pragma interface
16#endif
17
18#include "wx/defs.h"
ce4169a4
RR
19
20#if wxUSE_STREAMS && wxUSE_SERIAL
21
d602f1d8
GL
22#include "wx/object.h"
23#include "wx/string.h"
24#include "wx/stream.h"
25
26class wxObjectStreamInfo : public wxObject {
27 public:
28 wxString object_name;
7a4b9130 29 int n_children, children_removed;
d602f1d8 30 wxList children;
7a4b9130 31 wxObjectStreamInfo *parent;
d602f1d8 32 wxObject *object;
1d44aaf8 33 bool duplicate, recall;
d602f1d8
GL
34};
35
36class wxObjectOutputStream : public wxFilterOutputStream {
37 public:
38 wxObjectOutputStream(wxOutputStream& s);
39
1eac776c 40 void AddChild(wxObject *obj);
d602f1d8
GL
41 bool SaveObject(wxObject& obj);
42
43 bool FirstStage() const { return m_stage == 0; }
44
45 wxString GetObjectName(wxObject *obj);
46
47 protected:
48 void WriteObjectDef(wxObjectStreamInfo& info);
49 void ProcessObjectDef(wxObjectStreamInfo *info);
50 void ProcessObjectData(wxObjectStreamInfo *info);
51
52 protected:
53 int m_stage;
54 bool m_saving;
55 wxObjectStreamInfo *m_current_info;
8d43638d 56 wxList m_saved_objs;
d602f1d8
GL
57};
58
59class wxObjectInputStream : public wxFilterInputStream {
60 public:
61 wxObjectInputStream(wxInputStream& s);
62
1d44aaf8
GL
63 bool SecondCall() const { return m_secondcall; }
64 void Recall(bool on = TRUE) { m_current_info->recall = on; }
65
d602f1d8 66 wxObject *GetChild(int no) const;
8d43638d 67 wxObject *GetChild();
7a4b9130
GL
68 int NumberOfChildren() const { return m_current_info->n_children; }
69 void RemoveChildren(int nb);
70 wxObject *GetParent() const;
d602f1d8
GL
71 wxObject *LoadObject();
72
73 wxObject *SolveName(const wxString& objName) const;
74
75 protected:
76 bool ReadObjectDef(wxObjectStreamInfo *info);
77 wxObjectStreamInfo *ProcessObjectDef(wxObjectStreamInfo *info);
78 void ProcessObjectData(wxObjectStreamInfo *info);
79
80 protected:
1d44aaf8 81 bool m_secondcall;
d602f1d8
GL
82 wxObjectStreamInfo *m_current_info;
83 wxList m_solver;
84};
85
86#endif
ce4169a4
RR
87 // wxUSE_STREAMS && wxUSE_SERIAL
88
89#endif
f803d864 90// _WX_WXOBJSTRM_H__