]>
git.saurik.com Git - wxWidgets.git/blob - contrib/src/xml/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/xml/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
);
36 wxObject
*wxRadioBoxXmlHandler::DoCreateResource()
38 if( m_Node
->GetName() == _T("radiobox"))
41 long selection
= GetLong( _T("selection"), -1 );
43 // need to build the list of strings from children
45 CreateChildren( NULL
, TRUE
/* only this handler */, GetParamNode(_T("buttons")));
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 wxRadioBox
*control
= new wxRadioBox(m_ParentAsWindow
,
59 GetPosition(), GetSize(),
62 GetLong( _T("dimension"), 0 ),
69 control
->SetSelection( selection
);
75 strList
.Clear(); // dump the strings
82 // handle <item selected="boolean">Label</item>
85 strList
.Add( GetNodeContent(m_Node
) );
94 bool wxRadioBoxXmlHandler::CanHandle(wxXmlNode
*node
)
96 return( node
->GetName() == _T("radiobox") ||
98 node
->GetName() == _T("item" ))