]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_combo.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: XML resource for wxRadioBox
4 // Author: Bob Mitchell
7 // Copyright: (c) 2000 Bob Mitchell and Verant Interactive
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "xh_combo.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #include "wx/xrc/xh_combo.h"
23 #include "wx/combobox.h"
27 wxComboBoxXmlHandler::wxComboBoxXmlHandler()
28 : wxXmlResourceHandler() , m_insideBox(FALSE
)
30 ADD_STYLE(wxCB_SIMPLE
);
32 ADD_STYLE(wxCB_READONLY
);
33 ADD_STYLE(wxCB_DROPDOWN
);
37 wxObject
*wxComboBoxXmlHandler::DoCreateResource()
39 if( m_class
== wxT("wxComboBox"))
42 long selection
= GetLong( wxT("selection"), -1 );
44 // need to build the list of strings from children
46 CreateChildrenPrivately( NULL
, GetParamNode(wxT("content")));
47 wxString
*strings
= (wxString
*) NULL
;
48 if( strList
.GetCount() > 0 )
50 strings
= new wxString
[strList
.GetCount()];
51 int count
= strList
.GetCount();
52 for( int i
= 0; i
< count
; i
++ )
53 strings
[i
]=strList
[i
];
57 wxComboBox
*control
= new wxComboBox(m_parentAsWindow
,
59 GetText(wxT("value")),
60 GetPosition(), GetSize(),
69 control
->SetSelection( selection
);
75 strList
.Clear(); // dump the strings
82 // handle <item>Label</item>
85 strList
.Add( GetNodeContent(m_node
) );
94 bool wxComboBoxXmlHandler::CanHandle(wxXmlNode
*node
)
96 return (IsOfClass(node
, wxT("wxComboBox")) ||
97 (m_insideBox
&& node
->GetName() == wxT("item"))