| 1 | /* Copyright (C) 2003 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 | #undef GTK_DISABLE_DEPRECATED |
| 18 | #define GDK_DISABLE_DEPRECATION_WARNINGS 1 |
| 19 | |
| 20 | #include <gtkmm/radiobuttongroup.h> |
| 21 | |
| 22 | #include <gtkmm/radiobutton.h> |
| 23 | #include <gtkmm/radiomenuitem.h> |
| 24 | #ifndef GTKMM_DISABLE_DEPRECATED |
| 25 | #include <gtkmm/radioaction.h> |
| 26 | #endif |
| 27 | #include <gtkmm/radiotoolbutton.h> |
| 28 | #include <gtk/gtk.h> |
| 29 | |
| 30 | namespace Gtk |
| 31 | { |
| 32 | |
| 33 | RadioButtonGroup::RadioButtonGroup() |
| 34 | : group_(nullptr) |
| 35 | {} |
| 36 | |
| 37 | RadioButtonGroup::RadioButtonGroup(GSList* group) |
| 38 | : group_(group) |
| 39 | { |
| 40 | } |
| 41 | |
| 42 | RadioButtonGroup::RadioButtonGroup(const RadioButtonGroup& src) |
| 43 | : group_(src.group_) |
| 44 | { |
| 45 | } |
| 46 | |
| 47 | RadioButtonGroup& RadioButtonGroup::operator=(const RadioButtonGroup& src) |
| 48 | { |
| 49 | group_ = src.group_; |
| 50 | return *this; |
| 51 | } |
| 52 | |
| 53 | void RadioButtonGroup::add(RadioButton& item) |
| 54 | { |
| 55 | item.set_group(*this); |
| 56 | |
| 57 | //probably not necessary: |
| 58 | group_ = gtk_radio_button_get_group(item.gobj()); |
| 59 | } |
| 60 | |
| 61 | void RadioButtonGroup::add(RadioMenuItem& item) |
| 62 | { |
| 63 | item.set_group(*this); |
| 64 | |
| 65 | //probably not necessary: |
| 66 | group_ = gtk_radio_menu_item_get_group(item.gobj()); |
| 67 | } |
| 68 | |
| 69 | #ifndef GTKMM_DISABLE_DEPRECATED |
| 70 | void RadioButtonGroup::add(const Glib::RefPtr<RadioAction>& item) |
| 71 | { |
| 72 | item->set_group(*this); |
| 73 | |
| 74 | //probably not necessary: |
| 75 | group_ = gtk_radio_action_get_group(item->gobj()); |
| 76 | } |
| 77 | #endif // GTKMM_DISABLE_DEPRECATED |
| 78 | |
| 79 | void RadioButtonGroup::add(RadioToolButton& item) |
| 80 | { |
| 81 | item.set_group(*this); |
| 82 | |
| 83 | //probably not necessary: |
| 84 | group_ = gtk_radio_tool_button_get_group(item.gobj()); |
| 85 | } |
| 86 | |
| 87 | } //namespace Gtk |