]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_combo.cpp
78e1556cc90591132ef44bc4e92114e8071b0ecb
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/xrc/xh_combo.cpp
3 // Purpose: XRC resource for wxComboBox
4 // Author: Bob Mitchell
7 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // For compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
18 #if wxUSE_XRC && wxUSE_COMBOBOX
20 #include "wx/xrc/xh_combo.h"
24 #include "wx/combobox.h"
25 #include "wx/textctrl.h" // for wxTE_PROCESS_ENTER
28 #include "wx/xml/xml.h"
30 IMPLEMENT_DYNAMIC_CLASS(wxComboBoxXmlHandler
, wxXmlResourceHandler
)
32 wxComboBoxXmlHandler::wxComboBoxXmlHandler()
33 :wxXmlResourceHandler()
36 XRC_ADD_STYLE(wxCB_SIMPLE
);
37 XRC_ADD_STYLE(wxCB_SORT
);
38 XRC_ADD_STYLE(wxCB_READONLY
);
39 XRC_ADD_STYLE(wxCB_DROPDOWN
);
40 XRC_ADD_STYLE(wxTE_PROCESS_ENTER
);
44 wxObject
*wxComboBoxXmlHandler::DoCreateResource()
46 if( m_class
== wxT("wxComboBox"))
49 long selection
= GetLong( wxT("selection"), -1 );
51 // need to build the list of strings from children
53 CreateChildrenPrivately(NULL
, GetParamNode(wxT("content")));
55 XRC_MAKE_INSTANCE(control
, wxComboBox
)
57 control
->Create(m_parentAsWindow
,
59 GetText(wxT("value")),
60 GetPosition(), GetSize(),
67 control
->SetSelection(selection
);
71 strList
.Clear(); // dump the strings
78 // handle <item>Label</item>
81 wxString str
= GetNodeContent(m_node
);
82 if (m_resource
->GetFlags() & wxXRC_USE_LOCALE
)
83 str
= wxGetTranslation(str
, m_resource
->GetDomain());
90 bool wxComboBoxXmlHandler::CanHandle(wxXmlNode
*node
)
92 return (IsOfClass(node
, wxT("wxComboBox")) ||
93 (m_insideBox
&& node
->GetName() == wxT("item")));
96 #endif // wxUSE_XRC && wxUSE_COMBOBOX