1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_bmpcbox.cpp
3 // Purpose: XRC resource for wxBitmapComboBox
4 // Author: Jaakko Salli
5 // Created: Sep-10-2006
7 // Copyright: (c) 2006 Jaakko Salli
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_BITMAPCOMBOBOX
20 #include "wx/xrc/xh_bmpcbox.h"
27 #include "wx/bmpcbox.h"
29 IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler
, wxXmlResourceHandler
)
31 wxBitmapComboBoxXmlHandler::wxBitmapComboBoxXmlHandler()
32 :wxXmlResourceHandler()
36 XRC_ADD_STYLE(wxCB_SORT
);
37 XRC_ADD_STYLE(wxCB_READONLY
);
41 wxObject
*wxBitmapComboBoxXmlHandler::DoCreateResource()
43 if (m_class
== wxT("ownerdrawnitem"))
47 ReportError("ownerdrawnitem only allowed within a wxBitmapComboBox");
51 m_combobox
->Append(GetText(wxT("text")),
52 GetBitmap(wxT("bitmap")));
56 else /*if( m_class == wxT("wxBitmapComboBox"))*/
59 long selection
= GetLong( wxT("selection"), -1 );
61 XRC_MAKE_INSTANCE(control
, wxBitmapComboBox
)
63 control
->Create(m_parentAsWindow
,
65 GetText(wxT("value")),
66 GetPosition(), GetSize(),
76 wxXmlNode
*children_node
= GetParamNode(wxT("object"));
78 wxXmlNode
*n
= children_node
;
82 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
83 (n
->GetName() == wxT("object")))
85 CreateResFromNode(n
, control
, NULL
);
94 control
->SetSelection(selection
);
102 bool wxBitmapComboBoxXmlHandler::CanHandle(wxXmlNode
*node
)
104 return ((!m_isInside
&& IsOfClass(node
, wxT("wxBitmapComboBox"))) ||
105 (m_isInside
&& IsOfClass(node
, wxT("ownerdrawnitem"))));
108 #endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX