// -*- c++ -*-
// Generated by gtkmmproc -- DO NOT MODIFY!
#ifndef _GDKMM_COLOR_H
#define _GDKMM_COLOR_H

#include <glibmm.h>

/* $Id: color.hg,v 1.14 2002/12/29 00:43:08 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.
 */

#include <gdk/gdkcolor.h>


#ifndef DOXYGEN_SHOULD_SKIP_THIS
extern "C" { typedef struct _GdkColor GdkColor; }
#endif

namespace Gdk
{

class Colormap;

class Color
{
  public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef Color CppObjectType;
  typedef GdkColor BaseObjectType;

  static GType get_type() G_GNUC_CONST;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */


  explicit Color(GdkColor* gobject, bool make_a_copy = true);

  Color(const Color& other);
  Color& operator=(const Color& other);

  ~Color();

  void swap(Color& other);

  ///Provides access to the underlying C instance.
  GdkColor*       gobj()       { return gobject_; }

  ///Provides access to the underlying C instance.
  const GdkColor* gobj() const { return gobject_; }

  // The caller is responsible for freeing it. Use when directly setting fields in structs.
  GdkColor* gobj_copy() const;

protected:
  GdkColor* gobject_;

private:

public:

  
  Color();
  explicit Color(const Glib::ustring& str);

  void set_grey(gushort g);
  void set_grey_p(double g);

  void set_rgb(gushort red_, gushort green_, gushort blue_);
  void set_rgb_p(double red_, double green_, double blue_);

  void set_hsv(double h, double s, double v);
  void set_hsl(double h, double s, double l);

  int set(const Glib::ustring& str); // TODO: bool return type
  int parse(const Glib::ustring& spec); // TODO: bool return type

  gushort get_red() const;
  gushort get_green() const;
  gushort get_blue() const;

  void set_red(gushort r);
  void set_green(gushort g);
  void set_blue(gushort b);

  void rgb_find_color(const Glib::RefPtr<Gdk::Colormap>& map);

  guint get_pixel() const;

  double get_red_p() const;
  double get_green_p() const;
  double get_blue_p() const;


};


/* These traits are for arrays of GdkColor structs -- not pointer arrays.
 */
struct ColorTraits
{
  typedef Gdk::Color  CppType;
  typedef GdkColor    CType;
  typedef GdkColor    CTypeNonConst;

  static CType   to_c_type      (const CppType& obj) { return *obj.gobj(); }
  static CType   to_c_type      (const CType&   obj) { return obj; }
  static CppType to_cpp_type    (const CType&   obj) { return CppType(const_cast<CType*>(&obj), true); }
  static void    release_c_type (const CType&)       {}
};

typedef Glib::ArrayHandle<Color,ColorTraits> ArrayHandle_Color;

} // namespace Gdk


namespace Gdk
{

/** @relates Gdk::Color */
bool operator==(const Color& lhs, const Color& rhs);

/** @relates Gdk::Color */
bool operator!=(const Color& lhs, const Color& rhs);


} // namespace Gdk


namespace Gdk
{

/** @relates Gdk::Color */
inline void swap(Color& lhs, Color& rhs)
  { lhs.swap(rhs); }

} // namespace Gdk

namespace Glib
{

/** @relates Gdk::Color */
Gdk::Color wrap(GdkColor* object, bool take_copy = false);

#ifndef DOXYGEN_SHOULD_SKIP_THIS
template <>
class Value<Gdk::Color> : public Glib::Value_Boxed<Gdk::Color>
{};
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

} // namespace Glib

#endif /* _GDKMM_COLOR_H */

