1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_bmpcbox.cpp
3 // Purpose: XRC resource for wxBitmapComboBox
4 // Author: Jaakko Salli
5 // Created: Sep-10-2006
6 // Copyright: (c) 2006 Jaakko Salli
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
17 #if wxUSE_XRC && wxUSE_BITMAPCOMBOBOX
19 #include "wx/xrc/xh_bmpcbox.h"
26 #include "wx/bmpcbox.h"
28 #include "wx/xml/xml.h"
30 IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler
, wxXmlResourceHandler
)
32 wxBitmapComboBoxXmlHandler::wxBitmapComboBoxXmlHandler()
33 :wxXmlResourceHandler()
37 XRC_ADD_STYLE(wxCB_SORT
);
38 XRC_ADD_STYLE(wxCB_READONLY
);
42 wxObject
*wxBitmapComboBoxXmlHandler::DoCreateResource()
44 if (m_class
== wxT("ownerdrawnitem"))
48 ReportError("ownerdrawnitem only allowed within a wxBitmapComboBox");
52 m_combobox
->Append(GetText(wxT("text")),
53 GetBitmap(wxT("bitmap")));
57 else /*if( m_class == wxT("wxBitmapComboBox"))*/
60 long selection
= GetLong( wxT("selection"), -1 );
62 XRC_MAKE_INSTANCE(control
, wxBitmapComboBox
)
64 control
->Create(m_parentAsWindow
,
66 GetText(wxT("value")),
67 GetPosition(), GetSize(),
77 wxXmlNode
*children_node
= GetParamNode(wxT("object"));
79 wxXmlNode
*n
= children_node
;
83 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
84 (n
->GetName() == wxT("object")))
86 CreateResFromNode(n
, control
, NULL
);
95 control
->SetSelection(selection
);
103 bool wxBitmapComboBoxXmlHandler::CanHandle(wxXmlNode
*node
)
105 return ((!m_isInside
&& IsOfClass(node
, wxT("wxBitmapComboBox"))) ||
106 (m_isInside
&& IsOfClass(node
, wxT("ownerdrawnitem"))));
109 #endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX