1 2@c %start of fragment 3 4@deftp Class <gtk-ui-manager> 5Derives from @code{<gtk-buildable>}, @code{<gobject>}. 6 7This class defines the following slots: 8 9@table @code 10@item add-tearoffs 11Whether tearoff menu items should be added to menus 12 13@item ui 14An XML string describing the merged UI 15 16@end table 17 18@end deftp 19 20@defop Signal <gtk-ui-manager> connect-proxy (arg0@tie{}@code{<gtk-action>}) (arg1@tie{}@code{<gtk-widget>}) 21The connect_proxy signal is emitted after connecting a proxy to an action in the 22group. 23 24This is intended for simple customizations for which a custom action class would 25be too clumsy, e.g. showing tooltips for menuitems in the statusbar. 26 27Since 2.4 28 29@end defop 30 31@defop Signal <gtk-ui-manager> disconnect-proxy (arg0@tie{}@code{<gtk-action>}) (arg1@tie{}@code{<gtk-widget>}) 32The disconnect_proxy signal is emitted after disconnecting a proxy from an 33action in the group. 34 35Since 2.4 36 37@end defop 38 39@defop Signal <gtk-ui-manager> pre-activate (arg0@tie{}@code{<gtk-action>}) 40The pre_activate signal is emitted just before the @var{action} is activated. 41 42This is intended for applications to get notification just before any action is 43activated. 44 45Since 2.4 46 47@end defop 48 49@defop Signal <gtk-ui-manager> post-activate (arg0@tie{}@code{<gtk-action>}) 50The post_activate signal is emitted just after the @var{action} is activated. 51 52This is intended for applications to get notification just after any action is 53activated. 54 55Since 2.4 56 57@end defop 58 59@defop Signal <gtk-ui-manager> add-widget (arg0@tie{}@code{<gtk-widget>}) 60The add_widget signal is emitted for each generated menubar and toolbar. It is 61not emitted for generated popup menus, which can be obtained by 62@code{gtk-ui-manager-get-widget}. 63 64Since 2.4 65 66@end defop 67 68@defop Signal <gtk-ui-manager> actions-changed 69The "actions-changed" signal is emitted whenever the set of actions changes. 70 71Since 2.4 72 73@end defop 74 75@deffn Function gtk-ui-manager-new @result{}@tie{} (ret@tie{}@code{<gtk-ui-manager>}) 76Creates a new ui manager object. 77 78@table @var 79@item ret 80a new ui manager object. 81 82@end table 83 84Since 2.4 85 86@end deffn 87 88@deffn Function gtk-ui-manager-set-add-tearoffs (self@tie{}@code{<gtk-ui-manager>}) (add_tearoffs@tie{}@code{bool}) 89@deffnx Method set-add-tearoffs 90Sets the "add_tearoffs" property, which controls whether menus generated by this 91@code{<gtk-ui-manager>} will have tearoff menu items. 92 93Note that this only affects regular menus. Generated popup menus never have 94tearoff menu items. 95 96@table @var 97@item self 98a @code{<gtk-ui-manager>} 99 100@item add-tearoffs 101whether tearoff menu items are added 102 103@end table 104 105Since 2.4 106 107@end deffn 108 109@deffn Function gtk-ui-manager-get-add-tearoffs (self@tie{}@code{<gtk-ui-manager>}) @result{}@tie{} (ret@tie{}@code{bool}) 110@deffnx Method get-add-tearoffs 111Returns whether menus generated by this @code{<gtk-ui-manager>} will have 112tearoff menu items. 113 114@table @var 115@item self 116a @code{<gtk-ui-manager>} 117 118@item ret 119whether tearoff menu items are added 120 121@end table 122 123Since 2.4 124 125@end deffn 126 127@deffn Function gtk-ui-manager-insert-action-group (self@tie{}@code{<gtk-ui-manager>}) (action_group@tie{}@code{<gtk-action-group>}) (pos@tie{}@code{int}) 128@deffnx Method insert-action-group 129Inserts an action group into the list of action groups associated with 130@var{self}. Actions in earlier groups hide actions with the same name in later 131groups. 132 133@table @var 134@item self 135a @code{<gtk-ui-manager>} object 136 137@item action-group 138the action group to be inserted 139 140@item pos 141the position at which the group will be inserted. 142 143@end table 144 145Since 2.4 146 147@end deffn 148 149@deffn Function gtk-ui-manager-remove-action-group (self@tie{}@code{<gtk-ui-manager>}) (action_group@tie{}@code{<gtk-action-group>}) 150@deffnx Method remove-action-group 151Removes an action group from the list of action groups associated with 152@var{self}. 153 154@table @var 155@item self 156a @code{<gtk-ui-manager>} object 157 158@item action-group 159the action group to be removed 160 161@end table 162 163Since 2.4 164 165@end deffn 166 167@deffn Function gtk-ui-manager-get-action-groups (self@tie{}@code{<gtk-ui-manager>}) @result{}@tie{} (ret@tie{}@code{glist-of}) 168@deffnx Method get-action-groups 169Returns the list of action groups associated with @var{self}. 170 171@table @var 172@item self 173a @code{<gtk-ui-manager>} object 174 175@item ret 176a @code{<g-list>} of action groups. The list is owned by GTK+ and should not be 177modified. 178 179@end table 180 181Since 2.4 182 183@end deffn 184 185@deffn Function gtk-ui-manager-get-accel-group (self@tie{}@code{<gtk-ui-manager>}) @result{}@tie{} (ret@tie{}@code{<gtk-accel-group>}) 186@deffnx Method get-accel-group 187Returns the @code{<gtk-accel-group>} associated with @var{self}. 188 189@table @var 190@item self 191a @code{<gtk-ui-manager>} object 192 193@item ret 194the @code{<gtk-accel-group>}. 195 196@end table 197 198Since 2.4 199 200@end deffn 201 202@deffn Function gtk-ui-manager-get-widget (self@tie{}@code{<gtk-ui-manager>}) (path@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{<gtk-widget>}) 203@deffnx Method get-widget 204Looks up a widget by following a path. The path consists of the names specified 205in the XML description of the UI. separated by '/'. Elements which don't have a 206name or action attribute in the XML (e.g. <popup>) can be addressed by their XML 207element name (e.g. "popup"). The root element ("/ui") can be omitted in the 208path. 209 210Note that the widget found by following a path that ends in a <menu> element is 211the menuitem to which the menu is attached, not the menu itself. 212 213Also note that the widgets constructed by a ui manager are not tied to the 214lifecycle of the ui manager. If you add the widgets returned by this function to 215some container or explicitly ref them, they will survive the destruction of the 216ui manager. 217 218@table @var 219@item self 220a @code{<gtk-ui-manager>} 221 222@item path 223a path 224 225@item ret 226the widget found by following the path, or @samp{@code{#f}} if no widget was 227found. 228 229@end table 230 231Since 2.4 232 233@end deffn 234 235@deffn Function gtk-ui-manager-get-toplevels (self@tie{}@code{<gtk-ui-manager>}) (types@tie{}@code{<gtk-ui-manager-item-type>}) @result{}@tie{} (ret@tie{}@code{gslist-of}) 236@deffnx Method get-toplevels 237Obtains a list of all toplevel widgets of the requested types. 238 239@table @var 240@item self 241a @code{<gtk-ui-manager>} 242 243@item types 244specifies the types of toplevel widgets to include. Allowed types are 245@code{<gtk-ui-manager-menubar>}, @code{<gtk-ui-manager-toolbar>} and 246@code{<gtk-ui-manager-popup>}. 247 248@item ret 249a newly-allocated of all toplevel widgets of the requested types. 250 251@end table 252 253Since 2.4 254 255@end deffn 256 257@deffn Function gtk-ui-manager-get-action (self@tie{}@code{<gtk-ui-manager>}) (path@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{<gtk-action>}) 258@deffnx Method get-action 259Looks up an action by following a path. See @code{gtk-ui-manager-get-widget} for 260more information about paths. 261 262@table @var 263@item self 264a @code{<gtk-ui-manager>} 265 266@item path 267a path 268 269@item ret 270the action whose proxy widget is found by following the path, or 271@samp{@code{#f}} if no widget was found. 272 273@end table 274 275Since 2.4 276 277@end deffn 278 279@deffn Function gtk-ui-manager-add-ui-from-string (self@tie{}@code{<gtk-ui-manager>}) (buffer@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{unsigned-int}) 280@deffnx Method add-ui-from-string 281Parses a string containing a UI definition and merges it with the current 282contents of @var{self}. An enclosing <ui> element is added if it is missing. 283 284@table @var 285@item self 286a @code{<gtk-ui-manager>} object 287 288@item buffer 289the string to parse 290 291@item length 292the length of @var{buffer} (may be -1 if @var{buffer} is nul-terminated) 293 294@item error 295return location for an error 296 297@item ret 298The merge id for the merged UI. The merge id can be used to unmerge the UI with 299@code{gtk-ui-manager-remove-ui}. If an error occurred, the return value is 0. 300 301@end table 302 303Since 2.4 304 305@end deffn 306 307@deffn Function gtk-ui-manager-add-ui-from-file (self@tie{}@code{<gtk-ui-manager>}) (filename@tie{}@code{mchars}) @result{}@tie{} (ret@tie{}@code{unsigned-int}) 308@deffnx Method add-ui-from-file 309Parses a file containing a UI definition and merges it with the current contents 310of @var{self}. 311 312@table @var 313@item self 314a @code{<gtk-ui-manager>} object 315 316@item filename 317the name of the file to parse 318 319@item error 320return location for an error 321 322@item ret 323The merge id for the merged UI. The merge id can be used to unmerge the UI with 324@code{gtk-ui-manager-remove-ui}. If an error occurred, the return value is 0. 325 326@end table 327 328Since 2.4 329 330@end deffn 331 332@deffn Function gtk-ui-manager-new-merge-id (self@tie{}@code{<gtk-ui-manager>}) @result{}@tie{} (ret@tie{}@code{unsigned-int}) 333@deffnx Method new-merge-id 334Returns an unused merge id, suitable for use with @code{gtk-ui-manager-add-ui}. 335 336@table @var 337@item self 338a @code{<gtk-ui-manager>} 339 340@item ret 341an unused merge id. 342 343@end table 344 345Since 2.4 346 347@end deffn 348 349@deffn Function gtk-ui-manager-add-ui (self@tie{}@code{<gtk-ui-manager>}) (merge_id@tie{}@code{unsigned-int}) (path@tie{}@code{mchars}) (name@tie{}@code{mchars}) (action@tie{}@code{mchars}) (type@tie{}@code{<gtk-ui-manager-item-type>}) (top@tie{}@code{bool}) 350@deffnx Method add-ui 351Adds a UI element to the current contents of @var{self}. 352 353If @var{type} is @samp{GTK_UI_MANAGER_AUTO}, GTK+ inserts a menuitem, toolitem 354or separator if such an element can be inserted at the place determined by 355@var{path}. Otherwise @var{type} must indicate an element that can be inserted 356at the place determined by @var{path}. 357 358If @var{path} points to a menuitem or toolitem, the new element will be inserted 359before or after this item, depending on @var{top}. 360 361@table @var 362@item self 363a @code{<gtk-ui-manager>} 364 365@item merge-id 366the merge id for the merged UI, see @code{gtk-ui-manager-new-merge-id} 367 368@item path 369a path 370 371@item name 372the name for the added UI element 373 374@item action 375the name of the action to be proxied, or @samp{@code{#f}} to add a separator 376 377@item type 378the type of UI element to add. 379 380@item top 381if @samp{@code{#t}}, the UI element is added before its siblings, otherwise it 382is added after its siblings. 383 384@end table 385 386Since 2.4 387 388@end deffn 389 390@deffn Function gtk-ui-manager-remove-ui (self@tie{}@code{<gtk-ui-manager>}) (merge_id@tie{}@code{unsigned-int}) 391@deffnx Method remove-ui 392Unmerges the part of @var{self}s content identified by @var{merge-id}. 393 394@table @var 395@item self 396a @code{<gtk-ui-manager>} object 397 398@item merge-id 399a merge id as returned by @code{gtk-ui-manager-add-ui-from-string} 400 401@end table 402 403Since 2.4 404 405@end deffn 406 407@deffn Function gtk-ui-manager-get-ui (self@tie{}@code{<gtk-ui-manager>}) @result{}@tie{} (ret@tie{}@code{mchars}) 408@deffnx Method get-ui 409Creates a UI definition of the merged UI. 410 411@table @var 412@item self 413a @code{<gtk-ui-manager>} 414 415@item ret 416A newly allocated string containing an XML representation of the merged UI. 417 418@end table 419 420Since 2.4 421 422@end deffn 423 424@deffn Function gtk-ui-manager-ensure-update (self@tie{}@code{<gtk-ui-manager>}) 425@deffnx Method ensure-update 426Makes sure that all pending updates to the UI have been completed. 427 428This may occasionally be necessary, since @code{<gtk-ui-manager>} updates the UI 429in an idle function. A typical example where this function is useful is to 430enforce that the menubar and toolbar have been added to the main window before 431showing it: 432 433@example 434 435gtk_container_add (GTK_CONTAINER (window), vbox); 436g_signal_connect (merge, "add_widget", 437 G_CALLBACK (add_widget), vbox); 438gtk_ui_manager_add_ui_from_file (merge, "my-menus"); 439gtk_ui_manager_add_ui_from_file (merge, "my-toolbars"); 440gtk_ui_manager_ensure_update (merge); 441gtk_widget_show (window); 442@end example 443 444@table @var 445@item self 446a @code{<gtk-ui-manager>} 447 448@end table 449 450Since 2.4 451 452@end deffn 453 454 455@c %end of fragment 456