]> git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/xh_unkwn.cpp
change in XRC format
[wxWidgets.git] / contrib / src / xml / xh_unkwn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: xh_unkwn.cpp
3 // Purpose: XML resource for unknown widget
4 // Author: Vaclav Slavik
5 // Created: 2000/09/09
6 // RCS-ID: $Id$
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifdef __GNUG__
12 #pragma implementation "xh_unkwn.h"
13 #endif
14
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #include "wx/xml/xh_unkwn.h"
23 #include "wx/window.h"
24 #include "wx/log.h"
25
26
27 wxUnknownWidgetXmlHandler::wxUnknownWidgetXmlHandler()
28 : wxXmlResourceHandler()
29 {
30 AddWindowStyles();
31 }
32
33 wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
34 {
35 long id = GetLong(_T("id"), -1);
36 wxString name = GetParamValue(_T("name"));
37
38 wxWindow *wnd = NULL;
39
40 if (id != -1)
41 wnd = m_ParentAsWindow->FindWindow(id);
42 if (wnd == NULL && !name.IsEmpty())
43 wnd = m_ParentAsWindow->FindWindow(name);
44
45 if (wnd == NULL)
46 wxLogError(_T("Cannot find specified window for class 'unknown' (id=%li, name='%s')."), id, name.mb_str());
47 else
48 {
49 if (wnd->GetParent() != m_ParentAsWindow)
50 wnd->Reparent(m_ParentAsWindow);
51 SetupWindow(wnd);
52 }
53
54 return wnd;
55 }
56
57 bool wxUnknownWidgetXmlHandler::CanHandle(wxXmlNode *node)
58 {
59 return IsOfClass(node, _T("unknown"));
60 }
61