gtkmm 4.18.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::ColorChooser Class Reference

This interface can be implemented by widgets which allow the user to choose a color. More...

#include <gtkmm/colorchooser.h>

Inheritance diagram for Gtk::ColorChooser:
Inheritance graph
[legend]

Public Member Functions

 ColorChooser (ColorChooser &&src) noexcept
 
ColorChooseroperator= (ColorChooser &&src) noexcept
 
 ~ColorChooser () noexcept override
 
GtkColorChoosergobj ()
 Provides access to the underlying C GObject.
 
const GtkColorChoosergobj () const
 Provides access to the underlying C GObject.
 
Gdk::RGBA get_rgba () const
 Gets the currently selected color.
 
void set_rgba (const Gdk::RGBA &color)
 Sets the color.
 
bool get_use_alpha () const
 Returns whether the color chooser shows the alpha channel.
 
void set_use_alpha (bool use_alpha=true)
 Sets whether or not the color chooser should use the alpha channel.
 
void add_palette (Orientation orientation, int colors_per_line, const std::vector< Gdk::RGBA > &colors)
 Adds a palette to the color chooser.
 
Glib::SignalProxy< void(const Gdk::RGBA &)> signal_color_activated ()
 
Glib::PropertyProxy< Gdk::RGBAproperty_rgba ()
 The currently selected color, as a GdkRGBA struct.
 
Glib::PropertyProxy_ReadOnly< Gdk::RGBAproperty_rgba () const
 The currently selected color, as a GdkRGBA struct.
 
Glib::PropertyProxy< bool > property_use_alpha ()
 Whether colors may have alpha (translucency).
 
Glib::PropertyProxy_ReadOnly< bool > property_use_alpha () const
 Whether colors may have alpha (translucency).
 
- Public Member Functions inherited from Glib::Interface
 Interface ()
 
 Interface (Interface &&src) noexcept
 
Interfaceoperator= (Interface &&src) noexcept
 
 Interface (const Glib::Interface_Class &interface_class)
 
 Interface (GObject *castitem)
 
 ~Interface () noexcept override
 
 Interface (const Interface &)=delete
 
Interfaceoperator= (const Interface &)=delete
 
GObjectgobj ()
 
const GObjectgobj () const
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (const ObjectBase &)=delete
 
void set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
 
void get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
 
void set_property (const Glib::ustring &property_name, const PropertyType &value)
 
void get_property (const Glib::ustring &property_name, PropertyType &value) const
 
PropertyType get_property (const Glib::ustring &property_name) const
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
 
sigc::connection connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
 
void freeze_notify ()
 
void thaw_notify ()
 
virtual void reference () const
 
virtual void unreference () const
 
GObjectgobj ()
 
const GObjectgobj () const
 
GObjectgobj_copy () const
 
- Public Member Functions inherited from sigc::trackable
 trackable () noexcept
 
 trackable (const trackable &src) noexcept
 
 trackable (trackable &&src) noexcept
 
 ~trackable ()
 
void add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
 
void notify_callbacks ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (trackable &&src) noexcept
 
void remove_destroy_notify_callback (notifiable *data) const
 

Static Public Member Functions

static void add_interface (GType gtype_implementer)
 
static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system.
 

Protected Member Functions

 ColorChooser ()
 You should derive from this class to use it.
 
virtual void on_color_activated (const Gdk::RGBA &color)
 This is a default handler for the signal signal_color_activated().
 
- Protected Member Functions inherited from Glib::ObjectBase
 ObjectBase ()
 
 ObjectBase (const char *custom_type_name)
 
 ObjectBase (const std::type_info &custom_type_info)
 
 ObjectBase (ObjectBase &&src) noexcept
 
ObjectBaseoperator= (ObjectBase &&src) noexcept
 
virtual ~ObjectBase () noexcept=0
 
void initialize (GObject *castitem)
 
void initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
 

Related Symbols

(Note that these are not member symbols.)

Glib::RefPtr< Gtk::ColorChooserwrap (GtkColorChooser *object, bool take_copy=false)
 A Glib::wrap() method for this object.
 

Additional Inherited Members

- Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify func_destroy_notify
 
- Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify func_destroy_notify
 

Detailed Description

This interface can be implemented by widgets which allow the user to choose a color.

Depending on the situation, colors may be allowed to have alpha (translucency). The main widgets that implement this interface are ColorChooserWidget, ColorChooserDialog and ColorChooserButton.

Since gtkmm 3.4:
Deprecated:
4.10: Use Gtk::ColorDialog and Gtk::ColorDialogButton instead of widgets implementing Gtk::ColorChooser.

Constructor & Destructor Documentation

◆ ColorChooser() [1/2]

Gtk::ColorChooser::ColorChooser ( )
protected

You should derive from this class to use it.

◆ ColorChooser() [2/2]

Gtk::ColorChooser::ColorChooser ( ColorChooser &&  src)
noexcept

◆ ~ColorChooser()

Gtk::ColorChooser::~ColorChooser ( )
overridenoexcept

