Merged revisions 6293,6296-6306,6308 via svnmerge from
[ardour.git] / libs / gtkmm2 / gtk / src / button.hg
1 /* $Id: button.hg,v 1.10 2006/08/21 19:07:14 jjongsma Exp $ */
2
3 /* box.h
4  * 
5  * Copyright (C) 1998-2002 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 Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 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  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library 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/bin.h>
23 #include <gtkmm/stockid.h>
24 _DEFS(gtkmm,gtk)
25 _PINCLUDE(gtkmm/private/bin_p.h)
26
27
28 namespace Gtk
29 {
30
31 namespace Stock { struct BuiltinStockID; }
32
33
34 /** A widget that creates a signal when clicked on.
35  *
36  * This widget is generally used with a signal handler that is called when the button is pressed.
37  * It can hold any valid child widget.  The most commonly used child is the Gtk::Label.
38  *
39  * @ingroup Widgets
40  */
41 class Button : public Bin
42 {
43   _CLASS_GTKOBJECT(Button,GtkButton,GTK_BUTTON,Gtk::Bin,GtkBin)
44 public:
45
46   /** Create an empty button.
47    * With an empty button, you can Gtk::Button::add() a widget
48    * such as a Gtk::Pixmap or Gtk::Box.
49    *
50    * If you just wish to add a Gtk::Label,
51    * you may want to
52    * use the Gtk::Button(const Glib::ustring& label) ctor
53    * directly instead.
54    */
55   _CTOR_DEFAULT
56
57
58   /** Simple Push Button with label.
59    * Create a button with the given label inside. You won't be able
60    * to add a widget in this button since it already has a Gtk::Label
61    * in it
62    */
63   explicit Button(const Glib::ustring& label, bool mnemonic = false);
64
65   /** Creates a new Button containing the image and text from a stock item.
66    * Stock ids have identifiers like Gtk::Stock::OK and Gtk::Stock::APPLY.
67    * @param stock_id The stock item.
68    */
69   explicit Button(const StockID& stock_id);
70
71
72   _WRAP_METHOD(void pressed(), gtk_button_pressed)
73   _WRAP_METHOD(void released(),gtk_button_released)
74   _WRAP_METHOD(void clicked(), gtk_button_clicked)
75   _WRAP_METHOD(void enter(), gtk_button_enter)
76   _WRAP_METHOD(void leave(), gtk_button_leave)
77
78   _WRAP_METHOD(void set_relief(ReliefStyle newstyle), gtk_button_set_relief)
79   _WRAP_METHOD(ReliefStyle get_relief() const, gtk_button_get_relief)
80
81   _WRAP_METHOD(void set_label(const Glib::ustring& label), gtk_button_set_label)
82   _WRAP_METHOD(Glib::ustring get_label() const, gtk_button_get_label)
83   _WRAP_METHOD(void set_use_underline(bool use_underline = true), gtk_button_set_use_underline)
84   _WRAP_METHOD(bool get_use_underline() const, gtk_button_get_use_underline)
85   _WRAP_METHOD(void set_use_stock(bool use_stock = true), gtk_button_set_use_stock)
86   _WRAP_METHOD(bool get_use_stock() const, gtk_button_get_use_stock)
87
88   _WRAP_METHOD(void set_focus_on_click(bool focus_on_click = true), gtk_button_set_focus_on_click)
89   _WRAP_METHOD(bool get_focus_on_click() const, gtk_button_get_focus_on_click)
90
91   _WRAP_METHOD(void set_alignment(float xalign, float yalign), gtk_button_set_alignment)
92   _WRAP_METHOD(void get_alignment(float& xalign, float& yalign), gtk_button_get_alignment)
93
94   _WRAP_METHOD(void set_image(Widget& image), gtk_button_set_image)
95   _WRAP_METHOD(Widget* get_image(), gtk_button_get_image)
96   _WRAP_METHOD(const Widget* get_image() const, gtk_button_get_image, constversion)
97
98   _WRAP_METHOD(void set_image_position(PositionType position), gtk_button_set_image_position)
99   _WRAP_METHOD(PositionType get_image_position() const, gtk_button_get_image_position)
100
101   _WRAP_SIGNAL(void pressed(), "pressed")
102   _WRAP_SIGNAL(void released(), "released")
103   _WRAP_SIGNAL(void clicked(), "clicked")
104   _WRAP_SIGNAL(void enter(), "enter")
105   _WRAP_SIGNAL(void leave(), "leave")
106   _WRAP_SIGNAL(void activate(), "activate")
107
108   _WRAP_PROPERTY("label", Glib::ustring)
109   _WRAP_PROPERTY("relief", ReliefStyle)
110   _WRAP_PROPERTY("use-underline", bool)
111   _WRAP_PROPERTY("use-stock", bool)
112   _WRAP_PROPERTY("focus-on-click", bool)
113   _WRAP_PROPERTY("xalign", float)
114   _WRAP_PROPERTY("yalign", float)
115   _WRAP_PROPERTY("image", Gtk::Widget*)
116   _WRAP_PROPERTY("image-position", PositionType)
117 };
118
119 /*! A Gtk::Button example.
120  * Example 1: @link book/buttons/button/buttons.h @endlink
121  * Example 2: @link book/buttons/button/buttons.cc @endlink
122  * Example 3: @link book/buttons/button/main.cc @endlink
123  */
124
125 } // namespace Gtk
126