Top |
GtkUIManager * | gtk_ui_manager_new () |
void | gtk_ui_manager_set_add_tearoffs () |
gboolean | gtk_ui_manager_get_add_tearoffs () |
void | gtk_ui_manager_insert_action_group () |
void | gtk_ui_manager_remove_action_group () |
GList * | gtk_ui_manager_get_action_groups () |
GtkAccelGroup * | gtk_ui_manager_get_accel_group () |
GtkWidget * | gtk_ui_manager_get_widget () |
GSList * | gtk_ui_manager_get_toplevels () |
GtkAction * | gtk_ui_manager_get_action () |
guint | gtk_ui_manager_add_ui_from_string () |
guint | gtk_ui_manager_new_merge_id () |
void | gtk_ui_manager_add_ui () |
void | gtk_ui_manager_remove_ui () |
gchar * | gtk_ui_manager_get_ui () |
void | gtk_ui_manager_ensure_update () |
void | actions-changed | No Recursion |
void | add-widget | No Recursion |
void | connect-proxy | No Recursion |
void | disconnect-proxy | No Recursion |
void | post-activate | No Recursion |
void | pre-activate | No Recursion |
struct | GtkUIManager |
#define | gtk_ui_manager_add_ui_from_file |
enum | GtkUIManagerItemType |
GtkUIManager *
gtk_ui_manager_new (void
);
Creates a new ui manager object.
Since: 2.4
void gtk_ui_manager_set_add_tearoffs (GtkUIManager *self
,gboolean add_tearoffs
);
Sets the "add_tearoffs" property, which controls whether menus generated by this GtkUIManager will have tearoff menu items.
Note that this only affects regular menus. Generated popup menus never have tearoff menu items.
Since: 2.4
gboolean
gtk_ui_manager_get_add_tearoffs (GtkUIManager *self
);
Returns whether menus generated by this GtkUIManager will have tearoff menu items.
Since: 2.4
void gtk_ui_manager_insert_action_group (GtkUIManager *self
,GtkActionGroup *action_group
,gint pos
);
Inserts an action group into the list of action groups associated
with self
. Actions in earlier groups hide actions with the same
name in later groups.
self |
a GtkUIManager object |
|
action_group |
the action group to be inserted |
|
pos |
the position at which the group will be inserted. |
Since: 2.4
void gtk_ui_manager_remove_action_group (GtkUIManager *self
,GtkActionGroup *action_group
);
Removes an action group from the list of action groups associated
with self
.
Since: 2.4
GList *
gtk_ui_manager_get_action_groups (GtkUIManager *self
);
Returns the list of action groups associated with self
.
a GList of action groups. The list is owned by GTK+ and should not be modified.
[element-type GtkActionGroup][transfer none]
Since: 2.4
GtkAccelGroup *
gtk_ui_manager_get_accel_group (GtkUIManager *self
);
Returns the GtkAccelGroup associated with self
.
Since: 2.4
GtkWidget * gtk_ui_manager_get_widget (GtkUIManager *self
,const gchar *path
);
Looks up a widget by following a path. The path consists of the names specified in the XML description of the UI. separated by '/'. Elements which don't have a name or action attribute in the XML (e.g. <popup>) can be addressed by their XML element name (e.g. "popup"). The root element ("/ui") can be omitted in the path.
Note that the widget found by following a path that ends in a <menu> element is the menuitem to which the menu is attached, not the menu itself.
Also note that the widgets constructed by a ui manager are not tied to the lifecycle of the ui manager. If you add the widgets returned by this function to some container or explicitly ref them, they will survive the destruction of the ui manager.
Since: 2.4
GSList * gtk_ui_manager_get_toplevels (GtkUIManager *self
,GtkUIManagerItemType types
);
Obtains a list of all toplevel widgets of the requested types.
self |
||
types |
specifies the types of toplevel widgets to include. Allowed types are GTK_UI_MANAGER_MENUBAR, GTK_UI_MANAGER_TOOLBAR and GTK_UI_MANAGER_POPUP. |
a newly-allocated GSList of
all toplevel widgets of the requested types. Free the returned list with g_slist_free()
.
[element-type GtkWidget][transfer container]
Since: 2.4
GtkAction * gtk_ui_manager_get_action (GtkUIManager *self
,const gchar *path
);
Looks up an action by following a path. See gtk_ui_manager_get_widget()
for more information about paths.
the action whose proxy widget is found by following the path,
or NULL
if no widget was found.
[transfer none]
Since: 2.4
guint gtk_ui_manager_add_ui_from_string (GtkUIManager *self
,const gchar *buffer
,gssize length
,GError **error
);
Parses a string containing a UI definition and
merges it with the current contents of self
. An enclosing <ui>
element is added if it is missing.
self |
a GtkUIManager object |
|
buffer |
the string to parse |
|
length |
the length of |
|
error |
return location for an error |
The merge id for the merged UI. The merge id can be used
to unmerge the UI with gtk_ui_manager_remove_ui()
. If an error occurred,
the return value is 0.
Since: 2.4
guint
gtk_ui_manager_new_merge_id (GtkUIManager *self
);
Returns an unused merge id, suitable for use with
gtk_ui_manager_add_ui()
.
Since: 2.4
void gtk_ui_manager_add_ui (GtkUIManager *self
,guint merge_id
,const gchar *path
,const gchar *name
,const gchar *action
,GtkUIManagerItemType type
,gboolean top
);
Adds a UI element to the current contents of self
.
If type
is GTK_UI_MANAGER_AUTO
, GTK+ inserts a menuitem, toolitem or
separator if such an element can be inserted at the place determined by
path
. Otherwise type
must indicate an element that can be inserted at
the place determined by path
.
If path
points to a menuitem or toolitem, the new element will be inserted
before or after this item, depending on top
.
self |
||
merge_id |
the merge id for the merged UI, see |
|
path |
a path |
|
name |
the name for the added UI element |
|
action |
the name of the action to be proxied, or |
[allow-none] |
type |
the type of UI element to add. |
|
top |
if |
Since: 2.4
void gtk_ui_manager_remove_ui (GtkUIManager *self
,guint merge_id
);
Unmerges the part of self
s content identified by merge_id
.
self |
a GtkUIManager object |
|
merge_id |
a merge id as returned by |
Since: 2.4
gchar *
gtk_ui_manager_get_ui (GtkUIManager *self
);
Creates a UI definition of the merged UI.
Since: 2.4
void
gtk_ui_manager_ensure_update (GtkUIManager *self
);
Makes sure that all pending updates to the UI have been completed.
This may occasionally be necessary, since GtkUIManager updates the UI in an idle function. A typical example where this function is useful is to enforce that the menubar and toolbar have been added to the main window before showing it:
1 2 3 4 5 6 7 |
gtk_container_add (GTK_CONTAINER (window), vbox); g_signal_connect (merge, "add-widget", G_CALLBACK (add_widget), vbox); gtk_ui_manager_add_ui_from_file (merge, "my-menus"); gtk_ui_manager_add_ui_from_file (merge, "my-toolbars"); gtk_ui_manager_ensure_update (merge); gtk_widget_show (window); |
Since: 2.4
#define gtk_ui_manager_add_ui_from_file gtk_ui_manager_add_ui_from_file_utf8
Parses a file containing a UI definition and
merges it with the current contents of self
.
self |
a GtkUIManager object |
|
filename |
the name of the file to parse |
|
error |
return location for an error |
The merge id for the merged UI. The merge id can be used
to unmerge the UI with gtk_ui_manager_remove_ui()
. If an error occurred,
the return value is 0.
Since: 2.4
“add-tearoffs”
property “add-tearoffs” gboolean
The "add-tearoffs" property controls whether generated menus have tearoff menu items.
Note that this only affects regular menus. Generated popup menus never have tearoff menu items.
Owner: GtkUIManager
Flags: Read / Write
Default value: FALSE
Since: 2.4
“actions-changed”
signalvoid user_function (GtkUIManager *merge, gpointer user_data)
The "actions-changed" signal is emitted whenever the set of actions changes.
Flags: No Recursion
Since: 2.4
“add-widget”
signalvoid user_function (GtkUIManager *merge, GtkWidget *widget, gpointer user_data)
The add_widget signal is emitted for each generated menubar and toolbar.
It is not emitted for generated popup menus, which can be obtained by
gtk_ui_manager_get_widget()
.
merge |
||
widget |
the added widget |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Recursion
Since: 2.4
“connect-proxy”
signalvoid user_function (GtkUIManager *uimanager, GtkAction *action, GtkWidget *proxy, gpointer user_data)
The connect_proxy signal is emitted after connecting a proxy to an action in the group.
This is intended for simple customizations for which a custom action class would be too clumsy, e.g. showing tooltips for menuitems in the statusbar.
uimanager |
the ui manager |
|
action |
the action |
|
proxy |
the proxy |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Recursion
Since: 2.4
“disconnect-proxy”
signalvoid user_function (GtkUIManager *uimanager, GtkAction *action, GtkWidget *proxy, gpointer user_data)
The disconnect_proxy signal is emitted after disconnecting a proxy from an action in the group.
uimanager |
the ui manager |
|
action |
the action |
|
proxy |
the proxy |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Recursion
Since: 2.4
“post-activate”
signalvoid user_function (GtkUIManager *uimanager, GtkAction *action, gpointer user_data)
The post_activate signal is emitted just after the action
is activated.
This is intended for applications to get notification just after any action is activated.
uimanager |
the ui manager |
|
action |
the action |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Recursion
Since: 2.4
“pre-activate”
signalvoid user_function (GtkUIManager *uimanager, GtkAction *action, gpointer user_data)
The pre_activate signal is emitted just before the action
is activated.
This is intended for applications to get notification just before any action is activated.
uimanager |
the ui manager |
|
action |
the action |
|
user_data |
user data set when the signal handler was connected. |
Flags: No Recursion
Since: 2.4