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

An interface for widgets that can be associated with actions. More...

#include <gtkmm/actionable.h>

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

Public Member Functions

 Actionable (Actionable && src) noexcept
 
Actionableoperator= (Actionable && src) noexcept
 
 ~Actionable () noexcept override
 
GtkActionable * gobj ()
 Provides access to the underlying C GObject. More...
 
const GtkActionable * gobj () const
 Provides access to the underlying C GObject. More...
 
Glib::ustring get_action_name () const
 Gets the action name for actionable. More...
 
void set_action_name (const Glib::ustring & action_name)
 Specifies the name of the action with which this widget should be associated. More...
 
Glib::VariantBase get_action_target_value ()
 Gets the current target value of actionable. More...
 
const Glib::VariantBase get_action_target_value () const
 Gets the current target value of actionable. More...
 
void set_action_target_value (const Glib::VariantBase & target_value)
 Sets the target value of an actionable widget. More...
 
void set_detailed_action_name (const Glib::ustring & detailed_action_name)
 Sets the action-name and associated string target value of an actionable widget. More...
 
Glib::PropertyProxy< Glib::ustring > property_action_name ()
 Default value: "". More...
 
Glib::PropertyProxy_ReadOnly< Glib::ustring > property_action_name () const
 Default value: "". More...
 
Glib::PropertyProxy< Glib::VariantBase > property_action_target ()
 
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > property_action_target () 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. More...
 

Protected Member Functions

 Actionable ()
 You should derive from this class to use it. More...
 
virtual Glib::ustring get_action_name_vfunc () const
 
virtual void set_action_name_vfunc (const Glib::ustring & action_name)
 
virtual Glib::VariantBase get_action_target_value_vfunc () const
 
virtual void set_action_target_value_vfunc (const Glib::VariantBase & action_target_value)
 

Related Functions

(Note that these are not member functions.)

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

Detailed Description

An interface for widgets that can be associated with actions.

This interface provides a convenient way of associating widgets with actions on an ApplicationWindow or Application.

It primarily consists of two properties: "action-name" and "action-target". There are also some convenience APIs for setting these properties.

The action will be looked up in action groups that are found among the widget's ancestors. Most commonly, these will be the actions with the “win.” or “app.” prefix that are associated with the ApplicationWindow or Application, but other action groups that are added with Widget::insert_action_group() will be consulted as well.

Since gtkmm 3.4:

Constructor & Destructor Documentation

◆ Actionable() [1/2]

Gtk::Actionable::Actionable ( )
protected

You should derive from this class to use it.

◆ Actionable() [2/2]

Gtk::Actionable::Actionable ( Actionable &&  src)
noexcept

◆ ~Actionable()

Gtk::Actionable::~Actionable ( )
overridenoexcept

Member Function Documentation

◆ add_interface()

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

◆ get_action_name()

Glib::ustring Gtk::Actionable::get_action_name ( ) const

Gets the action name for actionable.

Returns
The action name.

◆ get_action_name_vfunc()

virtual Glib::ustring Gtk::Actionable::get_action_name_vfunc ( ) const
protectedvirtual

◆ get_action_target_value() [1/2]

Glib::VariantBase Gtk::Actionable::get_action_target_value ( )

Gets the current target value of actionable.

Returns
The current target value.

◆ get_action_target_value() [2/2]

const Glib::VariantBase Gtk::Actionable::get_action_target_value ( ) const

Gets the current target value of actionable.

Returns
The current target value.

◆ get_action_target_value_vfunc()

virtual Glib::VariantBase Gtk::Actionable::get_action_target_value_vfunc ( ) const
protectedvirtual

◆ get_type()

static GType Gtk::Actionable::get_type ( )
static

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

◆ gobj() [1/2]

GtkActionable * Gtk::Actionable::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GtkActionable * Gtk::Actionable::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ operator=()

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

◆ property_action_name() [1/2]

Glib::PropertyProxy< Glib::ustring > Gtk::Actionable::property_action_name ( )

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.

◆ property_action_name() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Actionable::property_action_name ( ) const

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.

◆ property_action_target() [1/2]

Glib::PropertyProxy< Glib::VariantBase > Gtk::Actionable::property_action_target ( )
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_action_target() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::VariantBase > Gtk::Actionable::property_action_target ( ) const
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_action_name()

void Gtk::Actionable::set_action_name ( const Glib::ustring &  action_name)

Specifies the name of the action with which this widget should be associated.

If action_name is nullptr then the widget will be unassociated from any previous action.

Usually this function is used when the widget is located (or will be located) within the hierarchy of a Gtk::ApplicationWindow.

Names are of the form “win.save” or “app.quit” for actions on the containing Gtk::ApplicationWindow or its associated Gtk::Application, respectively. This is the same form used for actions in the Gio::Menu associated with the window.

Parameters
action_nameAn action name.

◆ set_action_name_vfunc()

virtual void Gtk::Actionable::set_action_name_vfunc ( const Glib::ustring &  action_name)
protectedvirtual

◆ set_action_target_value()

void Gtk::Actionable::set_action_target_value ( const Glib::VariantBase &  target_value)

Sets the target value of an actionable widget.

If target_value is nullptr then the target value is unset.

The target value has two purposes. First, it is used as the parameter to activation of the action associated with the Gtk::Actionable widget. Second, it is used to determine if the widget should be rendered as “active” — the widget is active if the state is equal to the given target.

Consider the example of associating a set of buttons with a Gio::Action with string state in a typical “radio button” situation. Each button will be associated with the same action, but with a different target value for that action. Clicking on a particular button will activate the action with the target of that button, which will typically cause the action’s state to change to that value. Since the action’s state is now equal to the target value of the button, the button will now be rendered as active (and the other buttons, with different targets, rendered inactive).

Parameters
target_valueA GLib::Variant to set as the target value.

◆ set_action_target_value_vfunc()

virtual void Gtk::Actionable::set_action_target_value_vfunc ( const Glib::VariantBase &  action_target_value)
protectedvirtual

◆ set_detailed_action_name()

void Gtk::Actionable::set_detailed_action_name ( const Glib::ustring &  detailed_action_name)

Sets the action-name and associated string target value of an actionable widget.

detailed_action_name is a string in the format accepted by gio_action_parse_detailed_name().

Parameters
detailed_action_nameThe detailed action name.

Friends And Related Function Documentation

◆ wrap()

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