| 1 |
/* Copyright (C) 1998-2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/checkbutton.h> |
| 18 |
#include <gtkmm/radiobuttongroup.h> |
| 19 |
_DEFS(gtkmm,gtk) |
| 20 |
_PINCLUDE(gtkmm/private/checkbutton_p.h) |
| 21 |
|
| 22 |
|
| 23 |
namespace Gtk |
| 24 |
{ |
| 25 |
|
| 26 |
/** A choice from multiple check buttons. |
| 27 |
* |
| 28 |
* A single radio button performs the same basic function as a Gtk::CheckButton, |
| 29 |
* as its position in the object hierarchy reflects. It is only when multiple |
| 30 |
* radio buttons are grouped together that they become a different user |
| 31 |
* interface component in their own right. |
| 32 |
* |
| 33 |
* Every radio button is a member of some group of radio buttons. When one is |
| 34 |
* selected, all other radio buttons in the same group are deselected. A |
| 35 |
* %Gtk::RadioButton is one way of giving the user a choice from many options. |
| 36 |
* |
| 37 |
* After constructing the first %RadioButton in a group, use get_group() and |
| 38 |
* provide this Group to the constructors ot the other RadioButtons in the same |
| 39 |
* group, or use join_group(). To remove a %Gtk::RadioButton from one group and |
| 40 |
* make it part of a new one, use set_group() or join_group(). |
| 41 |
* |
| 42 |
* The RadioButton widget looks like this: |
| 43 |
* @image html radiobutton1.png |
| 44 |
* |
| 45 |
* @ingroup Widgets |
| 46 |
*/ |
| 47 |
class GTKMM_API RadioButton : public CheckButton |
| 48 |
{ |
| 49 |
_CLASS_GTKOBJECT(RadioButton,GtkRadioButton,GTK_RADIO_BUTTON,Gtk::CheckButton,GtkCheckButton,,,GTKMM_API) |
| 50 |
_IGNORE(gtk_radio_button_new_from_widget, gtk_radio_button_new_with_mnemonic_from_widget, gtk_radio_button_new_with_label_from_widget) |
| 51 |
public: |
| 52 |
using Group = RadioButtonGroup; |
| 53 |
|
| 54 |
RadioButton(); |
| 55 |
explicit RadioButton(const Glib::ustring& label, bool mnemonic = false); |
| 56 |
|
| 57 |
/** Create an empty RadioButton belonging to the specified group, |
| 58 |
* into which you can add() a widget. |
| 59 |
* If you wish to add a Gtk::Label, |
| 60 |
* you may want to |
| 61 |
* use the Gtk::RadioButton(const Group& group, const Glib::ustring& label, bool mnemonic) |
| 62 |
* constructor directly instead. |
| 63 |
*/ |
| 64 |
explicit RadioButton(Group& group); |
| 65 |
|
| 66 |
/** Create a button belonging to the specified group, with a label inside. |
| 67 |
* You won't be able to add a widget to this button |
| 68 |
* since it already contains a Gtk::Label. |
| 69 |
*/ |
| 70 |
RadioButton(Group& group, const Glib::ustring& label, bool mnemonic = false); |
| 71 |
|
| 72 |
|
| 73 |
/** Get the radio button's group. |
| 74 |
* This group may be passed to the constructors of other radio buttons, or used with set_group(). |
| 75 |
* |
| 76 |
* @result The group to which the radio button belongs. |
| 77 |
*/ |
| 78 |
_WRAP_METHOD(Group get_group(), gtk_radio_button_get_group) |
| 79 |
|
| 80 |
/** Set the radio button's group. |
| 81 |
* You can obtain a suitable group from another radio button by using get_group(). |
| 82 |
* |
| 83 |
* @param group The group to which the radio button should belong. |
| 84 |
*/ |
| 85 |
void set_group(Group& group); |
| 86 |
|
| 87 |
/** Remove the radio button from the group. |
| 88 |
*/ |
| 89 |
void reset_group(); |
| 90 |
_IGNORE(gtk_radio_button_set_group) |
| 91 |
|
| 92 |
_WRAP_METHOD(void join_group(RadioButton& group_source), gtk_radio_button_join_group) |
| 93 |
|
| 94 |
_WRAP_SIGNAL(void group_changed(), "group_changed") |
| 95 |
|
| 96 |
/// Note that %property_group() corresponds to join_group(), rather than to get_group() and set_group(). |
| 97 |
_WRAP_PROPERTY("group", RadioButton*, newin "3,22") |
| 98 |
}; |
| 99 |
|
| 100 |
} //namespace Gtk |