1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_split.cpp
3 // Purpose: XRC resource for wxSplitterWindow
4 // Author: panga@freemail.hu, Vaclav Slavik
6 // Copyright: (c) 2003 panga@freemail.hu, Vaclav Slavik
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_SPLITTER
19 #include "wx/xrc/xh_split.h"
25 #include "wx/splitter.h"
27 #include "wx/xml/xml.h"
29 IMPLEMENT_DYNAMIC_CLASS(wxSplitterWindowXmlHandler
, wxXmlResourceHandler
)
31 wxSplitterWindowXmlHandler::wxSplitterWindowXmlHandler() : wxXmlResourceHandler()
33 XRC_ADD_STYLE(wxSP_3D
);
34 XRC_ADD_STYLE(wxSP_3DSASH
);
35 XRC_ADD_STYLE(wxSP_3DBORDER
);
36 #if WXWIN_COMPATIBILITY_2_6
37 XRC_ADD_STYLE(wxSP_FULLSASH
);
38 #endif // WXWIN_COMPATIBILITY_2_6
39 XRC_ADD_STYLE(wxSP_BORDER
);
40 XRC_ADD_STYLE(wxSP_NOBORDER
);
41 XRC_ADD_STYLE(wxSP_PERMIT_UNSPLIT
);
42 XRC_ADD_STYLE(wxSP_LIVE_UPDATE
);
43 XRC_ADD_STYLE(wxSP_NO_XP_THEME
);
47 wxObject
*wxSplitterWindowXmlHandler::DoCreateResource()
49 XRC_MAKE_INSTANCE(splitter
, wxSplitterWindow
);
51 splitter
->Create(m_parentAsWindow
,
53 GetPosition(), GetSize(),
54 GetStyle(wxT("style"), wxSP_3D
),
57 SetupWindow(splitter
);
59 long sashpos
= GetLong(wxT("sashpos"), 0);
60 long minpanesize
= GetLong(wxT("minsize"), -1);
61 float gravity
= GetFloat(wxT("gravity"), 0.0);
62 if (minpanesize
!= -1)
63 splitter
->SetMinimumPaneSize(minpanesize
);
65 splitter
->SetSashGravity(gravity
);
67 wxWindow
*win1
= NULL
, *win2
= NULL
;
68 wxXmlNode
*n
= m_node
->GetChildren();
71 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
72 (n
->GetName() == wxT("object") ||
73 n
->GetName() == wxT("object_ref")))
75 wxObject
*created
= CreateResFromNode(n
, splitter
, NULL
);
76 wxWindow
*win
= wxDynamicCast(created
, wxWindow
);
91 ReportError("wxSplitterWindow node must contain at least one window");
93 bool horizontal
= (GetParamValue(wxT("orientation")) != wxT("vertical"));
97 splitter
->SplitHorizontally(win1
, win2
, sashpos
);
99 splitter
->SplitVertically(win1
, win2
, sashpos
);
103 splitter
->Initialize(win1
);
109 bool wxSplitterWindowXmlHandler::CanHandle(wxXmlNode
*node
)
111 return IsOfClass(node
, wxT("wxSplitterWindow"));
114 #endif // wxUSE_XRC && wxUSE_SPLITTER