Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::ColorSelection Class Reference

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

`#include <inti/gtk/colorselection.h>`

Inheritance diagram for Inti::Gtk::ColorSelection:

List of all members.

## 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.
- GtkColorSelectionClass * gtk_color_selection_class () const
    Get a pointer to the GtkColorSelectionClass 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.

Property Proxies

- const HasOpacityControlPropertyProxy prop_has_opacity_control ()
    Whether the color selector should allow setting opacity (bool : Read / Write).
- const HasPalettePropertyProxy prop_has_palette ()
    Whether a palette should be used (bool : Read / Write).
- const CurrentColorPropertyProxy prop_current_color ()
    The current color (Pointer<Gdk::Color> : Read / Write).
- const CurrentAlphaPropertyProxy prop_current_alpha ()
    The current opacity value; 0 fully transparent, 65535 fully opaque (unsigned int : Read / Write).

Signal Proxies

- const ColorChangedSignalProxy sig_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

- bool palette_from_string (const String &str, std::vector< Pointer< 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< Pointer< Gdk::Color > > &colors)
    Encodes a palette as a string, useful for persistent storage.

## Protected Member Functions

Constructors

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

Signal Handlers

- virtual void on_color_changed ()
    Called when the color changes in the ColorSelection according to its update policy.

## 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.

## Constructor & Destructor Documentation

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

Construct a new ColorSelection from an existing GtkColorSelection.

Parameters:

  color_selection | A pointer to a GtkColorSelection.
  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 Inti::Gtk::ColorSelection::palette_from_string | ( | const String & | str,
|  | std::vector< Pointer< 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 to fill with smart pointers to a newly allocated Gdk::Color.

Returns:
  true if a palette was successfully parsed.

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

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

Parameters:

  colors | A vector of colors.

Returns:
  A String encoding the palette.

void Inti::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 Inti::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 Inti::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 Inti::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 Inti::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 Inti::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.

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

- colorselection.h

Main Page - Footer