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"
21 #include "wx/splitter.h"
24 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindowXmlHandler
, wxXmlResourceHandler
)
26 wxSplitterWindowXmlHandler::wxSplitterWindowXmlHandler() : wxXmlResourceHandler()
28 XRC_ADD_STYLE(wxSP_3D
);
29 XRC_ADD_STYLE(wxSP_3DSASH
);
30 XRC_ADD_STYLE(wxSP_3DBORDER
);
31 #if WXWIN_COMPATIBILITY_2_6
32 XRC_ADD_STYLE(wxSP_FULLSASH
);
33 #endif // WXWIN_COMPATIBILITY_2_6
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
);
38 XRC_ADD_STYLE(wxSP_NO_XP_THEME
);
42 wxObject
*wxSplitterWindowXmlHandler::DoCreateResource()
44 XRC_MAKE_INSTANCE(splitter
, wxSplitterWindow
);
46 splitter
->Create(m_parentAsWindow
,
48 GetPosition(), GetSize(),
49 GetStyle(wxT("style"), wxSP_3D
),
52 SetupWindow(splitter
);
54 long sashpos
= GetLong(wxT("sashpos"), 0);
55 long minpanesize
= GetLong(wxT("minsize"), -1);
56 if (minpanesize
!= -1)
57 splitter
->SetMinimumPaneSize(minpanesize
);
59 wxWindow
*win1
= NULL
, *win2
= NULL
;
60 wxXmlNode
*n
= m_node
->GetChildren();
63 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
64 (n
->GetName() == wxT("object") ||
65 n
->GetName() == wxT("object_ref")))
67 wxObject
*created
= CreateResFromNode(n
, splitter
, NULL
);
68 wxWindow
*win
= wxDynamicCast(created
, wxWindow
);
83 wxLogError(wxT("wxSplitterWindow node must contain at least one window."));
85 bool horizontal
= (GetParamValue(wxT("orientation")) != wxT("vertical"));
89 splitter
->SplitHorizontally(win1
, win2
, sashpos
);
91 splitter
->SplitVertically(win1
, win2
, sashpos
);
95 splitter
->Initialize(win1
);
101 bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode
*node
)
103 return IsOfClass(node
, wxT("wxSplitterWindow"));