gtkmm 4.16.0
|
An interface for widgets that can be associated with actions. More...
#include <gtkmm/actionable.h>
Public Member Functions | |
Actionable (Actionable &&src) noexcept | |
Actionable & | operator= (Actionable &&src) noexcept |
~Actionable () noexcept override | |
GtkActionable * | gobj () |
Provides access to the underlying C GObject. | |
const GtkActionable * | gobj () const |
Provides access to the underlying C GObject. | |
Glib::ustring | get_action_name () const |
Gets the action name for actionable. | |
void | set_action_name (const Glib::ustring &action_name) |
Specifies the name of the action with which this widget should be associated. | |
Glib::VariantBase | get_action_target_value () |
Gets the current target value of actionable. | |
const Glib::VariantBase | get_action_target_value () const |
Gets the current target value of actionable. | |
void | set_action_target_value (const Glib::VariantBase &target_value) |
Sets the target value of an actionable widget. | |
void | set_detailed_action_name (const Glib::ustring &detailed_action_name) |
Sets the action-name and associated string target value of an actionable widget. | |
Glib::PropertyProxy< Glib::ustring > | property_action_name () |
The name of the action with which this widget should be associated. | |
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_action_name () const |
The name of the action with which this widget should be associated. | |
Glib::PropertyProxy< Glib::VariantBase > | property_action_target () |
The target value of the actionable widget's action. | |
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > | property_action_target () const |
The target value of the actionable widget's action. | |
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 | |
Actionable () | |
You should derive from this class to use it. | |
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 Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gtk::Actionable > | wrap (GtkActionable *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
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.
|
protected |
You should derive from this class to use it.
|
noexcept |
|
overridenoexcept |
Glib::ustring Gtk::Actionable::get_action_name | ( | ) | const |
Gets the action name for actionable.
|
protectedvirtual |
Glib::VariantBase Gtk::Actionable::get_action_target_value | ( | ) |
Gets the current target value of actionable.
const Glib::VariantBase Gtk::Actionable::get_action_target_value | ( | ) | const |
Gets the current target value of actionable.
|
protectedvirtual |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
|
noexcept |
Glib::PropertyProxy< Glib::ustring > Gtk::Actionable::property_action_name | ( | ) |
The name of the action with which this widget should be associated.
Default value: ""
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::Actionable::property_action_name | ( | ) | const |
The name of the action with which this widget should be associated.
Default value: ""
Glib::PropertyProxy< Glib::VariantBase > Gtk::Actionable::property_action_target | ( | ) |
The target value of the actionable widget's action.
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > Gtk::Actionable::property_action_target | ( | ) | const |
The target value of the actionable widget's action.
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.
action_name | An action name. |
|
protectedvirtual |
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).
target_value | A GLib::Variant to set as the target value. |
|
protectedvirtual |
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().
detailed_action_name | The detailed action name. |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |