/*
 * Copyright (C) 2003 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <gtkmm/widget.h>
#include <gtkmm/colorchooser.h>
#include <gdkmm/rgba.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_p.h)

namespace Gtk
{

/** A button to launch a color selection dialog.
 *
 * The GtkColorButton is a button which displays the currently selected color an allows to
 * open a color selection dialog to change the color. It is suitable widget for selecting a
 * color in a preference dialog.
 *
 * The ColorButton widget looks like this:
 * @image html colorbutton1.png
 *
 * @ingroup Widgets
 */
class GTKMM_API ColorButton
: public Widget,
  public ColorChooser
{
  _CLASS_GTKOBJECT(ColorButton, GtkColorButton, GTK_COLOR_BUTTON, Gtk::Widget, GtkWidget, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(ColorChooser)
public:

  /** Creates a new color button.
   *
   * This creates a widget in the form of a small button containing a swatch representing
   * the current selected color. When the button is clicked, a color-selection dialog will
   * open, allowing the user to select a color. The swatch will be updated to reflect the
   * new color when the user finishes.
   *
   * @newin{2,4}
   */
  _CTOR_DEFAULT()
  _IGNORE(gtk_color_button_new)

  /** Creates a new color button with a predefined color.
   *
   * Same as Gtk::ColorButton::ColorButton(). Additionally takes a Gdk::RGBA and
   * initializes the button with this color. Equivalent to calling ColorChooser::set_rgba(@a rgba)
   * after the default constructor.
   *
   * @param rgba A Gdk::RGBA to set the current color with.
   *
   * @newin{3,0}
   */
  _WRAP_CTOR(ColorButton(const Gdk::RGBA& rgba), gtk_color_button_new_with_rgba)

  _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_color_button_set_title)
  _WRAP_METHOD(Glib::ustring get_title() const, gtk_color_button_get_title)

  _WRAP_METHOD(void set_modal(bool modal = true), gtk_color_button_set_modal)
  _WRAP_METHOD(bool get_modal() const, gtk_color_button_get_modal)

  _WRAP_PROPERTY("title", Glib::ustring)
  _WRAP_PROPERTY("show-editor", bool)
  _WRAP_PROPERTY("modal", bool)

  // no_default_handler because GtkColorButtonClass is private.
  _WRAP_SIGNAL(void color_set(), "color-set", no_default_handler)
  _IGNORE_SIGNAL("activate")dnl// Action signal
};

} // namespace Gtk
