// This may look like C code, but it's really -*- C++ -*-
/*
 * Copyright (C) 2005 Koen Deforche, Kessel-Lo, Belgium.
 *
 * See the LICENSE file for terms of use.
 */
#ifndef WCOLOR_H_
#define WCOLOR_H_

#include <WString>
#include "WDllDefs.h"

/*! \brief A namespace for %Wt.
 */
namespace Wt {

/*! \class WColor WColor WColor
 *  \brief Style class for a color.
 */
class WT_API WColor
{
public:
  /*! \brief A default color (which is some other color or a transparent
   *         color depending on the context).
   */
  WColor();

  /*! \brief Color with given red/green/blue values (0-255).
   */
  WColor(int r, int g, int b);

  /*! \brief Color with a CSS name.
   */
  WColor(const WString& name);

  /*! \brief Set red/green/blue values (0-255).
   */
  void setRgb(int r, int g, int b);

  /*! \brief Set CSS name.
   */
  void setName(const WString& name);

  /*! \brief Is a default color ?
   */
  bool isDefault() const { return default_; }

  /*! \brief Get green component.
   *
   * Only available when it was set with setRgb or WColor(int r, int g, int b).
   */
  int red() const { return red_; }

  /*! \brief Get green component.
   *
   * Only available when it was set with setRgb or WColor(int r, int g, int b).
   */
  int green() const { return green_; }

  /*! \brief Get blue component.
   *
   * Only available when it was set with setRgb or WColor(int r, int g, int b).
   */
  int blue() const { return blue_; }

  /*! \brief Get CSS name.
   *
   * Only available when it was set with setName or WColor(const std::string name).
   */
  const WString& name() const { return name_; }

  bool operator== (const WColor& other) const;
  bool operator!= (const WColor& other) const;

  const std::string cssText() const;

private:
  bool    default_;
  int     red_, green_, blue_;
  WString name_;
};

/*! \brief Color white.
 */
extern WT_API const WColor white;
/*! \brief Color black.
 */
extern WT_API const WColor black;
/*! \brief Color red.
 */
extern WT_API const WColor red;
/*! \brief Color dark red.
 */
extern WT_API const WColor darkRed;
/*! \brief Color green.
 */
extern WT_API const WColor green;
/*! \brief Color dark green.
 */
extern WT_API const WColor darkGreen;
/*! \brief Color blue.
 */
extern WT_API const WColor blue;
/*! \brief Color dark blue.
 */
extern WT_API const WColor darkBlue;
/*! \brief Color cyan.
 */
extern WT_API const WColor cyan;
/*! \brief Color dark cyan.
 */
extern WT_API const WColor darkCyan;
/*! \brief Color magenta.
 */
extern WT_API const WColor magenta;
/*! \brief Color dark magenta.
 */
extern WT_API const WColor darkMagenta;
/*! \brief Color yellow.
 */
extern WT_API const WColor yellow;
/*! \brief Color dark yellow.
 */
extern WT_API const WColor darkYellow;
/*! \brief Color medium gray.
 */
extern WT_API const WColor gray;
/*! \brief Color dark gray.
 */
extern WT_API const WColor darkGray;
/*! \brief Color light gray.
 */
extern WT_API const WColor lightGray;
/*! \brief Color transparent.
 */
extern WT_API const WColor transparent;

}

#endif // WCOLOR
