]>
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
);
36 wxObject
*wxComboBoxXmlHandler::DoCreateResource()
38 if( m_Node
->GetName() == _T("combobox"))
41 long selection
= GetLong( _T("selection"), -1 );
43 // need to build the list of strings from children
45 CreateChildren( NULL
, TRUE
/* only this handler */);
46 wxString
*strings
= (wxString
*) NULL
;
47 if( strList
.GetCount() > 0 )
49 strings
= new wxString
[strList
.GetCount()];
50 int count
= strList
.GetCount();
51 for( int i
= 0; i
< count
; i
++ )
52 strings
[i
]=strList
[i
];
56 wxComboBox
*control
= new wxComboBox(m_ParentAsWindow
,
59 GetPosition(), GetSize(),
68 control
->SetSelection( selection
);
74 strList
.Clear(); // dump the strings
81 // handle <item>Label</item>
84 strList
.Add( GetNodeContent(m_Node
) );
93 bool wxComboBoxXmlHandler::CanHandle(wxXmlNode
*node
)
95 return( node
->GetName() == _T("combobox") ||
97 node
->GetName() == _T("item" ))