Debian Codegraph @

gtk/src/radioaction.hg

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 // To exclude this file from the documentation when build-deprecated-api=false.
18 _CONFIGINCLUDE(gtkmmconfig.h)
19
20 #include <gtkmm/toggleaction.h>
21 #include <gtkmm/radiobuttongroup.h>
22
23 _DEFS(gtkmm,gtk)
24 _PINCLUDE(gtkmm/private/toggleaction_p.h)
25
26 #m4 _PUSH(SECTION_CC_PRE_INCLUDES)
27 #undef GTK_DISABLE_DEPRECATED
28 #define GDK_DISABLE_DEPRECATION_WARNINGS 1
29 #m4 _POP()
30
31 _IS_DEPRECATED // This whole file is deprecated.
32
33 namespace Gtk
34 {
35
36 class GTKMM_API StockID; //Deprecated.
37
38 /** A deprecated action of which only one in a group can be active.
39 *
40 * A Gtk::RadioAction is similar to Gtk::RadioMenuItem. A number of
41 * radio actions can be linked together so that only one may be active
42 * at any one time.
43 *
44 * @deprecated Use Gio::Action and Gio::SimpleAction instead, and associate actions
45 * with Gtk::Actionable widgets. Use Gio::MenuModel for creating menus with
46 * Gtk::Menu(const Glib::RefPtr<Gio::MenuModel>& model).
47 * See the Gtk::Action base class for more information about the deprecation.
48 */
49 class GTKMM_API RadioAction : public Gtk::ToggleAction
50 {
51 _CLASS_GOBJECT(RadioAction, GtkRadioAction, GTK_RADIO_ACTION, Gtk::ToggleAction, GtkToggleAction, , , GTKMM_API)
52 public:
53 typedef RadioButtonGroup Group;
54
55 protected:
56 //TODO: Remove the default constructor, because name may not be NULL.
57 _CTOR_DEFAULT
58
59 _DEPRECATE_IFDEF_START
60 /**
61 * Creates a radio action.
62 *
63 * @param group The radio group this action belongs to.
64 * @param name A unique name for the action.
65 * @param stock_id The stock icon to display in widgets representing the
66 * action.
67 * @param label The label displayed in menu items and on buttons.
68 * @param tooltip A tooltip for the action.
69 *
70 * @deprecated There is no corresponding replacement when using Gio::Action.
71 */
72 explicit RadioAction(Group& group, const Glib::ustring& name, const StockID& stock_id = StockID(), const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
73
74 /** Creates a radio action with an icon name.
75 * The radio action's icon will reflect the specified icon name in the
76 * user's icon theme.
77 *
78 * @param group The radio group this action belongs to.
79 * @param name A unique name for the action.
80 * @param icon_name An IconTheme icon name used for widgets representing the
81 * action.
82 * @param label The label displayed in menu items and on buttons.
83 * @param tooltip A tooltip for the action.
84 * @deprecated Use Gio::Action, which can be created by Gio::ActionMap::add_action_radio_string()
85 * or Gio::ActionMap::add_action_radio_integer().<br>
86 * Use Gio::MenuItem::set_icon() to set an icon on a Gio::MenuItem associated with a Gio::Action,
87 * or Gtk::Container::add() to add a Gtk::Image to a Gtk::RadioButton.<br>
88 * Set a label on a menu item with Gio::MenuItem::set_label().
89 * For Gtk::Actionable widgets, use the widget-specific API to set a label.<br>
90 * Set tooltips on associated Gtk::Actionable widgets with Gtk::Widget::set_tooltip_text().
91 */
92 explicit RadioAction(Group& group, const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
93 _DEPRECATE_IFDEF_END
94
95 public:
96 //Note that gtk_recent_action_new() does not allow name to be NULL, which suggests that we should not have a default constructor,
97 //but it's OK to set the name later:
98 _WRAP_CREATE()
99
100 _DEPRECATE_IFDEF_START
101 /** Creates a radio action.
102 *
103 * @param group The radio group this action belongs to.
104 * @param name A unique name for the action.
105 * @param label The label displayed in menu items and on buttons.
106 * @param tooltip A tooltip for the action.
107 *
108 * @return A new RadioAction.
109 * @deprecated Use Gio::Action, which can be created by Gio::ActionMap::add_action_radio_string()
110 * or Gio::ActionMap::add_action_radio_integer().<br>
111 * Set a label on a menu item with Gio::MenuItem::set_label().
112 * For Gtk::Actionable widgets, use the widget-specific API to set a label.<br>
113 * Set tooltips on associated Gtk::Actionable widgets with Gtk::Widget::set_tooltip_text().
114 */
115 static Glib::RefPtr<RadioAction> create(Group& group, const Glib::ustring& name, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
116
117 /** Creates a radio action with a stock ID.
118 * The stock ID is used to set a default icon, text and accelerator for
119 * the radio action.
120 *
121 * @param group The radio group this action belongs to.
122 * @param name A unique name for the action.
123 * @param stock_id The stock icon to display in widgets representing the
124 * action.
125 * @param label The label displayed in menu items and on buttons.
126 * @param tooltip A tooltip for the action.
127 *
128 * @return A new RadioAction.
129 *
130 * @deprecated There is no corresponding replacement when using Gio::Action.
131 */
132 static Glib::RefPtr<RadioAction> create(Group& group, const Glib::ustring& name, const Gtk::StockID& stock_id, const Glib::ustring& label = Glib::ustring(), const Glib::ustring& tooltip = Glib::ustring());
133
134 /** Creates a radio action with an icon name.
135 * The radio action's icon will reflect the specified icon name in the
136 * user's icon theme.
137 *
138 * @param group The radio group this action belongs to.
139 * @param name A unique name for the action.
140 * @param icon_name An IconTheme icon name used for widgets representing the
141 * action.
142 * @param label The label displayed in menu items and on buttons.
143 * @param tooltip A tooltip for the action.
144 *
145 * @return A new RadioAction.
146 * @deprecated Use Gio::Action, which can be created by Gio::ActionMap::add_action_radio_string()
147 * or Gio::ActionMap::add_action_radio_integer().<br>
148 * Use Gio::MenuItem::set_icon() to set an icon on a Gio::MenuItem associated with a Gio::Action,
149 * or Gtk::Container::add() to add a Gtk::Image to a Gtk::RadioButton.<br>
150 * Set a label on a menu item with Gio::MenuItem::set_label().
151 * For Gtk::Actionable widgets, use the widget-specific API to set a label.<br>
152 * Set tooltips on associated Gtk::Actionable widgets with Gtk::Widget::set_tooltip_text().
153 */
154 static Glib::RefPtr<RadioAction> create_with_icon_name(Group& group, const Glib::ustring& name, const Glib::ustring& icon_name, const Glib::ustring& label, const Glib::ustring& tooltip);
155 _DEPRECATE_IFDEF_END
156
157 _WRAP_METHOD(Group get_group(), gtk_radio_action_get_group,
158 deprecated "There is no corresponding replacement when using Gio::Action.")
159 _DEPRECATE_IFDEF_START
160 /** @deprecated There is no corresponding replacement when using Gio::Action.
161 */
162 void set_group(Group& group);
163 _DEPRECATE_IFDEF_END
164 _IGNORE(gtk_radio_action_set_group)
165
166 _WRAP_METHOD(void join_group(const Glib::RefPtr<RadioAction>& group_source), gtk_radio_action_join_group,
167 deprecated "There is no corresponding replacement when using Gio::Action.")
168
169 _WRAP_METHOD(int get_current_value() const, gtk_radio_action_get_current_value,
170 deprecated "Use Gio::Action::get_state() on a Gio::Action instead.")
171 _WRAP_METHOD(void set_current_value(int current_value), gtk_radio_action_set_current_value,
172 deprecated "Use Gio::Action::change_state() on a Gio::Action instead.")
173
174 #m4 _CONVERSION(`GtkRadioAction*',`const Glib::RefPtr<RadioAction>&',`Glib::wrap($3, true)')
175
176 _WRAP_SIGNAL(void changed(const Glib::RefPtr<RadioAction>& current), changed,
177 deprecated "Use Gio::SimpleAction::signal_activate() or Gio::SimpleAction::signal_change_state() instead.")
178
179 _WRAP_PROPERTY("value", int, deprecated "Use Gio::Action instead, and Gtk::Actionable::property_action_target() on one of the associated actionable widgets.")
180 //Probably wouldn't work: _WRAP_PROPERTY("group", Group)
181 _IGNORE_PROPERTY(group)
182 _WRAP_PROPERTY("current-value", int, deprecated "Use Gio::Action::property_state() and Gio::SimpleAction::property_state() instead.")
183 };
184
185 } // namespace Gtk