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"
24 #include "wx/xrc/xh_split.h"
25 #include "wx/splitter.h"
28 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindowXmlHandler
, wxXmlResourceHandler
)
30 wxSplitterWindowXmlHandler::wxSplitterWindowXmlHandler() : wxXmlResourceHandler()
32 XRC_ADD_STYLE(wxSP_3D
);
33 XRC_ADD_STYLE(wxSP_3DSASH
);
34 XRC_ADD_STYLE(wxSP_3DBORDER
);
35 XRC_ADD_STYLE(wxSP_FULLSASH
);
36 XRC_ADD_STYLE(wxSP_BORDER
);
37 XRC_ADD_STYLE(wxSP_NOBORDER
);
38 XRC_ADD_STYLE(wxSP_PERMIT_UNSPLIT
);
39 XRC_ADD_STYLE(wxSP_LIVE_UPDATE
);
40 XRC_ADD_STYLE(wxSP_NO_XP_THEME
);
44 wxObject
*wxSplitterWindowXmlHandler::DoCreateResource()
46 XRC_MAKE_INSTANCE(splitter
, wxSplitterWindow
);
48 splitter
->Create(m_parentAsWindow
,
50 GetPosition(), GetSize(),
51 GetStyle(wxT("style"), wxSP_3D
),
54 SetupWindow(splitter
);
56 long sashpos
= GetLong(wxT("sashpos"), 0);
57 long minpanesize
= GetLong(wxT("minsize"), -1);
58 if (minpanesize
!= -1)
59 splitter
->SetMinimumPaneSize(minpanesize
);
61 wxWindow
*win1
= NULL
, *win2
= NULL
;
62 wxXmlNode
*n
= m_node
->GetChildren();
65 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
66 (n
->GetName() == wxT("object") ||
67 n
->GetName() == wxT("object_ref")))
69 wxObject
*created
= CreateResFromNode(n
, splitter
, NULL
);
70 wxWindow
*win
= wxDynamicCast(created
, wxWindow
);
85 wxLogError(wxT("wxSplitterWindow node must contain at least one window."));
87 bool horizontal
= (GetParamValue(wxT("orientation")) != wxT("vertical"));
91 splitter
->SplitHorizontally(win1
, win2
, sashpos
);
93 splitter
->SplitVertically(win1
, win2
, sashpos
);
97 splitter
->Initialize(win1
);
103 bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode
*node
)
105 return IsOfClass(node
, wxT("wxSplitterWindow"));