/* $Id: button.hg,v 1.10 2006/08/21 19:07:14 jjongsma Exp $ */

/* box.h
 * 
 * Copyright (C) 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#include <gtkmm/bin.h>
#include <gtkmm/stockid.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/bin_p.h)


namespace Gtk
{

namespace Stock { struct BuiltinStockID; }


/** A widget that creates a signal when clicked on.
 *
 * This widget is generally used with a signal handler that is called when the button is pressed.
 * It can hold any valid child widget.  The most commonly used child is the Gtk::Label.
 *
 * @ingroup Widgets
 */
class Button : public Bin
{
  _CLASS_GTKOBJECT(Button,GtkButton,GTK_BUTTON,Gtk::Bin,GtkBin)
public:

  /** Create an empty button.
   * With an empty button, you can Gtk::Button::add() a widget
   * such as a Gtk::Pixmap or Gtk::Box.
   *
   * If you just wish to add a Gtk::Label,
   * you may want to
   * use the Gtk::Button(const Glib::ustring& label) ctor
   * directly instead.
   */
  _CTOR_DEFAULT


  /** Simple Push Button with label.
   * Create a button with the given label inside. You won't be able
   * to add a widget in this button since it already has a Gtk::Label
   * in it
   */
  explicit Button(const Glib::ustring& label, bool mnemonic = false);

  /** Creates a new Button containing the image and text from a stock item.
   * Stock ids have identifiers like Gtk::Stock::OK and Gtk::Stock::APPLY.
   * @param stock_id The stock item.
   */
  explicit Button(const StockID& stock_id);


  _WRAP_METHOD(void pressed(), gtk_button_pressed)
  _WRAP_METHOD(void released(),gtk_button_released)
  _WRAP_METHOD(void clicked(), gtk_button_clicked)
  _WRAP_METHOD(void enter(), gtk_button_enter)
  _WRAP_METHOD(void leave(), gtk_button_leave)

  _WRAP_METHOD(void set_relief(ReliefStyle newstyle), gtk_button_set_relief)
  _WRAP_METHOD(ReliefStyle get_relief() const, gtk_button_get_relief)

  _WRAP_METHOD(void set_label(const Glib::ustring& label), gtk_button_set_label)
  _WRAP_METHOD(Glib::ustring get_label() const, gtk_button_get_label)
  _WRAP_METHOD(void set_use_underline(bool use_underline = true), gtk_button_set_use_underline)
  _WRAP_METHOD(bool get_use_underline() const, gtk_button_get_use_underline)
  _WRAP_METHOD(void set_use_stock(bool use_stock = true), gtk_button_set_use_stock)
  _WRAP_METHOD(bool get_use_stock() const, gtk_button_get_use_stock)

  _WRAP_METHOD(void set_focus_on_click(bool focus_on_click = true), gtk_button_set_focus_on_click)
  _WRAP_METHOD(bool get_focus_on_click() const, gtk_button_get_focus_on_click)

  _WRAP_METHOD(void set_alignment(float xalign, float yalign), gtk_button_set_alignment)
  _WRAP_METHOD(void get_alignment(float& xalign, float& yalign), gtk_button_get_alignment)

  _WRAP_METHOD(void set_image(Widget& image), gtk_button_set_image)
  _WRAP_METHOD(Widget* get_image(), gtk_button_get_image)
  _WRAP_METHOD(const Widget* get_image() const, gtk_button_get_image, constversion)

  _WRAP_METHOD(void set_image_position(PositionType position), gtk_button_set_image_position)
  _WRAP_METHOD(PositionType get_image_position() const, gtk_button_get_image_position)

  _WRAP_SIGNAL(void pressed(), "pressed")
  _WRAP_SIGNAL(void released(), "released")
  _WRAP_SIGNAL(void clicked(), "clicked")
  _WRAP_SIGNAL(void enter(), "enter")
  _WRAP_SIGNAL(void leave(), "leave")
  _WRAP_SIGNAL(void activate(), "activate")

  _WRAP_PROPERTY("label", Glib::ustring)
  _WRAP_PROPERTY("relief", ReliefStyle)
  _WRAP_PROPERTY("use-underline", bool)
  _WRAP_PROPERTY("use-stock", bool)
  _WRAP_PROPERTY("focus-on-click", bool)
  _WRAP_PROPERTY("xalign", float)
  _WRAP_PROPERTY("yalign", float)
  _WRAP_PROPERTY("image", Gtk::Widget*)
  _WRAP_PROPERTY("image-position", PositionType)
};

/*! A Gtk::Button example.
 * Example 1: @link book/buttons/button/buttons.h @endlink
 * Example 2: @link book/buttons/button/buttons.cc @endlink
 * Example 3: @link book/buttons/button/main.cc @endlink
 */

} // namespace Gtk

