]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/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/xml/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_Node
->GetName() == _T("combobox"))
42 long selection
= GetLong( _T("selection"), -1 );
44 // need to build the list of strings from children
46 CreateChildren( NULL
, TRUE
/* only this handler */,
47 GetParamNode(_T("content")));
48 wxString
*strings
= (wxString
*) NULL
;
49 if( strList
.GetCount() > 0 )
51 strings
= new wxString
[strList
.GetCount()];
52 int count
= strList
.GetCount();
53 for( int i
= 0; i
< count
; i
++ )
54 strings
[i
]=strList
[i
];
58 wxComboBox
*control
= new wxComboBox(m_ParentAsWindow
,
61 GetPosition(), GetSize(),
70 control
->SetSelection( selection
);
76 strList
.Clear(); // dump the strings
83 // handle <item>Label</item>
86 strList
.Add( GetNodeContent(m_Node
) );
95 bool wxComboBoxXmlHandler::CanHandle(wxXmlNode
*node
)
97 return( node
->GetName() == _T("combobox") ||
99 node
->GetName() == _T("item" ))