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 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindowXmlHandler
, wxXmlResourceHandler
)
28 wxSplitterWindowXmlHandler::wxSplitterWindowXmlHandler() : wxXmlResourceHandler()
30 XRC_ADD_STYLE(wxSP_3D
);
31 XRC_ADD_STYLE(wxSP_3DSASH
);
32 XRC_ADD_STYLE(wxSP_3DBORDER
);
33 XRC_ADD_STYLE(wxSP_FULLSASH
);
34 XRC_ADD_STYLE(wxSP_BORDER
);
35 XRC_ADD_STYLE(wxSP_NOBORDER
);
36 XRC_ADD_STYLE(wxSP_PERMIT_UNSPLIT
);
37 XRC_ADD_STYLE(wxSP_LIVE_UPDATE
);
41 wxObject
*wxSplitterWindowXmlHandler::DoCreateResource()
43 XRC_MAKE_INSTANCE(splitter
, wxSplitterWindow
);
45 splitter
->Create(m_parentAsWindow
,
47 GetPosition(), GetSize(),
48 GetStyle(wxT("style"), wxSP_3D
),
51 SetupWindow(splitter
);
53 long sashpos
= GetLong(wxT("sashpos"), 0);
54 long minpanesize
= GetLong(wxT("minsize"), -1);
55 if (minpanesize
!= -1)
56 splitter
->SetMinimumPaneSize(minpanesize
);
58 wxWindow
*win1
= NULL
, *win2
= NULL
;
59 wxXmlNode
*n
= m_node
->GetChildren();
62 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
63 (n
->GetName() == wxT("object") ||
64 n
->GetName() == wxT("object_ref")))
66 wxObject
*created
= CreateResFromNode(n
, splitter
, NULL
);
67 wxWindow
*win
= wxDynamicCast(created
, wxWindow
);
82 wxLogError(wxT("wxSplitterWindow node must contain at least one window."));
84 bool horizontal
= (GetParamValue(wxT("orientation")) != wxT("vertical"));
88 splitter
->SplitHorizontally(win1
, win2
, sashpos
);
90 splitter
->SplitVertically(win1
, win2
, sashpos
);
94 splitter
->Initialize(win1
);
100 bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode
*node
)
102 return IsOfClass(node
, wxT("wxSplitterWindow"));