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

#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
//Allow us to set the struct fields.
//TODO: Remove these functions anyway in an ABI break.
#undef GSEAL_ENABLE
#m4 _POP()

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.
 *
 * A ColorSelectionDialog looks like this:
 * @image html colorselectiondialog1.png
 *
 * @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)

  _WRAP_METHOD(ColorSelection* get_color_selection(), gtk_color_selection_dialog_get_color_selection)
  _WRAP_METHOD(const ColorSelection* get_color_selection() const, gtk_color_selection_dialog_get_color_selection)

_DEPRECATE_IFDEF_START
  //TODO: Remove these in gtkmm 3. They use G_SEAL()ed struct fields.

  /** @deprecated Use get_color_selection() instead.
   */
  ColorSelection* get_colorsel();

  /** @deprecated Use get_color_selection() instead.
   */
  const ColorSelection* get_colorsel() const;

  /** @deprecated Use Gtk::Dialog::get_widget_for_response() instead.
   */
  _MEMBER_GET_PTR(ok_button,ok_button,Button*,GtkWidget*)

  /** @deprecated Use Gtk::Dialog::get_widget_for_response() instead.
   */
  _MEMBER_GET_PTR(cancel_button,cancel_button,Button*,GtkWidget*)

  /** @deprecated Use Gtk::Dialog::get_widget_for_response() instead.
   */
  _MEMBER_GET_PTR(help_button,help_button,Button*,GtkWidget*)
_DEPRECATE_IFDEF_END

  _WRAP_PROPERTY("color-selection", ColorSelection*)
  _WRAP_PROPERTY("ok-button", Button*)
  _WRAP_PROPERTY("cancel-button", Button*)
  _WRAP_PROPERTY("help-button", Button*)
};

} // namespace Gtk
