Blob Blame History Raw
/* Copyright (C) 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 <glibmm/value.h>
#include <glibmm/utility.h>
#include <pango/pango-attributes.h>

_DEFS(pangomm,pango)

namespace Pango
{

/** A Pango::Color is used to represent a color in an uncalibrated RGB colorspace.
 */
class Color
{
  _CLASS_BOXEDTYPE_STATIC(Color, PangoColor, _pango_color_new, pango_color_copy, pango_color_free)
  _IGNORE(pango_color_copy, pango_color_free)

public:

  _DEPRECATE_IFDEF_START
  /// @deprecated Use the const version.
  explicit operator bool();
  _DEPRECATE_IFDEF_END

  /// Tests whether the Color is valid.
  explicit operator bool() const;
  
  /** Gets the red component of the color.
   * @return The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  _MEMBER_GET(red, red, guint16, guint16)

  /** Gets the green component of the color.
   * @return The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  _MEMBER_GET(green, green, guint16, guint16)

  /** Gets the blue component of the color.
   * @return The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  _MEMBER_GET(blue, blue, guint16, guint16)

  /** Sets the red component of the color.
   * @param value The red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  _MEMBER_SET(red, red, guint16, guint16)

  /** Sets the green component of the color.
   * @param value The green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  _MEMBER_SET(green, green, guint16, guint16)

  /** Sets the blue component of the color.
   * @param value The blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensity.
   */
  _MEMBER_SET(blue, blue, guint16, guint16)

  _WRAP_METHOD(bool parse(const Glib::ustring& spec), pango_color_parse)

  _WRAP_METHOD(Glib::ustring to_string() const, pango_color_to_string)
};

} /* namespace Pango */