Member Function Documentation

◆ add_interface()

static void Gtk::ColorChooser::add_interface ( GType  gtype_implementer)
static

◆ add_palette()

void Gtk::ColorChooser::add_palette ( Orientation  orientation,
int  colors_per_line,
const std::vector< Gdk::RGBA > &  colors 
)

Adds a palette to the color chooser.

If orientation is horizontal, the colors are grouped in rows, with colors_per_line colors in each row. If orientation is vertical, the colors are grouped in columns instead.

The default color palette of ColorChooserWidget has 27 colors, organized in columns of 3 colors. The default gray palette has 9 grays in a single row.

The layout of the color chooser widget works best when the palettes have 9-10 columns.

Calling this function for the first time has the side effect of removing the default color and gray palettes from the color chooser.

Parameters
orientationOrientation::HORIZONTAL if the palette should be displayed in rows, or Orientation::VERTICAL for columns
colors_per_lineThe number of colors to show in each row/column.
colorsThe colors of the palette.
Since gtkmm 3.4:

◆ get_rgba()

Gdk::RGBA Gtk::ColorChooser::get_rgba ( ) const

Gets the currently selected color.

Returns
The currently selected color.
Since gtkmm 3.4:

◆ get_type()

static GType Gtk::ColorChooser::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ get_use_alpha()

bool Gtk::ColorChooser::get_use_alpha ( ) const

Returns whether the color chooser shows the alpha channel.

Deprecated: 4.10: Use Gtk::ColorDialog instead

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

◆ gobj() [1/2]

GtkColorChooser * Gtk::ColorChooser::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkColorChooser * Gtk::ColorChooser::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ on_color_activated()

virtual void Gtk::ColorChooser::on_color_activated ( const Gdk::RGBA color)
protectedvirtual

This is a default handler for the signal signal_color_activated().

◆ operator=()

ColorChooser & Gtk::ColorChooser::operator= ( ColorChooser &&  src)
noexcept

◆ property_rgba() [1/2]

Glib::PropertyProxy< Gdk::RGBA > Gtk::ColorChooser::property_rgba ( )

The currently selected color, as a GdkRGBA struct.

The property can be set to change the current selection programmatically.

Deprecated: 4.10: Use Gtk::ColorDialog and Gtk::ColorDialogButton instead of widgets implementing Gtk::ColorChooser

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_rgba() [2/2]

Glib::PropertyProxy_ReadOnly< Gdk::RGBA > Gtk::ColorChooser::property_rgba ( ) const

The currently selected color, as a GdkRGBA struct.

The property can be set to change the current selection programmatically.

Deprecated: 4.10: Use Gtk::ColorDialog and Gtk::ColorDialogButton instead of widgets implementing Gtk::ColorChooser

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_use_alpha() [1/2]

Glib::PropertyProxy< bool > Gtk::ColorChooser::property_use_alpha ( )

Whether colors may have alpha (translucency).

When signal_use_alpha() is false, the GdkRGBA struct obtained via the property_rgba() property will be forced to have alpha == 1.

Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).

Deprecated: 4.10: Use Gtk::ColorDialog and Gtk::ColorDialogButton instead of widgets implementing Gtk::ColorChooser

Default value: true

Returns
A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

◆ property_use_alpha() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::ColorChooser::property_use_alpha ( ) const

Whether colors may have alpha (translucency).

When signal_use_alpha() is false, the GdkRGBA struct obtained via the property_rgba() property will be forced to have alpha == 1.

Implementations are expected to show alpha by rendering the color over a non-uniform background (like a checkerboard pattern).

Deprecated: 4.10: Use Gtk::ColorDialog and Gtk::ColorDialogButton instead of widgets implementing Gtk::ColorChooser

Default value: true

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ set_rgba()

void Gtk::ColorChooser::set_rgba ( const Gdk::RGBA color)

Sets the color.

Deprecated: 4.10: Use Gtk::ColorDialog instead

Parameters
colorThe new color.

◆ set_use_alpha()

void Gtk::ColorChooser::set_use_alpha ( bool  use_alpha = true)

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

Deprecated: 4.10: Use Gtk::ColorDialog instead

Parameters
use_alphatrue if color chooser should use alpha channel, false if not.

◆ signal_color_activated()

Glib::SignalProxy< void(const Gdk::RGBA &)> Gtk::ColorChooser::signal_color_activated ( )
Slot Prototype:
void on_my_color_activated(const Gdk::RGBA& color)

Flags: Run First

Emitted when a color is activated from the color chooser.

This usually happens when the user clicks a color swatch, or a color is selected and the user presses one of the keys Space, Shift+Space, Return or Enter.

Deprecated: 4.10: Use Gtk::ColorDialog and Gtk::ColorDialogButton instead of widgets implementing Gtk::ColorChooser

Parameters
colorThe color.

Friends And Related Symbol Documentation

◆ wrap()

Glib::RefPtr< Gtk::ColorChooser > wrap ( GtkColorChooser object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.