/* $Id: colorselection.hg,v 1.2 2004/02/10 14:50:11 murrayc Exp $ */

/* 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.
 */

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/box_p.h)
_PINCLUDE(gtkmm/private/dialog_p.h)

#include <gtkmm/box.h>
#include <gtkmm/dialog.h>
#include <gtkmm/button.h>


namespace Gtk
{

/** A widget used to select a color.
 *
 * This widget is used to select a color. It
 * consists of a color wheel and number of sliders and entry boxes for color
 * parameters such as hue, saturation, value, red, green, blue, and opacity.
 *
 * It is found on the standard color selection dialog box
 * Gtk::ColorSelectionDialog. 
 *
 * @ingroup Widgets
 */
class ColorSelection : public VBox
{
  _CLASS_GTKOBJECT(ColorSelection,GtkColorSelection,GTK_COLOR_SELECTION,Gtk::VBox,GtkVBox)
  _IGNORE(gtk_color_selection_get_current_color, gtk_color_selection_get_previous_color,
          gtk_color_selection_set_color, gtk_color_selection_get_color, gtk_color_selection_set_update_policy)
public:
  _CTOR_DEFAULT()

  _WRAP_METHOD(bool get_has_opacity_control() const, gtk_color_selection_get_has_opacity_control)
  _WRAP_METHOD(void set_has_opacity_control(bool has_opacity = true), gtk_color_selection_set_has_opacity_control)
  _WRAP_METHOD(bool get_has_palette() const, gtk_color_selection_get_has_palette)
  _WRAP_METHOD(void set_has_palette(bool has_palette = true), gtk_color_selection_set_has_palette)
  _WRAP_METHOD(void set_current_color(const Gdk::Color& color), gtk_color_selection_set_current_color)
  _WRAP_METHOD(void set_current_alpha(guint16 alpha), gtk_color_selection_set_current_alpha)
  Gdk::Color get_current_color() const;
  _WRAP_METHOD(guint16 get_current_alpha() const, gtk_color_selection_get_current_alpha)
  _WRAP_METHOD(void set_previous_color(const Gdk::Color& color), gtk_color_selection_set_previous_color)
  _WRAP_METHOD(void set_previous_alpha(guint16 alpha), gtk_color_selection_set_previous_alpha)
  Gdk::Color get_previous_color() const;
  _WRAP_METHOD(guint16 get_previous_alpha() const, gtk_color_selection_get_previous_alpha)

  _WRAP_METHOD(bool is_adjusting() const, gtk_color_selection_is_adjusting)

  static Gdk::ArrayHandle_Color palette_from_string(const Glib::ustring& str);
  static Glib::ustring palette_to_string(const Gdk::ArrayHandle_Color& colors);

  typedef sigc::slot<void, const Glib::RefPtr<Gdk::Screen>&,
                            const Gdk::ArrayHandle_Color&> SlotChangePaletteHook;

  static SlotChangePaletteHook set_change_palette_hook(const SlotChangePaletteHook& slot);

  _WRAP_SIGNAL(void color_changed(), "color_changed")

  _WRAP_PROPERTY("has-palette", bool)
  _WRAP_PROPERTY("has-opacity-control", bool)
  _WRAP_PROPERTY("current-color", Gdk::Color)
  _WRAP_PROPERTY("current-alpha", guint)
};

/** This dialog allows the user to select a color.
 * @ingroup Dialogs
 */
class ColorSelectionDialog : public Dialog
{
  _CLASS_GTKOBJECT(ColorSelectionDialog,GtkColorSelectionDialog,GTK_COLOR_SELECTION_DIALOG,Gtk::Dialog,GtkDialog)
  _UNMANAGEABLE()
public:

  _CTOR_DEFAULT()
  _WRAP_CTOR(ColorSelectionDialog(const Glib::ustring& title), gtk_color_selection_dialog_new)

  _MEMBER_GET_PTR(colorsel,colorsel,ColorSelection*,GtkWidget*)
  _MEMBER_GET_PTR(ok_button,ok_button,Button*,GtkWidget*)
  _MEMBER_GET_PTR(cancel_button,cancel_button,Button*,GtkWidget*)
  _MEMBER_GET_PTR(help_button,help_button,Button*,GtkWidget*)
};

} // namespace Gtk

