1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XML resource for unknown widget
4 // Author: Vaclav Slavik
7 // Copyright: (c) 2000 Vaclav Slavik
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "xh_unkwn.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #include "wx/xml/xh_unkwn.h"
23 #include "wx/window.h"
28 class wxUnknownControlContainer
: public wxPanel
31 wxUnknownControlContainer(wxWindow
*parent
,
32 const wxString
& controlName
,
34 const wxPoint
& pos
= wxDefaultPosition
,
35 const wxSize
& size
= wxDefaultSize
)
36 : wxPanel(parent
, id
, pos
, size
, wxTAB_TRAVERSAL
| wxNO_BORDER
,
37 controlName
+ wxT("_container")),
38 m_controlName(controlName
), m_controlAdded(FALSE
)
40 m_bg
= GetBackgroundColour();
41 SetBackgroundColour(wxColour(255, 0, 255));
44 virtual void AddChild(wxWindowBase
*child
);
47 wxString m_controlName
;
52 void wxUnknownControlContainer::AddChild(wxWindowBase
*child
)
54 wxASSERT_MSG( !m_controlAdded
, wxT("Couldn't add two unknown controls to the same container!") )
56 wxPanel::AddChild(child
);
58 SetBackgroundColour(m_bg
);
59 child
->SetName(m_controlName
);
60 m_controlAdded
= TRUE
;
62 wxSizer
*sizer
= new wxBoxSizer(wxHORIZONTAL
);
63 sizer
->Add((wxWindow
*)child
, 1, wxEXPAND
);
71 wxUnknownWidgetXmlHandler::wxUnknownWidgetXmlHandler()
72 : wxXmlResourceHandler()
76 wxObject
*wxUnknownWidgetXmlHandler::DoCreateResource()
79 new wxUnknownControlContainer(m_parentAsWindow
,
81 GetPosition(), GetSize());
86 bool wxUnknownWidgetXmlHandler::CanHandle(wxXmlNode
*node
)
88 return IsOfClass(node
, wxT("unknown"));