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

# Xfc::Gtk::ColorSelection Class Reference

A GtkColorSelection C++ wrapper class. More...

`#include <xfc/gtk/colorselection.hh>`

Inheritance diagram for Xfc::Gtk::ColorSelection:

List of all members.

## Signal Prototypes

- const ColorChangedSignalType color_changed_signal
    Color changed signal (see signal_color_changed()).

## Public Member Functions

Constructors

- ColorSelection ()
    Construct a new ColorSelection.
- virtual ~ColorSelection ()
    Destructor.

Accessors

- GtkColorSelection * gtk_color_selection () const
    Get a pointer to the GtkColorSelection structure.
- operator GtkColorSelection * () const
    Conversion operator; safely converts a ColorSelection to a GtkColorSelection pointer.
- bool get_has_opacity_control () const
    Returns true if the ColorSelection has an opacity control.
- bool get_has_palette () const
    Returns true if the ColorSelection has a color palette.
- Gdk::Color get_current_color () const
    Gets the currently selected color.
- unsigned short get_current_alpha () const
    Returns the maximum number of palette colors.
- Gdk::Color get_previous_color () const
    Retrieves the original color value.
- unsigned short get_previous_alpha () const
    Returns the previous alpha value.
- bool is_adjusting () const
    Returns true if the user is currently dragging a color around, and false if the selection has stopped.

Methods

- void set_has_opacity_control (bool has_opacity)
    Sets the ColorSelection to use or not use opacity.
- void set_has_palette (bool has_palette)
    Shows and hides the palette based upon the value of has_palette.
- void set_current_color (const Gdk::Color &color)
    Sets the current color to be color.
- void set_current_alpha (unsigned short alpha)
    Sets the current opacity to be alpha.
- void set_previous_color (const Gdk::Color &color)
    Sets the 'previous' color to be color.
- void set_previous_alpha (unsigned short alpha)
    Sets the 'previous' alpha to be alpha.

Signal Proxies

- const ColorChangedSignalProxy signal_color_changed ()
    Connect to the color_changed_signal; emitted when the color changes in the ColorSelection according to its update policy.

## Static Public Member Functions

Methods

- bool palette_from_string (const String &str, std::vector< Gdk::Color > &colors)
    Parses a color palette string; the string is a colon-separated list of color names readable by Gdk::Color::parse().
- String palette_to_string (const std::vector< Gdk::Color > &colors)
    Encodes a palette as a string, useful for persistent storage.

## Protected Member Functions

Constructors

- ColorSelection (GtkColorSelection *color_selection, bool owns_reference=false)
    Construct a new ColorSelection from an existing GtkColorSelection.

## Detailed Description

A GtkColorSelection C++ wrapper class.

The ColorSelection is a widget that is used to select a color. It consists of a color wheel and number of sliders and entry boxes for color parameters such as hue, saturation, value, red, green, blue, and opacity. It is found in the standard color selection dialog box ColorSelectionDialog.

See also: the ColorSelection HOWTO and example.

## Constructor & Destructor Documentation

Xfc::Gtk::ColorSelection::ColorSelection | ( | GtkColorSelection * | color_selection,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new ColorSelection from an existing GtkColorSelection.

Parameters:

  | color_selection | A pointer to a GtkColorSelection.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The color_selection can be a newly created GtkColorSelection or an existing GtkColorSelection. (see G::Object::Object).

## Member Function Documentation

bool Xfc::Gtk::ColorSelection::palette_from_string | ( | const String & | str,
|  | std::vector< Gdk::Color > & | colors
| ) | `[static]`

Parses a color palette string; the string is a colon-separated list of color names readable by Gdk::Color::parse().

Parameters:

  | str | A String encoding a color palette.
  | colors | A vector of Gdk::Color to fill with the newly allocated colors.

Returns:
  true if a palette was successfully parsed.

String Xfc::Gtk::ColorSelection::palette_to_string | ( | const std::vector< Gdk::Color > & | colors | ) | `[static]`

Encodes a palette as a string, useful for persistent storage.

Parameters:

  | colors | A vector of Gdk::Color objects.

Returns:
  A String encoding the palette.

void Xfc::Gtk::ColorSelection::set_current_alpha | ( | unsigned short | alpha | ) |

Sets the current opacity to be alpha.

Parameters:

  | alpha | An integer between 0 and 65535.

The first time this is called, it will also set the original opacity to be alpha too.

void Xfc::Gtk::ColorSelection::set_current_color | ( | const Gdk::Color & | color | ) |

Sets the current color to be color.

Parameters:

  | color | A Gdk::Color to set the current color with.

The first time this is called, it will also set the original color to be color too.

void Xfc::Gtk::ColorSelection::set_has_opacity_control | ( | bool | has_opacity | ) |

Sets the ColorSelection to use or not use opacity.

Parameters:

  | has_opacity | true if the ColorSelection can set the opacity, false otherwise.

void Xfc::Gtk::ColorSelection::set_has_palette | ( | bool | has_palette | ) |

Shows and hides the palette based upon the value of has_palette.

Parameters:

  | has_palette | true if the palette is to be visible, false otherwise.

void Xfc::Gtk::ColorSelection::set_previous_alpha | ( | unsigned short | alpha | ) |

Sets the 'previous' alpha to be alpha.

Parameters:

  | alpha | An integer between 0 and 65535.

This method should be called with some hesitations, as it might seem confusing to have that alpha change.

void Xfc::Gtk::ColorSelection::set_previous_color | ( | const Gdk::Color & | color | ) |

Sets the 'previous' color to be color.

Parameters:

  | color | A Gdk::Color to set the previous color with.

This method should be called with some hesitations, as it might seem confusing to have that color change. Calling set_current_color() will also set this color the first time it is called.

## Member Data Documentation

const ColorChangedSignalType Xfc::Gtk::ColorSelection::color_changed_signal `[static, protected]`

Color changed signal (see signal_color_changed()).

Calls a slot with the signature:

                 void function();

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

- colorselection.hh

Xfce Foundation Classes

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