Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Pango::Color Class Reference

A PangoColor C++ wrapper class. More...

`#include <xfc/pango/attributes.hh>`

Inheritance diagram for Xfc::Pango::Color:

List of all members.

## Public Member Functions

Constructors

- Color ()
    Constructs the default color black with a reference count of 1 that the caller owns.
- Color (const char *spec)
    Constructs a color object by filling in the fields from a string specification.
- Color (unsigned short red, unsigned short green, unsigned short blue)
    Construct a color with the specified red, green and blue values.
- Color (PangoColor *color)
    Construct a new color from an existing PangoColor.
- Color (GdkColor *color, bool copy)
    Construct a new color from an existing PangoColor.
- Color (const Color &src)
    Copy constructor.
- ~Color ()
    Destructor.
- Color & operator= (const Color &src)
    Assignment operator.

Accessors

- PangoColor * pango_color () const
    Get a pointer to the PangoColor structure.
- operator PangoColor * () const
    Conversion operator; safely converts a Color to a PangoColor pointer.
- unsigned short get_red () const
    Returns the red component of the color.
- unsigned short get_green () const
    Returns the green component of the color.
- unsigned short get_blue () const
    Returns the blue component of the color.

Methods

- void set_red (unsigned short red)
    Sets the red component of the color.
- void set_green (unsigned short green)
    Sets the green component of the color.
- void set_blue (unsigned short blue)
    Sets the blue component of the color.
- void set (unsigned short red, unsigned short green, unsigned short blue)
    Sets the red, green and blue components to the specified values.
- bool parse (const char *spec)
    Fill in the fields of a color from a string specification.

## Detailed Description

A PangoColor C++ wrapper class.

## Constructor & Destructor Documentation

Xfc::Pango::Color::Color | ( | const char * | spec | ) | `[explicit]`

Constructs a color object by filling in the fields from a string specification.

Parameters:

  | spec | A string specifying the new color.

If parsing of the specifier failed the color is set to black. The string can either be one of a large set of standard names (taken from the X11 rgb.txt file), or it can be a hex value in the form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the red, green, and blue components of the color, respectively. For example, white in the four forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff'.

Xfc::Pango::Color::Color | ( | unsigned short | red,
|  | unsigned short | green,
|  | unsigned short | blue
| ) |

Construct a color with the specified red, green and blue values.

Parameters:

  | red | The red component of the color, a value between 0 and 65535.
  | green | The green component of the color, a value between 0 and 65535.
  | blue | The blue component of the color, a value between 0 and 65535.

Xfc::Pango::Color::Color | ( | PangoColor * | color | ) | `[explicit]`

Construct a new color from an existing PangoColor.

Parameters:

  | color | A pointer to a PangoColor.

The color can be a newly created PangoColor or an existing PangoColor. The Color object created is a temporary object. It doesn't take over the ownership of PangoColor and PangoColor is not freed by the destructor. Color is created with a reference count of 1 that the caller owns.

Xfc::Pango::Color::Color | ( | GdkColor * | color,
|  | bool | copy
| ) |

Construct a new color from an existing PangoColor.

Parameters:

  | color | A pointer to a PangoColor.
  | copy | Whether the Color object should make a copy of PangoColor or not.

The color can be a newly created PangoColor or an existing PangoColor. If copy is true Color will make a copy of PangoColor. If copy is false Color wont make a copy but instead takes over the ownership of PangoColor. Either way, the destructor will free PangoColor when the Color object is destroyed. This constructor is used by G::Boxed::wrap() to wrap PangoColor objects in a C++ wrapper. Color is created with a reference count of 1 that the caller owns.

Xfc::Pango::Color::Color | ( | const Color & | src | ) |

Copy constructor.

Parameters:

  | src | The source color.

## Member Function Documentation

unsigned short Xfc::Pango::Color::get_blue | ( |  | ) | const

| Returns the blue component of the color. This is a value between 0 and 65535, with 65535 indicating full intensitiy.

unsigned short Xfc::Pango::Color::get_green | ( |  | ) | const

| Returns the green component of the color. This is a value between 0 and 65535, with 65535 indicating full intensitiy.

unsigned short Xfc::Pango::Color::get_red | ( |  | ) | const

| Returns the red component of the color. This is a value between 0 and 65535, with 65535 indicating full intensitiy.

Color& Xfc::Pango::Color::operator= | ( | const Color & | src | ) |

Assignment operator.

Parameters:

  | src | The source color.

bool Xfc::Pango::Color::parse | ( | const char * | spec | ) |

Fill in the fields of a color from a string specification.

Parameters:

  | spec | A string specifying the new color.

Returns:
  true if parsing of the specifier succeeded, otherwise false.

The string can either one of a large set of standard names (taken from the X11 rgb.txt file), or it can be a hex value in the form '#rgb' '#rrggbb' '#rrrgggbbb' or '#rrrrggggbbbb' where 'r', 'g' and 'b' are hex digits of the red, green, and blue components of the color, respectively. For example, white in the four forms is '#fff' '#ffffff' '#fffffffff' and '#ffffffffffff'.

void Xfc::Pango::Color::set | ( | unsigned short | red,
|  | unsigned short | green,
|  | unsigned short | blue
| ) |

Sets the red, green and blue components to the specified values.

Parameters:

  | red | The red component of the color, a value between 0 and 65535.
  | green | The green component of the color.
  | blue | The blue component of the color.

void Xfc::Pango::Color::set_blue | ( | unsigned short | blue | ) |

Sets the blue component of the color.

Parameters:

  | blue | The blue component, a value between 0 and 65535,

void Xfc::Pango::Color::set_green | ( | unsigned short | green | ) |

Sets the green component of the color.

Parameters:

  | green | The green component, a value between 0 and 65535,

void Xfc::Pango::Color::set_red | ( | unsigned short | red | ) |

Sets the red component of the color.

Parameters:

  | red | The red component, a value between 0 and 65535,

The documentation for this class was generated from the following file:

- attributes.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3