wxWidgets/include/wx/gtk/radiobut.h
Stefan Hansson 6fdf2fbec1 Implement wxRB_SINGLE support in wxGTK
Create hidden radio button in wxGTK when using wxRB_SINGLE, as
this lets us deactivate the shown button by activating the hidden one.
GTK does not allow deactivating radio buttons by calling them with
gtk_toggle_button_set_active( ..., FALSE), so we need to work around
it like this.

Also update the documentation to mention that this works in wxGTK now.

See #17022, #23652, #23677, #23839.

(modified cherry-pick of b84b45161a2952bc3706fa87619e2bf9d8237f22)
2023-10-03 19:40:39 +02:00

65 lines
2.2 KiB
C++

/////////////////////////////////////////////////////////////////////////////
// Name: wx/gtk/radiobut.h
// Purpose:
// Author: Robert Roebling
// Copyright: (c) 1998 Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_GTK_RADIOBUT_H_
#define _WX_GTK_RADIOBUT_H_
//-----------------------------------------------------------------------------
// wxRadioButton
//-----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxRadioButton: public wxRadioButtonBase
{
public:
wxRadioButton() { }
wxRadioButton( wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioButtonNameStr) )
{
Create( parent, id, label, pos, size, style, validator, name );
}
virtual ~wxRadioButton();
bool Create( wxWindow *parent,
wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxASCII_STR(wxRadioButtonNameStr) );
virtual void SetLabel(const wxString& label) wxOVERRIDE;
virtual void SetValue(bool val) wxOVERRIDE;
virtual bool GetValue() const wxOVERRIDE;
static wxVisualAttributes
GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
protected:
virtual wxBorder GetDefaultBorder() const wxOVERRIDE { return wxBORDER_NONE; }
virtual void DoApplyWidgetStyle(GtkRcStyle *style) wxOVERRIDE;
virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const wxOVERRIDE;
virtual void DoEnable(bool enable) wxOVERRIDE;
private:
typedef wxControl base_type;
wxDECLARE_DYNAMIC_CLASS(wxRadioButton);
};
#endif // _WX_GTK_RADIOBUT_H_