Add wxDataViewToggleRenderer::ShowAsRadio()

This allows showing radio buttons in wxDataViewCtrl easily and natively.

Notice that this approach, adding an extra function to the existing
renderer class instead of creating some new wxDataViewRadioRenderer (see
https://github.com/wxWidgets/wxWidgets/pull/809), was finally chosen
because it is simpler to implement and, more importantly, because it
will be more natural to generalize if/when we also add a 3-state
check/radio renderer.

Closes https://github.com/wxWidgets/wxWidgets/pull/853
This commit is contained in:
Vadim Zeitlin
2018-07-11 01:13:22 +02:00
parent 58832ce8d7
commit 03a13591b9
9 changed files with 111 additions and 5 deletions

View File

@@ -2539,6 +2539,11 @@ wxDataViewToggleRenderer::wxDataViewToggleRenderer( const wxString &varianttype,
SetAlignment(align);
}
void wxDataViewToggleRenderer::ShowAsRadio()
{
gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(m_renderer), TRUE);
}
bool wxDataViewToggleRenderer::SetValue( const wxVariant &value )
{
bool tmp = value;