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

A Gtk::ColorDialog object collects the arguments that are needed to present a color chooser dialog to the user, such as a title for the dialog and whether it should be modal. More...

#include <gtkmm/colordialog.h>

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

Public Member Functions

 ColorDialog (ColorDialog&& src) noexcept
 
ColorDialogoperator= (ColorDialog&& src) noexcept
 
 ~ColorDialog () noexcept override
 
GtkColorDialog* gobj ()
 Provides access to the underlying C GObject. More...
 
const GtkColorDialog* gobj () const
 Provides access to the underlying C GObject. More...
 
GtkColorDialog* gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::ustring get_title () const
 Returns the title that will be shown on the color chooser dialog. More...
 
void set_title (const Glib::ustring& title)
 Sets the title that will be shown on the color chooser dialog. More...
 
bool get_modal () const
 Returns whether the color chooser dialog blocks interaction with the parent window while it is presented. More...
 
void set_modal (bool modal=true)
 Sets whether the color chooser dialog blocks interaction with the parent window while it is presented. More...
 
bool get_with_alpha () const
 Returns whether colors may have alpha. More...
 
void set_with_alpha (bool with_alpha=true)
 Sets whether colors may have alpha. More...
 
void choose_rgba (Window& parent, const Gdk::RGBA& initial_color, const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable={}) const
 Presents a color chooser dialog to the user. More...
 
void choose_rgba (Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable={}) const
 A choose_rgba() convenience overload. More...
 
void choose_rgba (const Gdk::RGBA& initial_color, const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable={}) const
 A choose_rgba() convenience overload. More...
 
void choose_rgba (const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable={}) const
 A choose_rgba() convenience overload. More...
 
Gdk::RGBA choose_rgba_finish (const Glib::RefPtr< Gio::AsyncResult >& result) const
 Finishes the choose_rgba() call. More...
 
Glib::PropertyProxy< Glib::ustring > property_title ()
 A title that may be shown on the color chooser dialog. More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_title () const
 A title that may be shown on the color chooser dialog. More...
 
Glib::PropertyProxy< bool > property_modal ()
 Whether the color chooser dialog is modal. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_modal () const
 Whether the color chooser dialog is modal. More...
 
Glib::PropertyProxy< bool > property_with_alpha ()
 Whether colors may have alpha (translucency). More...
 
Glib::PropertyProxy_ReadOnly< bool > property_with_alpha () const
 Whether colors may have alpha (translucency). More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< ColorDialogcreate ()
 

Protected Member Functions

 ColorDialog ()
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

A Gtk::ColorDialog object collects the arguments that are needed to present a color chooser dialog to the user, such as a title for the dialog and whether it should be modal.

The dialog is shown with the choose_rgba() method. This API follows the GIO async pattern, and the result can be obtained by calling choose_rgba_finish().

See Gtk::ColorDialogButton for a convenient control that uses Gtk::ColorDialog and presents the results.

Since gtkmm 4.10:

Constructor & Destructor Documentation

Gtk::ColorDialog::ColorDialog ( ColorDialog&&  src)
noexcept
Gtk::ColorDialog::~ColorDialog ( )
overridenoexcept
Gtk::ColorDialog::ColorDialog ( )
protected

Member Function Documentation

void Gtk::ColorDialog::choose_rgba ( Window parent,
const Gdk::RGBA initial_color,
const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
) const

Presents a color chooser dialog to the user.

Since gtkmm 4.10:
Parameters
parentThe parent window.
initial_colorThe color to select initially.
cancellableA cancellable to cancel the operation.
slotA callback to call when the operation is complete.
void Gtk::ColorDialog::choose_rgba ( Window parent,
const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
) const

A choose_rgba() convenience overload.

void Gtk::ColorDialog::choose_rgba ( const Gdk::RGBA initial_color,
const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
) const

A choose_rgba() convenience overload.

void Gtk::ColorDialog::choose_rgba ( const Gio::SlotAsyncReady &  slot,
const Glib::RefPtr< Gio::Cancellable > &  cancellable = {} 
) const

A choose_rgba() convenience overload.

Gdk::RGBA Gtk::ColorDialog::choose_rgba_finish ( const Glib::RefPtr< Gio::AsyncResult > &  result) const

Finishes the choose_rgba() call.

Since gtkmm 4.10:
Parameters
resultThe result.
Returns
The selected color.
Exceptions
Gtk::DialogError
static Glib::RefPtr<ColorDialog> Gtk::ColorDialog::create ( )
static
bool Gtk::ColorDialog::get_modal ( ) const

Returns whether the color chooser dialog blocks interaction with the parent window while it is presented.

Since gtkmm 4.10:
Returns
True if the color chooser dialog is modal.
Glib::ustring Gtk::ColorDialog::get_title ( ) const

Returns the title that will be shown on the color chooser dialog.

Since gtkmm 4.10:
Returns
The title.
static GType Gtk::ColorDialog::get_type ( )
static

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

bool Gtk::ColorDialog::get_with_alpha ( ) const

Returns whether colors may have alpha.

Since gtkmm 4.10:
Returns
True if colors may have alpha.
GtkColorDialog* Gtk::ColorDialog::gobj ( )
inline

Provides access to the underlying C GObject.

const GtkColorDialog* Gtk::ColorDialog::gobj ( ) const
inline

Provides access to the underlying C GObject.

GtkColorDialog* Gtk::ColorDialog::gobj_copy ( )

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

ColorDialog& Gtk::ColorDialog::operator= ( ColorDialog&&  src)
noexcept
Glib::PropertyProxy< bool > Gtk::ColorDialog::property_modal ( )

Whether the color chooser dialog is modal.

Since gtkmm 4.10:

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.
Glib::PropertyProxy_ReadOnly< bool > Gtk::ColorDialog::property_modal ( ) const

Whether the color chooser dialog is modal.

Since gtkmm 4.10:

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.
Glib::PropertyProxy< Glib::ustring > Gtk::ColorDialog::property_title ( )

A title that may be shown on the color chooser dialog.

Since gtkmm 4.10:

Default value: ""

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.
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::ColorDialog::property_title ( ) const

A title that may be shown on the color chooser dialog.

Since gtkmm 4.10:

Default value: ""

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
Glib::PropertyProxy< bool > Gtk::ColorDialog::property_with_alpha ( )

Whether colors may have alpha (translucency).

When with-alpha is false, the color that is selected will be forced to have alpha == 1.

Since gtkmm 4.10:

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.
Glib::PropertyProxy_ReadOnly< bool > Gtk::ColorDialog::property_with_alpha ( ) const

Whether colors may have alpha (translucency).

When with-alpha is false, the color that is selected will be forced to have alpha == 1.

Since gtkmm 4.10:

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.
void Gtk::ColorDialog::set_modal ( bool  modal = true)

Sets whether the color chooser dialog blocks interaction with the parent window while it is presented.

Since gtkmm 4.10:
Parameters
modalThe new value.
void Gtk::ColorDialog::set_title ( const Glib::ustring &  title)

Sets the title that will be shown on the color chooser dialog.

Since gtkmm 4.10:
Parameters
titleThe new title.
void Gtk::ColorDialog::set_with_alpha ( bool  with_alpha = true)

Sets whether colors may have alpha.

Since gtkmm 4.10:
Parameters
with_alphaThe new value.

Friends And Related Function Documentation

Glib::RefPtr< Gtk::ColorDialog > wrap ( GtkColorDialog *  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.