1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_split.cpp
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 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
20 #include "wx/xrc/xh_split.h"
26 #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 #if WXWIN_COMPATIBILITY_2_6
36 XRC_ADD_STYLE(wxSP_FULLSASH
);
37 #endif // WXWIN_COMPATIBILITY_2_6
38 XRC_ADD_STYLE(wxSP_BORDER
);
39 XRC_ADD_STYLE(wxSP_NOBORDER
);
40 XRC_ADD_STYLE(wxSP_PERMIT_UNSPLIT
);
41 XRC_ADD_STYLE(wxSP_LIVE_UPDATE
);
42 XRC_ADD_STYLE(wxSP_NO_XP_THEME
);
46 wxObject
*wxSplitterWindowXmlHandler::DoCreateResource()
48 XRC_MAKE_INSTANCE(splitter
, wxSplitterWindow
);
50 splitter
->Create(m_parentAsWindow
,
52 GetPosition(), GetSize(),
53 GetStyle(wxT("style"), wxSP_3D
),
56 SetupWindow(splitter
);
58 long sashpos
= GetLong(wxT("sashpos"), 0);
59 long minpanesize
= GetLong(wxT("minsize"), -1);
60 if (minpanesize
!= -1)
61 splitter
->SetMinimumPaneSize(minpanesize
);
63 wxWindow
*win1
= NULL
, *win2
= NULL
;
64 wxXmlNode
*n
= m_node
->GetChildren();
67 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
68 (n
->GetName() == wxT("object") ||
69 n
->GetName() == wxT("object_ref")))
71 wxObject
*created
= CreateResFromNode(n
, splitter
, NULL
);
72 wxWindow
*win
= wxDynamicCast(created
, wxWindow
);
87 wxLogError(wxT("wxSplitterWindow node must contain at least one window."));
89 bool horizontal
= (GetParamValue(wxT("orientation")) != wxT("vertical"));
93 splitter
->SplitHorizontally(win1
, win2
, sashpos
);
95 splitter
->SplitVertically(win1
, win2
, sashpos
);
99 splitter
->Initialize(win1
);
105 bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode
*node
)
107 return IsOfClass(node
, wxT("wxSplitterWindow"));