<object class="sizeritem">
<flag>wxALIGN_CENTER_VERTICAL|wxALL</flag>
<border>5</border>
+ <size>300,60</size>
<object class="wxToolBar">
<style>wxTB_FLAT|wxTB_NODIVIDER</style>
<margins>2,2</margins>
<bitmap>variable.xpm</bitmap>
<longhelp>Replace variables in the XRC file at runtime</longhelp>
</object>
+ <object class="wxComboBox">
+ <content>
+ <item>Just</item>
+ <item>a combobox</item>
+ <item>in the toolbar</item>
+ </content>
+ </object>
</object>
</object>
<object class="sizeritem">
<bitmap>variable.xpm</bitmap>
<longhelp>Replace variables in the XRC file at runtime</longhelp>
</object>
+ <object class="wxComboBox">
+ <content>
+ <item>Just</item>
+ <item>a combobox</item>
+ <item>in the toolbar</item>
+ </content>
+ </object>
</object>
</object>
</object>
<dimension>1</dimension>
<selection>0</selection>
<content>
- <item>Power 108</item>
- <item>WMMS 100.7</item>
- <item>Energy 98.3</item>
+ <item tooltip="Powerful radio station">Power 108</item>
+ <item tooltip="">WMMS 100.7</item>
+ <item tooltip="E=mc^2">Energy 98.3</item>
<item>CHUM FM</item>
<item>92FM</item>
</content>
wxObject *wxRadioBoxXmlHandler::DoCreateResource()
{
- if( m_class == wxT("wxRadioBox"))
+ if ( m_class == wxT("wxRadioBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = true;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
- wxString *strings = (wxString *) NULL;
- if( strList.GetCount() > 0 )
+
+ wxString *strings;
+ if ( !labels.empty() )
+ {
+ strings = new wxString[labels.size()];
+ const unsigned count = labels.size();
+ for( unsigned i = 0; i < count; i++ )
+ strings[i] = labels[i];
+ }
+ else
{
- strings = new wxString[strList.GetCount()];
- int count = strList.GetCount();
- for( int i = 0; i < count; i++ )
- strings[i]=strList[i];
+ strings = NULL;
}
XRC_MAKE_INSTANCE(control, wxRadioBox)
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
- strList.GetCount(),
+ labels.size(),
strings,
GetLong(wxT("dimension"), 1),
GetStyle(),
wxDefaultValidator,
GetName());
+ delete[] strings;
+
if (selection != -1)
control->SetSelection(selection);
SetupWindow(control);
- if (strings != NULL)
- delete[] strings;
- strList.Clear(); // dump the strings
+ const unsigned count = labels.size();
+ for( unsigned i = 0; i < count; i++ )
+ {
+ if ( !tooltips[i].empty() )
+ control->SetItemToolTip(i, tooltips[i]);
+ }
+
+ labels.clear(); // dump the strings
+ tooltips.clear(); // dump the tooltips
return control;
}
- else
+ else // inside the radiobox element
{
- // on the inside now.
- // handle <item selected="boolean">Label</item>
+ // we handle <item tooltip="...">Label</item> constructs here
- // add to the list
wxString str = GetNodeContent(m_node);
+ wxString tooltip;
+ m_node->GetPropVal(wxT("tooltip"), &tooltip);
+
if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
+ {
str = wxGetTranslation(str);
- strList.Add(str);
+ if ( !tooltip.empty() )
+ tooltip = wxGetTranslation(tooltip);
+ }
+
+ labels.push_back(str);
+ tooltips.push_back(tooltip);
return NULL;
}