// -*- c++ -*-
/* $Id: colormap.ccg,v 1.3 2005/11/29 16:38:10 murrayc Exp $ */

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

#include <gdk/gdk.h>

namespace Gdk
{

Colormap::Colormap(const Glib::RefPtr<Visual>& visual, bool allocate)
: Glib::Object( G_OBJECT( gdk_colormap_new(visual->gobj(), (gboolean)allocate) ) )
  {}

_DEPRECATE_IFDEF_START
int Colormap::alloc_colors(ArrayHandle_Color& colors, int ncolors, bool writeable, bool best_match, Glib::ArrayHandle<bool>& success)
{
  return gdk_colormap_alloc_colors(gobj(), const_cast<GdkColor*>(colors.data()), ncolors, static_cast<int>(writeable), static_cast<int>(best_match), (gboolean*)(success.data()));
}

void Colormap::free_colors(Color& colors, int ncolors)
{
  gdk_colormap_free_colors(gobj(), (colors).gobj(), ncolors);
}
_DEPRECATE_IFDEF_END

void Colormap::free_color(Color& color)
{
  gdk_colormap_free_colors(gobj(), color.gobj(), 1);
}

} // namespace Gdk


