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

# Xfc::Gtk::ColorButton Class Reference

A GtkColorButton C++ wrapper class. More...

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

Inheritance diagram for Xfc::Gtk::ColorButton:

List of all members.

## Signal Prototypes

- const ColorSetSignalType color_set_signal
    Color set signal (see signal_color_set()).

## Public Member Functions

Constructors

- ColorButton ()
    Constructs a new color button.
- ColorButton (const Gdk::Color &color)
    Constructs a new color button.
- virtual ~ColorButton ()
    Destructor.

Accessors

- GtkColorButton * gtk_color_button () const
    Get a pointer to the GtkColorButton structure.
- operator GtkColorButton * () const
    Conversion operator; safely converts an ColorButton to a GtkColorButton pointer.
- Gdk::Color get_color () const
    Gets the current color in the color button widget.
- unsigned short get_alpha () const
    Gets the current alpha value.
- bool get_use_alpha () const
    Determines whether the color selection dialog uses the alpha channel.
- String get_title () const
    Gets the title of the color selection dialog.

Methods

- void set_color (const Gdk::Color &color)
    Sets the current color to be color.
- void set_alpha (unsigned short alpha)
    Sets the current opacity to be alpha.
- void set_use_alpha (bool use_alpha)
    Sets whether or not the color button should use the alpha channel.
- void set_title (const String &title)
    Sets the title for the color selection dialog.

Signal Proxies

- const ColorSetSignalProxy signal_color_set ()
    Connect to the color_set_signal; emitted when the user selects a color.

## Protected Member Functions

Constructors

- ColorButton (GtkColorButton *color_button, bool owns_reference=false)
    Construct a new ColorButton from an existing GtkColorButton.

## Detailed Description

A GtkColorButton C++ wrapper class.

The ColorButton object is a button which displays the currently selected color and when clicked, opens a color selection dialog to change the color. It is a suitable widget for selecting a color in a preference dialog.

## Constructor & Destructor Documentation

Xfc::Gtk::ColorButton::ColorButton | ( | GtkColorButton * | color_button,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new ColorButton from an existing GtkColorButton.

Parameters:

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

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

Xfc::Gtk::ColorButton::ColorButton | ( |  | ) |

| Constructs a new color button. This widget is a small button containing a swatch representing the current selected color. When the button is clicked, a color selection dialog will open, allowing the user to select a color. The swatch will be updated to reflect the new color when the user finishes.

Xfc::Gtk::ColorButton::ColorButton | ( | const Gdk::Color & | color | ) | `[explicit]`

Constructs a new color button.

Parameters:

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

## Member Function Documentation

unsigned short Xfc::Gtk::ColorButton::get_alpha | ( |  | ) | const

Gets the current alpha value.

Returns:
  An integer between 0 and 65535.

Gdk::Color Xfc::Gtk::ColorButton::get_color | ( |  | ) | const

Gets the current color in the color button widget.

Returns:
  A Gdk::Color filled with the current color.

String Xfc::Gtk::ColorButton::get_title | ( |  | ) | const

Gets the title of the color selection dialog.

Returns:
  A String contining the title.

bool Xfc::Gtk::ColorButton::get_use_alpha | ( |  | ) | const

Determines whether the color selection dialog uses the alpha channel.

Returns:
  true if the color sample uses alpha channel, false if not.

void Xfc::Gtk::ColorButton::set_alpha | ( | unsigned short | alpha | ) |

Sets the current opacity to be alpha.

Parameters:

  | alpha | An integer between 0 and 65535.

void Xfc::Gtk::ColorButton::set_color | ( | const Gdk::Color & | color | ) |

Sets the current color to be color.

Parameters:

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

void Xfc::Gtk::ColorButton::set_title | ( | const String & | title | ) |

Sets the title for the color selection dialog.

Parameters:

  | title | A String containing the new window title.

void Xfc::Gtk::ColorButton::set_use_alpha | ( | bool | use_alpha | ) |

Sets whether or not the color button should use the alpha channel.

Parameters:

  | use_alpha | Set true if the button should use the alpha channel, false if not.

const ColorSetSignalProxy Xfc::Gtk::ColorButton::signal_color_set | ( |  | ) |

| Connect to the color_set_signal; emitted when the user selects a color. When handling this signal, use get_color() and get_alpha() to find out which color was just selected.

## Member Data Documentation

const ColorSetSignalType Xfc::Gtk::ColorButton::color_set_signal `[static, protected]`

Color set signal (see signal_color_set()).

Calls a slot with the signature:

                 void function();

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

- colorbutton.hh

Xfce Foundation Classes

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