]> git.saurik.com Git - wxWidgets.git/blob - utils/serialize/serext.cpp
Added GLCanvas library (Win only at present).
[wxWidgets.git] / utils / serialize / serext.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: serext.cpp
3 // Purpose: Serialization: Other classes
4 // Author: Guilhem Lavaux
5 // Modified by:
6 // Created: July 1998
7 // RCS-ID: $Id$
8 // Copyright: (c) 1998 Guilhem Lavaux
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifdef __GNUG__
13 #pragma implementation "serext.h"
14 #endif
15
16 #include <wx/splitter.h>
17 #include <wx/objstrm.h>
18 #include <wx/datstrm.h>
19 #include "serext.h"
20
21 IMPLEMENT_SERIAL_CLASS(wxSplitterWindow, wxWindow)
22
23 void WXSERIAL(wxSplitterWindow)::StoreObject(wxObjectOutputStream& s)
24 {
25 wxSplitterWindow *splitter = (wxSplitterWindow *)Object();
26 WXSERIAL(wxWindow)::StoreObject(s);
27
28 if (s.FirstStage()) {
29 s.AddChild( splitter->GetWindow1() );
30 s.AddChild( splitter->GetWindow2() );
31 return;
32 }
33
34 wxDataOutputStream data_s(s);
35 data_s.Write8( splitter->GetSplitMode() );
36 data_s.Write32( splitter->GetSashSize() );
37 data_s.Write8( splitter->GetBorderSize() );
38 data_s.Write32( splitter->GetSashPosition() );
39 data_s.Write32( splitter->GetMinimumPaneSize() );
40 }
41
42 void WXSERIAL(wxSplitterWindow)::LoadObject(wxObjectInputStream& s)
43 {
44 wxSplitterWindow *splitter = (wxSplitterWindow *)Object();
45 WXSERIAL(wxWindow)::LoadObject(s);
46
47 wxDataInputStream data_s(s);
48 int split_mode, sash_size, border_size, sash_position, min_pane_size;
49
50 split_mode = data_s.Read8();
51 sash_size = data_s.Read32();
52 border_size = data_s.Read8();
53 sash_position = data_s.Read32();
54 min_pane_size = data_s.Read32();
55
56 splitter->Create(m_parent, m_id, wxPoint(m_x, m_y), wxSize(m_w, m_h), m_style,
57 m_name);
58
59 if (s.GetChild(1)) {
60 if (data_s.Read8() == wxSPLIT_VERTICAL)
61 splitter->SplitVertically((wxWindow *)s.GetChild(0),
62 (wxWindow *)s.GetChild(1), sash_position);
63 else
64 splitter->SplitHorizontally((wxWindow *)s.GetChild(0),
65 (wxWindow *)s.GetChild(1), sash_position);
66 }
67
68 splitter->SetSashSize(sash_size);
69 splitter->SetBorderSize(border_size);
70 splitter->SetMinimumPaneSize(min_pane_size);
71 }