glibmm
2.31.22
|
TODO. More...
#include <giomm/menuitem.h>
Public Member Functions | |
virtual | ~MenuItem () |
GMenuItem* | gobj () |
Provides access to the underlying C GObject. | |
const GMenuItem* | gobj () const |
Provides access to the underlying C GObject. | |
GMenuItem* | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
void | set_attribute_value (const Glib::ustring& attribute, const Glib::VariantBase&value) |
Sets or unsets an attribute on menu_item. | |
void | set_link (const Glib::ustring& link, const Glib::RefPtr< MenuModel >& model) |
Creates a link from menu_item to model if non-0 , or unsets it. | |
void | set_label (const Glib::ustring& label) |
Sets or unsets the "label" attribute of menu_item. | |
void | set_submenu (const Glib::RefPtr< MenuModel >& submenu) |
Sets or unsets the "submenu" link of menu_item to submenu. | |
void | set_section (const Glib::RefPtr< MenuModel >& section) |
Sets or unsets the "section" link of menu_item to section. | |
void | set_action_and_target (const Glib::ustring& action) |
void | set_action_and_target (const Glib::ustring& action, const Glib::VariantBase& target_value) |
Sets or unsets the "action" and "target" attributes of menu_item. | |
void | set_detailed_action (const Glib::ustring& detailed_action) |
Sets the "action" and possibly the "target" attribute of menu_item. | |
Static Public Member Functions | |
static Glib::RefPtr< MenuItem > | create (const Glib::ustring& label, const Glib::ustring& detailed_action) |
static Glib::RefPtr< MenuItem > | create (const Glib::ustring& label, const Glib::RefPtr< MenuModel >& submenu) |
Protected Member Functions | |
MenuItem (const Glib::ustring& label=Glib::ustring(), const Glib::ustring& detailed_action=Glib::ustring()) | |
MenuItem (const Glib::ustring& label, const Glib::RefPtr< MenuModel >& submenu) | |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gio::MenuItem > | wrap (GMenuItem* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
TODO.
virtual Gio::MenuItem::~MenuItem | ( | ) | [virtual] |
Gio::MenuItem::MenuItem | ( | const Glib::ustring& | label = Glib::ustring() , |
const Glib::ustring& | detailed_action = Glib::ustring() |
||
) | [explicit, protected] |
Gio::MenuItem::MenuItem | ( | const Glib::ustring& | label, |
const Glib::RefPtr< MenuModel >& | submenu | ||
) | [explicit, protected] |
static Glib::RefPtr<MenuItem> Gio::MenuItem::create | ( | const Glib::ustring& | label, |
const Glib::ustring& | detailed_action | ||
) | [static] |
static Glib::RefPtr<MenuItem> Gio::MenuItem::create | ( | const Glib::ustring& | label, |
const Glib::RefPtr< MenuModel >& | submenu | ||
) | [static] |
GMenuItem* Gio::MenuItem::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
const GMenuItem* Gio::MenuItem::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::ObjectBase.
GMenuItem* Gio::MenuItem::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void Gio::MenuItem::set_action_and_target | ( | const Glib::ustring& | action | ) |
void Gio::MenuItem::set_action_and_target | ( | const Glib::ustring& | action, |
const Glib::VariantBase& | target_value | ||
) |
Sets or unsets the "action" and "target" attributes of menu_item.
If action is 0
then both the "action" and "target" attributes are unset (and target_value is ignored).
If action is non-0
then the "action" attribute is set. The "target" attribute is then set to the value of target_value if it is non-0
or unset otherwise.
Normal menu items (ie: not submenu, section or other custom item types) are expected to have the "action" attribute set to identify the action that they are associated with. The state type of the action help to determine the disposition of the menu item. See Action and ActionGroup for an overview of actions.
In general, clicking on the menu item will result in activation of the named action with the "target" attribute given as the parameter to the action invocation. If the "target" attribute is not set then the action is invoked with no parameter.
If the action has no state then the menu item is usually drawn as a plain menu item (ie: with no additional decoration).
If the action has a boolean state then the menu item is usually drawn as a toggle menu item (ie: with a checkmark or equivalent indication). The item should be marked as 'toggled' or 'checked' when the boolean state is true
.
If the action has a string state then the menu item is usually drawn as a radio menu item (ie: with a radio bullet or equivalent indication). The item should be marked as 'selected' when the string state is equal to the value of the target property.
See g_menu_item_set_action_and_target() or g_menu_item_set_detailed_action() for two equivalent calls that are probably more convenient for most uses.
action | The name of the action for this item. |
target_value | A Variant to use as the action target. |
void Gio::MenuItem::set_attribute_value | ( | const Glib::ustring& | attribute, |
const Glib::VariantBase& | value | ||
) |
Sets or unsets an attribute on menu_item.
The attribute to set or unset is specified by attribute. This can be one of the standard attribute names MENU_ATTRIBUTE_LABEL, MENU_ATTRIBUTE_ACTION, MENU_ATTRIBUTE_TARGET, or a custom attribute name. Attribute names are restricted to lowercase characters, numbers and '-'. Furthermore, the names must begin with a lowercase character, must not end with a '-', and must not contain consecutive dashes.
must consist only of lowercase ASCII characters, digits and '-'.
If value is non-0
then it is used as the new value for the attribute. If value is 0
then the attribute is unset. If the value Variant is floating, it is consumed.
See also g_menu_item_set_attribute() for a more convenient way to do the same.
attribute | The attribute to set. |
value | A Variant to use as the value, or 0 . |
void Gio::MenuItem::set_detailed_action | ( | const Glib::ustring& | detailed_action | ) |
Sets the "action" and possibly the "target" attribute of menu_item.
If detailed_action contains a double colon ("::") then it is used as a separator between an action name and a target string. In this case, this call is equivalent to calling g_menu_item_set_action_and_target() with the part before the "::" and with a string-type Variant containing the part following the "::".
If detailed_action doesn't contain "::" then the action is set to the given string (verbatim) and the target value is unset.
See g_menu_item_set_action_and_target() or g_menu_item_set_action_and_target_value() for more flexible (but slightly less convenient) alternatives.
See also g_menu_item_set_action_and_target_value() for a description of the semantics of the action and target attributes.
detailed_action | The "detailed" action string. |
void Gio::MenuItem::set_label | ( | const Glib::ustring& | label | ) |
Sets or unsets the "label" attribute of menu_item.
If label is non-0
it is used as the label for the menu item. If it is 0
then the label attribute is unset.
label | The label to set, or 0 to unset. |
void Gio::MenuItem::set_link | ( | const Glib::ustring& | link, |
const Glib::RefPtr< MenuModel >& | model | ||
) |
Creates a link from menu_item to model if non-0
, or unsets it.
Links are used to establish a relationship between a particular menu item and another menu. For example, MENU_LINK_SUBMENU is used to associate a submenu with a particular menu item, and MENU_LINK_SECTION is used to create a section. Other types of link can be used, but there is no guarantee that clients will be able to make sense of them. Link types are restricted to lowercase characters, numbers and '-'. Furthermore, the names must begin with a lowercase character, must not end with a '-', and must not contain consecutive dashes.
link | Type of link to establish or unset. |
model | The MenuModel to link to (or 0 to unset). |
void Gio::MenuItem::set_section | ( | const Glib::RefPtr< MenuModel >& | section | ) |
Sets or unsets the "section" link of menu_item to section.
The effect of having one menu appear as a section of another is exactly as it sounds: the items from section become a direct part of the menu that menu_item is added to. See g_menu_item_new_section() for more information about what it means for a menu item to be a section.
section | A MenuModel, or 0 . |
void Gio::MenuItem::set_submenu | ( | const Glib::RefPtr< MenuModel >& | submenu | ) |
Sets or unsets the "submenu" link of menu_item to submenu.
If submenu is non-0
, it is linked to. If it is 0
then the link is unset.
The effect of having one menu appear as a submenu of another is exactly as it sounds.
submenu | A MenuModel, or 0 . |
Glib::RefPtr< Gio::MenuItem > wrap | ( | GMenuItem * | object, |
bool | take_copy = false |
||
) | [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. |