Debian Codegraph @

gtk/src/radiobutton.ccg

raw
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 <gtk/gtk.h>
18
19 typedef Gtk::RadioButton::Group Group; //So that the generate get_group return type is parsed.
20
21 namespace Gtk
22 {
23
24 RadioButton::RadioButton()
25 :
26 _CONSTRUCT()
27 {}
28
29 RadioButton::RadioButton(const Glib::ustring& label, bool mnemonic)
30 :
31 _CONSTRUCT("label", label.c_str(), "use_underline", gboolean(mnemonic))
32 {}
33
34 RadioButton::RadioButton(Group& group)
35 :
36 _CONSTRUCT()
37 {
38 group.add(*this);
39 }
40
41 RadioButton::RadioButton(Group& group, const Glib::ustring& label, bool mnemonic)
42 :
43 _CONSTRUCT("label", label.c_str(), "use_underline", gboolean(mnemonic))
44 {
45 group.add(*this);
46 }
47
48 void RadioButton::set_group(Group& group)
49 {
50 gtk_radio_button_set_group(gobj(), group.group_);
51
52 //The group will be updated, ready for use with the next radiobutton:
53 group = get_group();
54 }
55
56 void RadioButton::reset_group()
57 {
58 gtk_radio_button_set_group(gobj(), nullptr);
59 }
60
61 } //namespace Gtk