]>
git.saurik.com Git - wxWidgets.git/blob - src/xrc/xh_radbx.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_radbx.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
22 #include "wx/xrc/xh_radbx.h"
23 #include "wx/radiobox.h"
27 wxRadioBoxXmlHandler::wxRadioBoxXmlHandler()
28 : wxXmlResourceHandler() , m_insideBox(FALSE
)
30 ADD_STYLE(wxRA_SPECIFY_COLS
);
31 ADD_STYLE(wxRA_HORIZONTAL
);
32 ADD_STYLE(wxRA_SPECIFY_ROWS
);
33 ADD_STYLE(wxRA_VERTICAL
);
37 wxObject
*wxRadioBoxXmlHandler::DoCreateResource()
39 if( m_class
== wxT("wxRadioBox"))
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 wxRadioBox
*control
= new wxRadioBox(m_parentAsWindow
,
59 GetText(wxT("label")),
60 GetPosition(), GetSize(),
63 GetLong( wxT("dimension"), 1 ),
70 control
->SetSelection( selection
);
76 strList
.Clear(); // dump the strings
83 // handle <item selected="boolean">Label</item>
86 strList
.Add( GetNodeContent(m_node
) );
95 bool wxRadioBoxXmlHandler::CanHandle(wxXmlNode
*node
)
97 return (IsOfClass(node
, wxT("wxRadioBox")) ||
98 (m_insideBox
&& node
->GetName() == wxT("item"))