/* $Id: colormap.hg,v 1.7 2006/04/12 11:11:24 murrayc 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 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.
 */

// This is for including the config header before any code (such as
// the #ifndef GDKMM_DISABLE_DEPRECATED in deprecated classes) is generated:
_CONFIGINCLUDE(gdkmmconfig.h)

#include <glibmm/object.h>
#include <gdkmm/visual.h>
#include <gdkmm/color.h>
_DEFS(gdkmm,gdk)
_PINCLUDE(glibmm/private/object_p.h)


namespace Gdk
{

/** A Colormap is an object that contains the mapping between the color values stored in memory and the RGB values that are
 * used to display color values. In general, colormaps only contain significant information for pseudo-color visuals, but
 * even for other visual types, a colormap object is required in some circumstances.
 *
 * There are a couple of special colormaps that can be retrieved. The system colormap (retrieved with get_system()) is the
 * default colormap of the system. If you are using GdkRGB, there is another colormap that is important - the colormap in
 * which GdkRGB works, retrieved with Gdk::rgb_get_colormap(). However, when using GdkRGB, it is not generally necessary to
 * allocate colors directly.
 */
class Colormap : public Glib::Object
{
  _CLASS_GOBJECT(Colormap, GdkColormap, GDK_COLORMAP, Glib::Object, GObject)
  _IGNORE(gdk_colormap_ref, gdk_colormap_unref)
  _IGNORE(gdk_colormap_get_system_size, gdk_colormap_change)
protected:
  explicit Colormap(const Glib::RefPtr<Visual>& visual, bool allocate);

public:

  _WRAP_CREATE(const Glib::RefPtr<Visual>& visual, bool allocate)

  _WRAP_METHOD(static Glib::RefPtr<Colormap> get_system(), gdk_colormap_get_system, refreturn)

  //_WRAP_METHOD(void change(int ncolors), gdk_colormap_change)

  _DEPRECATE_IFDEF_START
  ///@deprecated Use alloc_color().
  int alloc_colors(ArrayHandle_Color& colors, int ncolors, bool writeable, bool best_match, Glib::ArrayHandle<bool>& success);
  _IGNORE(gdk_colormap_alloc_colors)

  ///@deprecated Use free_color()
  void free_colors(Color& colors, int ncolors);
  _IGNORE(gdk_colormap_free_colors)
  _DEPRECATE_IFDEF_END

  _WRAP_METHOD(bool alloc_color(Color& color, bool writeable = false, bool best_match = true), gdk_colormap_alloc_color)
  void free_color(Color& color);

  _WRAP_METHOD(void query_color (gulong pixel, Color& result), gdk_colormap_query_color)

  _WRAP_METHOD(Glib::RefPtr<Visual> get_visual(), gdk_colormap_get_visual, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Visual> get_visual() const, gdk_colormap_get_visual, refreturn, constversion)
  
  _WRAP_METHOD(Glib::RefPtr<Screen> get_screen(), gdk_colormap_get_screen, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Screen> get_screen() const, gdk_colormap_get_screen, refreturn, constversion)
  
};

} /* namespace Gdk */

