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"
26 #include "wx/bmpcbox.h"
28 IMPLEMENT_DYNAMIC_CLASS(wxBitmapComboBoxXmlHandler
, wxXmlResourceHandler
)
30 wxBitmapComboBoxXmlHandler::wxBitmapComboBoxXmlHandler()
31 :wxXmlResourceHandler()
35 XRC_ADD_STYLE(wxCB_SORT
);
36 XRC_ADD_STYLE(wxCB_READONLY
);
40 wxObject
*wxBitmapComboBoxXmlHandler::DoCreateResource()
42 if (m_class
== wxT("ownerdrawnitem"))
44 wxCHECK_MSG(m_combobox
, NULL
, wxT("Incorrect syntax of XRC resource: ownerdrawnitem not within a bitmapcombobox!"));
46 m_combobox
->Append(GetText(wxT("text")), GetBitmap(wxT("bitmap"), wxART_MISSING_IMAGE
));
50 else /*if( m_class == wxT("wxBitmapComboBox"))*/
53 long selection
= GetLong( wxT("selection"), -1 );
55 XRC_MAKE_INSTANCE(control
, wxBitmapComboBox
)
57 control
->Create(m_parentAsWindow
,
59 GetText(wxT("value")),
60 GetPosition(), GetSize(),
70 wxXmlNode
*children_node
= GetParamNode(wxT("object"));
72 wxXmlNode
*n
= children_node
;
76 if ((n
->GetType() == wxXML_ELEMENT_NODE
) &&
77 (n
->GetName() == wxT("object")))
79 CreateResFromNode(n
, control
, NULL
);
88 control
->SetSelection(selection
);
96 bool wxBitmapComboBoxXmlHandler::CanHandle(wxXmlNode
*node
)
98 return ((!m_isInside
&& IsOfClass(node
, wxT("wxBitmapComboBox"))) ||
99 (m_isInside
&& IsOfClass(node
, wxT("ownerdrawnitem"))));
102 #endif // wxUSE_XRC && wxUSE_BITMAPCOMBOBOX