Debian Codegraph @

gtk/src/radioaction.ccg

raw
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 #include <gtk/gtk.h>
18
19
20 typedef Gtk::RadioAction::Group Group; //So that the generate get_group return type is parsed.
21
22 namespace Gtk
23 {
24
25 _DEPRECATE_IFDEF_START
26 RadioAction::RadioAction(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
27 :
28 _CONSTRUCT("name", name.c_str(), "stock_id", stock_id.get_c_str(), "label", (label.empty() ? nullptr : label.c_str()), "tooltip", (tooltip.empty() ? nullptr : tooltip.c_str()))
29 {
30 set_group(group);
31 }
32
33 RadioAction::RadioAction(Group& group, const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip)
34 :
35 _CONSTRUCT("name", name.c_str(), "icon_name", icon_name.c_str(), "label", (label.empty() ? nullptr : label.c_str()), "tooltip", (tooltip.empty() ? nullptr : tooltip.c_str()))
36 {
37 set_group(group);
38 }
39 _DEPRECATE_IFDEF_END
40
41 _DEPRECATE_IFDEF_START
42 Glib::RefPtr<RadioAction> RadioAction::create(Group& group, const Glib::ustring& name, const Glib::ustring& label, const Glib::ustring& tooltip)
43 {
44 return Glib::RefPtr<RadioAction>( new RadioAction(group, name, Gtk::StockID(), label, tooltip) );
45 }
46
47 Glib::RefPtr<RadioAction> RadioAction::create(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label, const Glib::ustring& tooltip)
48 {
49 return Glib::RefPtr<RadioAction>( new RadioAction(group, name, stock_id, label, tooltip) );
50 }
51
52 Glib::RefPtr<RadioAction> RadioAction::create_with_icon_name(Group& group, const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip)
53 {
54 return Glib::RefPtr<RadioAction>( new RadioAction(group, name, icon_name, label, tooltip) );
55 }
56
57 void RadioAction::set_group(Group& group)
58 {
59 gtk_radio_action_set_group(gobj(), group.group_);
60
61 //The group will be updated, ready for use with the next radio action:
62 group = get_group();
63 }
64 _DEPRECATE_IFDEF_END
65
66 } // namespace Gtk