]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xrc/xh_split.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XRC resource for wxSplitterWindow
4 // Author: panga@freemail.hu, Vaclav Slavik
7 // Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "xh_split.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #include "wx/xrc/xh_split.h"
23 #include "wx/splitter.h"
26 wxSplitterWindowXmlHandler::wxSplitterWindowXmlHandler() : wxXmlResourceHandler()
28 XRC_ADD_STYLE(wxSP_3D
);
29 XRC_ADD_STYLE(wxSP_3DSASH
);
30 XRC_ADD_STYLE(wxSP_3DBORDER
);
31 XRC_ADD_STYLE(wxSP_FULLSASH
);
32 XRC_ADD_STYLE(wxSP_BORDER
);
33 XRC_ADD_STYLE(wxSP_NOBORDER
);
34 XRC_ADD_STYLE(wxSP_PERMIT_UNSPLIT
);
35 XRC_ADD_STYLE(wxSP_LIVE_UPDATE
);
39 wxObject
*wxSplitterWindowXmlHandler::DoCreateResource()
41 XRC_MAKE_INSTANCE(splitter
, wxSplitterWindow
);
43 splitter
->Create(m_parentAsWindow
,
45 GetPosition(), GetSize(),
46 GetStyle(wxT("style"), wxSP_3D
),
49 SetupWindow(splitter
);
51 long sashpos
= GetLong(wxT("sashpos"), 0);
52 long minpanesize
= GetLong(wxT("minsize"), -1);
53 if (minpanesize
!= -1)
54 splitter
->SetMinimumPaneSize(minpanesize
);
56 wxWindow
*win1
= NULL
, *win2
= NULL
;
57 wxXmlNode
*n
= m_node
->GetChildren();
60 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
61 (n
->GetName() == wxT("object") ||
62 n
->GetName() == wxT("object_ref")))
64 wxObject
*created
= CreateResFromNode(n
, splitter
, NULL
);
65 wxWindow
*win
= wxDynamicCast(created
, wxWindow
);
80 wxLogError(wxT("wxSplitterWindow node must contain at least one window."));
82 bool horizontal
= (GetParamValue(wxT("orientation")) != wxT("vertical"));
86 splitter
->SplitHorizontally(win1
, win2
, sashpos
);
88 splitter
->SplitVertically(win1
, win2
, sashpos
);
92 splitter
->Initialize(win1
);
98 bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode
*node
)
100 return IsOfClass(node
, wxT("wxSplitterWindow"));