]> git.saurik.com Git - wxWidgets.git/blame - contrib/src/xml/xh_unkwn.cpp
1) some cleanup in wxHtmlWindow, moved private structures out of headers
[wxWidgets.git] / contrib / src / xml / xh_unkwn.cpp
CommitLineData
1c8ac192
VS
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
27wxUnknownWidgetXmlHandler::wxUnknownWidgetXmlHandler()
28: wxXmlResourceHandler()
29{
30 AddWindowStyles();
31}
32
33wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
34{
a559d708
VS
35 long id = GetLong(wxT("id"), -1);
36 wxString name = GetParamValue(wxT("name"));
1c8ac192
VS
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)
a559d708 46 wxLogError(wxT("Cannot find specified window for class 'unknown' (id=%li, name='%s')."), id, name.mb_str());
1c8ac192
VS
47 else
48 {
49 if (wnd->GetParent() != m_ParentAsWindow)
50 wnd->Reparent(m_ParentAsWindow);
51 SetupWindow(wnd);
52 }
53
54 return wnd;
55}
56
57bool wxUnknownWidgetXmlHandler::CanHandle(wxXmlNode *node)
58{
a559d708 59 return IsOfClass(node, wxT("unknown"));
1c8ac192
VS
60}
61