1/* $Id: radiotoolbutton.hg,v 1.10 2005/11/30 14:10:49 murrayc Exp $ */
2
3/* box.h
4 *
5 * Copyright (C) 2003 The gtkmm Development Team
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free
19 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#include <gtkmm/toggletoolbutton.h>
23#include <gtkmm/radiobuttongroup.h>
24_DEFS(gtkmm,gtk)
25_PINCLUDE(gtkmm/private/toggletoolbutton_p.h)
26
27
28namespace Gtk
29{
30
31/** A toolbar item that contains a radio button.
32 *
33 * A Gtk::RadioToolButton is a Gtk::ToolItem that contains a radio button, that is,
34 * a button that is part of a group of toggle buttons where only one button can be
35 * active at a time.
36 *
37 * @ingroup Widgets
38 */
39class RadioToolButton : public ToggleToolButton
40{
41  _CLASS_GTKOBJECT(RadioToolButton, GtkRadioToolButton, GTK_RADIO_TOOL_BUTTON, Gtk::ToggleToolButton, GtkToggleToolButton)
42public:
43  typedef RadioButtonGroup Group;
44
45  /** Creates a new Gtk::RadioToolButton and a new group.
46   *
47   * The RadioToolButton will have an empty label and will reside in an newly created Group.
48   * Use get_group() to retrieve this group and pass it to other radio buttons to assign
49   * them to this group.
50   *
51   * @newin{2,4}
52   */
53  _CTOR_DEFAULT()
54
55  /** Creates a new Gtk::RadioToolButton in an existing group.
56   *
57   * The RadioToolButton will have the label @a label and will be put into the Group
58   * @a group.
59   *
60   * @param group The existing group which will be used for this RadioButton.
61   * @param label The string used to display the label for this RadioToolButton.
62   *
63   * @newin{2,4}
64   */
65  explicit RadioToolButton(Group& group, const Glib::ustring& label = Glib::ustring());
66  _IGNORE(gtk_radio_tool_button_new)
67
68  /** Creates a new Gtk::RadioToolButton in an existing group.
69   *
70   * The RadioToolButton will be created according to the StockID properties and put into
71   * the Group @a group.
72   *
73   * @param group The existing group which will be used for this RadioButton.
74   * @param stock_id The StockID which determines the look of the RadioToolButton.
75   *
76   * @newin{2,4}
77   */
78  RadioToolButton(Group& group, const Gtk::StockID& stock_id);
79  _IGNORE(gtk_radio_tool_button_new_from_stock)
80
81  //This would look to much like a copy constructor:
82  //People should use second.set_group(first.get_group()) instead.
83  //explicit RadioToolButton(RadioToolButton& group, const Gtk::StockID& stock_id = Gtk::StockID());
84  _IGNORE(gtk_radio_tool_button_new_with_stock_from_widget, gtk_radio_tool_button_new_from_widget)
85
86  //This does not correspond to any gtk_radio_tool_button_*_new() function,
87  //but it should work (it just sets properties), and it makes this class consistent with the
88  //other ToolButton classes.
89
90  /** Creates a new Gtk::RadioToolButton with an image and a new group.
91   *
92   * The RadioToolButton will have the label @a label and an image widget @a icon_widget.
93   *
94   * @param icon_widget The widget placed as the RadioToolButton's icon.
95   * @param label The string used to display the label for this RadioToolButton.
96   *
97   * @newin{2,4}
98   */
99  explicit RadioToolButton(Widget& icon_widget, const Glib::ustring& label = Glib::ustring());
100
101
102  _WRAP_METHOD(Group get_group(), gtk_radio_tool_button_get_group)
103  _WRAP_METHOD(void set_group(Group& group), gtk_radio_tool_button_set_group)
104
105  //Probably wouldn't work: _WRAP_PROPERTY("group", Group)
106};
107
108} // namespace Gtk
109
110