1// Package gio was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package gio
3
4import (
5 "github.com/ebitengine/purego"
6
7 "github.com/bnema/puregotk/pkg/core"
8 "github.com/bnema/puregotk/v4/glib"
9 "github.com/bnema/puregotk/v4/gobject"
10 "github.com/bnema/puregotk/v4/gobject/types"
11)
12
13// `GMenu` is a simple implementation of [class@Gio.MenuModel].
14// You populate a `GMenu` by adding [class@Gio.MenuItem] instances to it.
15//
16// There are some convenience functions to allow you to directly
17// add items (avoiding [class@Gio.MenuItem]) for the common cases. To add
18// a regular item, use [method@Gio.Menu.insert]. To add a section, use
19// [method@Gio.Menu.insert_section]. To add a submenu, use
20// [method@Gio.Menu.insert_submenu].
21type Menu struct {
22 MenuModel
23}
24
25var xMenuGLibType func() types.GType
26
27func MenuGLibType() types.GType {
28 return xMenuGLibType()
29}
30
31func MenuNewFromInternalPtr(ptr uintptr) *Menu {
32 cls := &Menu{}
33 cls.Ptr = ptr
34 return cls
35}
36
37var xNewMenu func() uintptr
38
39// Creates a new #GMenu.
40//
41// The new menu has no items.
42func NewMenu() *Menu {
43 var cls *Menu
44
45 cret := xNewMenu()
46
47 if cret == 0 {
48 return nil
49 }
50 cls = &Menu{}
51 cls.Ptr = cret
52 return cls
53}
54
55var xMenuAppend func(uintptr, uintptr, uintptr)
56
57// Convenience function for appending a normal menu item to the end of
58// @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more
59// flexible alternative.
60func (x *Menu) Append(LabelVar *string, DetailedActionVar *string) {
61
62 LabelVarPtr := core.GStrdupNullable(LabelVar)
63 defer core.GFreeNullable(LabelVarPtr)
64
65 DetailedActionVarPtr := core.GStrdupNullable(DetailedActionVar)
66 defer core.GFreeNullable(DetailedActionVarPtr)
67
68 xMenuAppend(x.GoPointer(), LabelVarPtr, DetailedActionVarPtr)
69
70}
71
72var xMenuAppendItem func(uintptr, uintptr)
73
74// Appends @item to the end of @menu.
75//
76// See g_menu_insert_item() for more information.
77func (x *Menu) AppendItem(ItemVar *MenuItem) {
78
79 xMenuAppendItem(x.GoPointer(), ItemVar.GoPointer())
80
81}
82
83var xMenuAppendSection func(uintptr, uintptr, uintptr)
84
85// Convenience function for appending a section menu item to the end of
86// @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for a
87// more flexible alternative.
88func (x *Menu) AppendSection(LabelVar *string, SectionVar *MenuModel) {
89
90 LabelVarPtr := core.GStrdupNullable(LabelVar)
91 defer core.GFreeNullable(LabelVarPtr)
92
93 xMenuAppendSection(x.GoPointer(), LabelVarPtr, SectionVar.GoPointer())
94
95}
96
97var xMenuAppendSubmenu func(uintptr, uintptr, uintptr)
98
99// Convenience function for appending a submenu menu item to the end of
100// @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for a
101// more flexible alternative.
102func (x *Menu) AppendSubmenu(LabelVar *string, SubmenuVar *MenuModel) {
103
104 LabelVarPtr := core.GStrdupNullable(LabelVar)
105 defer core.GFreeNullable(LabelVarPtr)
106
107 xMenuAppendSubmenu(x.GoPointer(), LabelVarPtr, SubmenuVar.GoPointer())
108
109}
110
111var xMenuFreeze func(uintptr)
112
113// Marks @menu as frozen.
114//
115// After the menu is frozen, it is an error to attempt to make any
116// changes to it. In effect this means that the #GMenu API must no
117// longer be used.
118//
119// This function causes g_menu_model_is_mutable() to begin returning
120// %FALSE, which has some positive performance implications.
121func (x *Menu) Freeze() {
122
123 xMenuFreeze(x.GoPointer())
124
125}
126
127var xMenuInsert func(uintptr, int, uintptr, uintptr)
128
129// Convenience function for inserting a normal menu item into @menu.
130// Combine g_menu_item_new() and g_menu_insert_item() for a more flexible
131// alternative.
132func (x *Menu) Insert(PositionVar int, LabelVar *string, DetailedActionVar *string) {
133
134 LabelVarPtr := core.GStrdupNullable(LabelVar)
135 defer core.GFreeNullable(LabelVarPtr)
136
137 DetailedActionVarPtr := core.GStrdupNullable(DetailedActionVar)
138 defer core.GFreeNullable(DetailedActionVarPtr)
139
140 xMenuInsert(x.GoPointer(), PositionVar, LabelVarPtr, DetailedActionVarPtr)
141
142}
143
144var xMenuInsertItem func(uintptr, int, uintptr)
145
146// Inserts @item into @menu.
147//
148// The "insertion" is actually done by copying all of the attribute and
149// link values of @item and using them to form a new item within @menu.
150// As such, @item itself is not really inserted, but rather, a menu item
151// that is exactly the same as the one presently described by @item.
152//
153// This means that @item is essentially useless after the insertion
154// occurs. Any changes you make to it are ignored unless it is inserted
155// again (at which point its updated values will be copied).
156//
157// You should probably just free @item once you're done.
158//
159// There are many convenience functions to take care of common cases.
160// See g_menu_insert(), g_menu_insert_section() and
161// g_menu_insert_submenu() as well as "prepend" and "append" variants of
162// each of these functions.
163func (x *Menu) InsertItem(PositionVar int, ItemVar *MenuItem) {
164
165 xMenuInsertItem(x.GoPointer(), PositionVar, ItemVar.GoPointer())
166
167}
168
169var xMenuInsertSection func(uintptr, int, uintptr, uintptr)
170
171// Convenience function for inserting a section menu item into @menu.
172// Combine g_menu_item_new_section() and g_menu_insert_item() for a more
173// flexible alternative.
174func (x *Menu) InsertSection(PositionVar int, LabelVar *string, SectionVar *MenuModel) {
175
176 LabelVarPtr := core.GStrdupNullable(LabelVar)
177 defer core.GFreeNullable(LabelVarPtr)
178
179 xMenuInsertSection(x.GoPointer(), PositionVar, LabelVarPtr, SectionVar.GoPointer())
180
181}
182
183var xMenuInsertSubmenu func(uintptr, int, uintptr, uintptr)
184
185// Convenience function for inserting a submenu menu item into @menu.
186// Combine g_menu_item_new_submenu() and g_menu_insert_item() for a more
187// flexible alternative.
188func (x *Menu) InsertSubmenu(PositionVar int, LabelVar *string, SubmenuVar *MenuModel) {
189
190 LabelVarPtr := core.GStrdupNullable(LabelVar)
191 defer core.GFreeNullable(LabelVarPtr)
192
193 xMenuInsertSubmenu(x.GoPointer(), PositionVar, LabelVarPtr, SubmenuVar.GoPointer())
194
195}
196
197var xMenuPrepend func(uintptr, uintptr, uintptr)
198
199// Convenience function for prepending a normal menu item to the start
200// of @menu. Combine g_menu_item_new() and g_menu_insert_item() for a more
201// flexible alternative.
202func (x *Menu) Prepend(LabelVar *string, DetailedActionVar *string) {
203
204 LabelVarPtr := core.GStrdupNullable(LabelVar)
205 defer core.GFreeNullable(LabelVarPtr)
206
207 DetailedActionVarPtr := core.GStrdupNullable(DetailedActionVar)
208 defer core.GFreeNullable(DetailedActionVarPtr)
209
210 xMenuPrepend(x.GoPointer(), LabelVarPtr, DetailedActionVarPtr)
211
212}
213
214var xMenuPrependItem func(uintptr, uintptr)
215
216// Prepends @item to the start of @menu.
217//
218// See g_menu_insert_item() for more information.
219func (x *Menu) PrependItem(ItemVar *MenuItem) {
220
221 xMenuPrependItem(x.GoPointer(), ItemVar.GoPointer())
222
223}
224
225var xMenuPrependSection func(uintptr, uintptr, uintptr)
226
227// Convenience function for prepending a section menu item to the start
228// of @menu. Combine g_menu_item_new_section() and g_menu_insert_item() for
229// a more flexible alternative.
230func (x *Menu) PrependSection(LabelVar *string, SectionVar *MenuModel) {
231
232 LabelVarPtr := core.GStrdupNullable(LabelVar)
233 defer core.GFreeNullable(LabelVarPtr)
234
235 xMenuPrependSection(x.GoPointer(), LabelVarPtr, SectionVar.GoPointer())
236
237}
238
239var xMenuPrependSubmenu func(uintptr, uintptr, uintptr)
240
241// Convenience function for prepending a submenu menu item to the start
242// of @menu. Combine g_menu_item_new_submenu() and g_menu_insert_item() for
243// a more flexible alternative.
244func (x *Menu) PrependSubmenu(LabelVar *string, SubmenuVar *MenuModel) {
245
246 LabelVarPtr := core.GStrdupNullable(LabelVar)
247 defer core.GFreeNullable(LabelVarPtr)
248
249 xMenuPrependSubmenu(x.GoPointer(), LabelVarPtr, SubmenuVar.GoPointer())
250
251}
252
253var xMenuRemove func(uintptr, int)
254
255// Removes an item from the menu.
256//
257// @position gives the index of the item to remove.
258//
259// It is an error if position is not in range the range from 0 to one
260// less than the number of items in the menu.
261//
262// It is not possible to remove items by identity since items are added
263// to the menu simply by copying their links and attributes (ie:
264// identity of the item itself is not preserved).
265func (x *Menu) Remove(PositionVar int) {
266
267 xMenuRemove(x.GoPointer(), PositionVar)
268
269}
270
271var xMenuRemoveAll func(uintptr)
272
273// Removes all items in the menu.
274func (x *Menu) RemoveAll() {
275
276 xMenuRemoveAll(x.GoPointer())
277
278}
279
280func (c *Menu) GoPointer() uintptr {
281 if c == nil {
282 return 0
283 }
284 return c.Ptr
285}
286
287func (c *Menu) SetGoPointer(ptr uintptr) {
288 c.Ptr = ptr
289}
290
291// #GMenuItem is an opaque structure type. You must access it using the
292// functions below.
293type MenuItem struct {
294 gobject.Object
295}
296
297var xMenuItemGLibType func() types.GType
298
299func MenuItemGLibType() types.GType {
300 return xMenuItemGLibType()
301}
302
303func MenuItemNewFromInternalPtr(ptr uintptr) *MenuItem {
304 cls := &MenuItem{}
305 cls.Ptr = ptr
306 return cls
307}
308
309var xNewMenuItem func(uintptr, uintptr) uintptr
310
311// Creates a new #GMenuItem.
312//
313// If @label is non-%NULL it is used to set the "label" attribute of the
314// new item.
315//
316// If @detailed_action is non-%NULL it is used to set the "action" and
317// possibly the "target" attribute of the new item. See
318// g_menu_item_set_detailed_action() for more information.
319func NewMenuItem(LabelVar *string, DetailedActionVar *string) *MenuItem {
320 var cls *MenuItem
321
322 LabelVarPtr := core.GStrdupNullable(LabelVar)
323 defer core.GFreeNullable(LabelVarPtr)
324
325 DetailedActionVarPtr := core.GStrdupNullable(DetailedActionVar)
326 defer core.GFreeNullable(DetailedActionVarPtr)
327
328 cret := xNewMenuItem(LabelVarPtr, DetailedActionVarPtr)
329
330 if cret == 0 {
331 return nil
332 }
333 cls = &MenuItem{}
334 cls.Ptr = cret
335 return cls
336}
337
338var xNewMenuItemFromModel func(uintptr, int) uintptr
339
340// Creates a #GMenuItem as an exact copy of an existing menu item in a
341// #GMenuModel.
342//
343// @item_index must be valid (ie: be sure to call
344// g_menu_model_get_n_items() first).
345func NewMenuItemFromModel(ModelVar *MenuModel, ItemIndexVar int) *MenuItem {
346 var cls *MenuItem
347
348 cret := xNewMenuItemFromModel(ModelVar.GoPointer(), ItemIndexVar)
349
350 if cret == 0 {
351 return nil
352 }
353 cls = &MenuItem{}
354 cls.Ptr = cret
355 return cls
356}
357
358var xNewMenuItemSection func(uintptr, uintptr) uintptr
359
360// Creates a new #GMenuItem representing a section.
361//
362// This is a convenience API around g_menu_item_new() and
363// g_menu_item_set_section().
364//
365// The effect of having one menu appear as a section of another is
366// exactly as it sounds: the items from @section become a direct part of
367// the menu that @menu_item is added to.
368//
369// Visual separation is typically displayed between two non-empty
370// sections. If @label is non-%NULL then it will be incorporated into
371// this visual indication. This allows for labeled subsections of a
372// menu.
373//
374// As a simple example, consider a typical "Edit" menu from a simple
375// program. It probably contains an "Undo" and "Redo" item, followed by
376// a separator, followed by "Cut", "Copy" and "Paste".
377//
378// This would be accomplished by creating three #GMenu instances. The
379// first would be populated with the "Undo" and "Redo" items, and the
380// second with the "Cut", "Copy" and "Paste" items. The first and
381// second menus would then be added as submenus of the third. In XML
382// format, this would look something like the following:
383// |[
384// <menu id='edit-menu'>
385//
386// <section>
387// <item label='Undo'/>
388// <item label='Redo'/>
389// </section>
390// <section>
391// <item label='Cut'/>
392// <item label='Copy'/>
393// <item label='Paste'/>
394// </section>
395//
396// </menu>
397// ]|
398//
399// The following example is exactly equivalent. It is more illustrative
400// of the exact relationship between the menus and items (keeping in
401// mind that the 'link' element defines a new menu that is linked to the
402// containing one). The style of the second example is more verbose and
403// difficult to read (and therefore not recommended except for the
404// purpose of understanding what is really going on).
405// |[
406// <menu id='edit-menu'>
407//
408// <item>
409// <link name='section'>
410// <item label='Undo'/>
411// <item label='Redo'/>
412// </link>
413// </item>
414// <item>
415// <link name='section'>
416// <item label='Cut'/>
417// <item label='Copy'/>
418// <item label='Paste'/>
419// </link>
420// </item>
421//
422// </menu>
423// ]|
424func NewMenuItemSection(LabelVar *string, SectionVar *MenuModel) *MenuItem {
425 var cls *MenuItem
426
427 LabelVarPtr := core.GStrdupNullable(LabelVar)
428 defer core.GFreeNullable(LabelVarPtr)
429
430 cret := xNewMenuItemSection(LabelVarPtr, SectionVar.GoPointer())
431
432 if cret == 0 {
433 return nil
434 }
435 cls = &MenuItem{}
436 cls.Ptr = cret
437 return cls
438}
439
440var xNewMenuItemSubmenu func(uintptr, uintptr) uintptr
441
442// Creates a new #GMenuItem representing a submenu.
443//
444// This is a convenience API around g_menu_item_new() and
445// g_menu_item_set_submenu().
446func NewMenuItemSubmenu(LabelVar *string, SubmenuVar *MenuModel) *MenuItem {
447 var cls *MenuItem
448
449 LabelVarPtr := core.GStrdupNullable(LabelVar)
450 defer core.GFreeNullable(LabelVarPtr)
451
452 cret := xNewMenuItemSubmenu(LabelVarPtr, SubmenuVar.GoPointer())
453
454 if cret == 0 {
455 return nil
456 }
457 cls = &MenuItem{}
458 cls.Ptr = cret
459 return cls
460}
461
462var xMenuItemGetAttribute func(uintptr, string, string, ...interface{}) bool
463
464// Queries the named @attribute on @menu_item.
465//
466// If the attribute exists and matches the #GVariantType corresponding
467// to @format_string then @format_string is used to deconstruct the
468// value into the positional parameters and %TRUE is returned.
469//
470// If the attribute does not exist, or it does exist but has the wrong
471// type, then the positional parameters are ignored and %FALSE is
472// returned.
473func (x *MenuItem) GetAttribute(AttributeVar string, FormatStringVar string, varArgs ...interface{}) bool {
474
475 cret := xMenuItemGetAttribute(x.GoPointer(), AttributeVar, FormatStringVar, varArgs...)
476 return cret
477}
478
479var xMenuItemGetAttributeValue func(uintptr, string, *glib.VariantType) *glib.Variant
480
481// Queries the named @attribute on @menu_item.
482//
483// If @expected_type is specified and the attribute does not have this
484// type, %NULL is returned. %NULL is also returned if the attribute
485// simply does not exist.
486func (x *MenuItem) GetAttributeValue(AttributeVar string, ExpectedTypeVar *glib.VariantType) *glib.Variant {
487
488 cret := xMenuItemGetAttributeValue(x.GoPointer(), AttributeVar, ExpectedTypeVar)
489 return cret
490}
491
492var xMenuItemGetLink func(uintptr, string) uintptr
493
494// Queries the named @link on @menu_item.
495func (x *MenuItem) GetLink(LinkVar string) *MenuModel {
496 var cls *MenuModel
497
498 cret := xMenuItemGetLink(x.GoPointer(), LinkVar)
499
500 if cret == 0 {
501 return nil
502 }
503 cls = &MenuModel{}
504 cls.Ptr = cret
505 return cls
506}
507
508var xMenuItemSetActionAndTarget func(uintptr, uintptr, uintptr, ...interface{})
509
510// Sets or unsets the "action" and "target" attributes of @menu_item.
511//
512// If @action is %NULL then both the "action" and "target" attributes
513// are unset (and @format_string is ignored along with the positional
514// parameters).
515//
516// If @action is non-%NULL then the "action" attribute is set.
517// @format_string is then inspected. If it is non-%NULL then the proper
518// position parameters are collected to create a #GVariant instance to
519// use as the target value. If it is %NULL then the positional
520// parameters are ignored and the "target" attribute is unset.
521//
522// See also g_menu_item_set_action_and_target_value() for an equivalent
523// call that directly accepts a #GVariant. See
524// g_menu_item_set_detailed_action() for a more convenient version that
525// works with string-typed targets.
526//
527// See also g_menu_item_set_action_and_target_value() for a
528// description of the semantics of the action and target attributes.
529func (x *MenuItem) SetActionAndTarget(ActionVar *string, FormatStringVar *string, varArgs ...interface{}) {
530
531 ActionVarPtr := core.GStrdupNullable(ActionVar)
532 defer core.GFreeNullable(ActionVarPtr)
533
534 FormatStringVarPtr := core.GStrdupNullable(FormatStringVar)
535 defer core.GFreeNullable(FormatStringVarPtr)
536
537 xMenuItemSetActionAndTarget(x.GoPointer(), ActionVarPtr, FormatStringVarPtr, varArgs...)
538
539}
540
541var xMenuItemSetActionAndTargetValue func(uintptr, uintptr, *glib.Variant)
542
543// Sets or unsets the "action" and "target" attributes of @menu_item.
544//
545// If @action is %NULL then both the "action" and "target" attributes
546// are unset (and @target_value is ignored).
547//
548// If @action is non-%NULL then the "action" attribute is set. The
549// "target" attribute is then set to the value of @target_value if it is
550// non-%NULL or unset otherwise.
551//
552// Normal menu items (ie: not submenu, section or other custom item
553// types) are expected to have the "action" attribute set to identify
554// the action that they are associated with. The state type of the
555// action help to determine the disposition of the menu item. See
556// #GAction and #GActionGroup for an overview of actions.
557//
558// In general, clicking on the menu item will result in activation of
559// the named action with the "target" attribute given as the parameter
560// to the action invocation. If the "target" attribute is not set then
561// the action is invoked with no parameter.
562//
563// If the action has no state then the menu item is usually drawn as a
564// plain menu item (ie: with no additional decoration).
565//
566// If the action has a boolean state then the menu item is usually drawn
567// as a toggle menu item (ie: with a checkmark or equivalent
568// indication). The item should be marked as 'toggled' or 'checked'
569// when the boolean state is %TRUE.
570//
571// If the action has a string state then the menu item is usually drawn
572// as a radio menu item (ie: with a radio bullet or equivalent
573// indication). The item should be marked as 'selected' when the string
574// state is equal to the value of the @target property.
575//
576// See g_menu_item_set_action_and_target() or
577// g_menu_item_set_detailed_action() for two equivalent calls that are
578// probably more convenient for most uses.
579func (x *MenuItem) SetActionAndTargetValue(ActionVar *string, TargetValueVar *glib.Variant) {
580
581 ActionVarPtr := core.GStrdupNullable(ActionVar)
582 defer core.GFreeNullable(ActionVarPtr)
583
584 xMenuItemSetActionAndTargetValue(x.GoPointer(), ActionVarPtr, TargetValueVar)
585
586}
587
588var xMenuItemSetAttribute func(uintptr, string, uintptr, ...interface{})
589
590// Sets or unsets an attribute on @menu_item.
591//
592// The attribute to set or unset is specified by @attribute. This
593// can be one of the standard attribute names %G_MENU_ATTRIBUTE_LABEL,
594// %G_MENU_ATTRIBUTE_ACTION, %G_MENU_ATTRIBUTE_TARGET, or a custom
595// attribute name.
596// Attribute names are restricted to lowercase characters, numbers
597// and '-'. Furthermore, the names must begin with a lowercase character,
598// must not end with a '-', and must not contain consecutive dashes.
599//
600// If @format_string is non-%NULL then the proper position parameters
601// are collected to create a #GVariant instance to use as the attribute
602// value. If it is %NULL then the positional parameterrs are ignored
603// and the named attribute is unset.
604//
605// See also g_menu_item_set_attribute_value() for an equivalent call
606// that directly accepts a #GVariant.
607func (x *MenuItem) SetAttribute(AttributeVar string, FormatStringVar *string, varArgs ...interface{}) {
608
609 FormatStringVarPtr := core.GStrdupNullable(FormatStringVar)
610 defer core.GFreeNullable(FormatStringVarPtr)
611
612 xMenuItemSetAttribute(x.GoPointer(), AttributeVar, FormatStringVarPtr, varArgs...)
613
614}
615
616var xMenuItemSetAttributeValue func(uintptr, string, *glib.Variant)
617
618// Sets or unsets an attribute on @menu_item.
619//
620// The attribute to set or unset is specified by @attribute. This
621// can be one of the standard attribute names %G_MENU_ATTRIBUTE_LABEL,
622// %G_MENU_ATTRIBUTE_ACTION, %G_MENU_ATTRIBUTE_TARGET, or a custom
623// attribute name.
624// Attribute names are restricted to lowercase characters, numbers
625// and '-'. Furthermore, the names must begin with a lowercase character,
626// must not end with a '-', and must not contain consecutive dashes.
627//
628// must consist only of lowercase
629// ASCII characters, digits and '-'.
630//
631// If @value is non-%NULL then it is used as the new value for the
632// attribute. If @value is %NULL then the attribute is unset. If
633// the @value #GVariant is floating, it is consumed.
634//
635// See also g_menu_item_set_attribute() for a more convenient way to do
636// the same.
637func (x *MenuItem) SetAttributeValue(AttributeVar string, ValueVar *glib.Variant) {
638
639 xMenuItemSetAttributeValue(x.GoPointer(), AttributeVar, ValueVar)
640
641}
642
643var xMenuItemSetDetailedAction func(uintptr, string)
644
645// Sets the "action" and possibly the "target" attribute of @menu_item.
646//
647// The format of @detailed_action is the same format parsed by
648// g_action_parse_detailed_name().
649//
650// See g_menu_item_set_action_and_target() or
651// g_menu_item_set_action_and_target_value() for more flexible (but
652// slightly less convenient) alternatives.
653//
654// See also g_menu_item_set_action_and_target_value() for a description of
655// the semantics of the action and target attributes.
656func (x *MenuItem) SetDetailedAction(DetailedActionVar string) {
657
658 xMenuItemSetDetailedAction(x.GoPointer(), DetailedActionVar)
659
660}
661
662var xMenuItemSetIcon func(uintptr, uintptr)
663
664// Sets (or unsets) the icon on @menu_item.
665//
666// This call is the same as calling g_icon_serialize() and using the
667// result as the value to g_menu_item_set_attribute_value() for
668// %G_MENU_ATTRIBUTE_ICON.
669//
670// This API is only intended for use with "noun" menu items; things like
671// bookmarks or applications in an "Open With" menu. Don't use it on
672// menu items corresponding to verbs (eg: stock icons for 'Save' or
673// 'Quit').
674//
675// If @icon is %NULL then the icon is unset.
676func (x *MenuItem) SetIcon(IconVar Icon) {
677
678 xMenuItemSetIcon(x.GoPointer(), IconVar.GoPointer())
679
680}
681
682var xMenuItemSetLabel func(uintptr, uintptr)
683
684// Sets or unsets the "label" attribute of @menu_item.
685//
686// If @label is non-%NULL it is used as the label for the menu item. If
687// it is %NULL then the label attribute is unset.
688func (x *MenuItem) SetLabel(LabelVar *string) {
689
690 LabelVarPtr := core.GStrdupNullable(LabelVar)
691 defer core.GFreeNullable(LabelVarPtr)
692
693 xMenuItemSetLabel(x.GoPointer(), LabelVarPtr)
694
695}
696
697var xMenuItemSetLink func(uintptr, string, uintptr)
698
699// Creates a link from @menu_item to @model if non-%NULL, or unsets it.
700//
701// Links are used to establish a relationship between a particular menu
702// item and another menu. For example, %G_MENU_LINK_SUBMENU is used to
703// associate a submenu with a particular menu item, and %G_MENU_LINK_SECTION
704// is used to create a section. Other types of link can be used, but there
705// is no guarantee that clients will be able to make sense of them.
706// Link types are restricted to lowercase characters, numbers
707// and '-'. Furthermore, the names must begin with a lowercase character,
708// must not end with a '-', and must not contain consecutive dashes.
709func (x *MenuItem) SetLink(LinkVar string, ModelVar *MenuModel) {
710
711 xMenuItemSetLink(x.GoPointer(), LinkVar, ModelVar.GoPointer())
712
713}
714
715var xMenuItemSetSection func(uintptr, uintptr)
716
717// Sets or unsets the "section" link of @menu_item to @section.
718//
719// The effect of having one menu appear as a section of another is
720// exactly as it sounds: the items from @section become a direct part of
721// the menu that @menu_item is added to. See g_menu_item_new_section()
722// for more information about what it means for a menu item to be a
723// section.
724func (x *MenuItem) SetSection(SectionVar *MenuModel) {
725
726 xMenuItemSetSection(x.GoPointer(), SectionVar.GoPointer())
727
728}
729
730var xMenuItemSetSubmenu func(uintptr, uintptr)
731
732// Sets or unsets the "submenu" link of @menu_item to @submenu.
733//
734// If @submenu is non-%NULL, it is linked to. If it is %NULL then the
735// link is unset.
736//
737// The effect of having one menu appear as a submenu of another is
738// exactly as it sounds.
739func (x *MenuItem) SetSubmenu(SubmenuVar *MenuModel) {
740
741 xMenuItemSetSubmenu(x.GoPointer(), SubmenuVar.GoPointer())
742
743}
744
745func (c *MenuItem) GoPointer() uintptr {
746 if c == nil {
747 return 0
748 }
749 return c.Ptr
750}
751
752func (c *MenuItem) SetGoPointer(ptr uintptr) {
753 c.Ptr = ptr
754}
755
756func init() {
757 core.SetPackageName("GIO", "gio-2.0")
758 core.SetSharedLibraries("GIO", []string{"libgio-2.0.so.0"})
759 var libs []uintptr
760 for _, libPath := range core.GetPaths("GIO") {
761 lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
762 if err != nil {
763 panic(err)
764 }
765 libs = append(libs, lib)
766 }
767
768 core.PuregoSafeRegister(&xMenuGLibType, libs, "g_menu_get_type")
769
770 core.PuregoSafeRegister(&xNewMenu, libs, "g_menu_new")
771
772 core.PuregoSafeRegister(&xMenuAppend, libs, "g_menu_append")
773 core.PuregoSafeRegister(&xMenuAppendItem, libs, "g_menu_append_item")
774 core.PuregoSafeRegister(&xMenuAppendSection, libs, "g_menu_append_section")
775 core.PuregoSafeRegister(&xMenuAppendSubmenu, libs, "g_menu_append_submenu")
776 core.PuregoSafeRegister(&xMenuFreeze, libs, "g_menu_freeze")
777 core.PuregoSafeRegister(&xMenuInsert, libs, "g_menu_insert")
778 core.PuregoSafeRegister(&xMenuInsertItem, libs, "g_menu_insert_item")
779 core.PuregoSafeRegister(&xMenuInsertSection, libs, "g_menu_insert_section")
780 core.PuregoSafeRegister(&xMenuInsertSubmenu, libs, "g_menu_insert_submenu")
781 core.PuregoSafeRegister(&xMenuPrepend, libs, "g_menu_prepend")
782 core.PuregoSafeRegister(&xMenuPrependItem, libs, "g_menu_prepend_item")
783 core.PuregoSafeRegister(&xMenuPrependSection, libs, "g_menu_prepend_section")
784 core.PuregoSafeRegister(&xMenuPrependSubmenu, libs, "g_menu_prepend_submenu")
785 core.PuregoSafeRegister(&xMenuRemove, libs, "g_menu_remove")
786 core.PuregoSafeRegister(&xMenuRemoveAll, libs, "g_menu_remove_all")
787
788 core.PuregoSafeRegister(&xMenuItemGLibType, libs, "g_menu_item_get_type")
789
790 core.PuregoSafeRegister(&xNewMenuItem, libs, "g_menu_item_new")
791 core.PuregoSafeRegister(&xNewMenuItemFromModel, libs, "g_menu_item_new_from_model")
792 core.PuregoSafeRegister(&xNewMenuItemSection, libs, "g_menu_item_new_section")
793 core.PuregoSafeRegister(&xNewMenuItemSubmenu, libs, "g_menu_item_new_submenu")
794
795 core.PuregoSafeRegister(&xMenuItemGetAttribute, libs, "g_menu_item_get_attribute")
796 core.PuregoSafeRegister(&xMenuItemGetAttributeValue, libs, "g_menu_item_get_attribute_value")
797 core.PuregoSafeRegister(&xMenuItemGetLink, libs, "g_menu_item_get_link")
798 core.PuregoSafeRegister(&xMenuItemSetActionAndTarget, libs, "g_menu_item_set_action_and_target")
799 core.PuregoSafeRegister(&xMenuItemSetActionAndTargetValue, libs, "g_menu_item_set_action_and_target_value")
800 core.PuregoSafeRegister(&xMenuItemSetAttribute, libs, "g_menu_item_set_attribute")
801 core.PuregoSafeRegister(&xMenuItemSetAttributeValue, libs, "g_menu_item_set_attribute_value")
802 core.PuregoSafeRegister(&xMenuItemSetDetailedAction, libs, "g_menu_item_set_detailed_action")
803 core.PuregoSafeRegister(&xMenuItemSetIcon, libs, "g_menu_item_set_icon")
804 core.PuregoSafeRegister(&xMenuItemSetLabel, libs, "g_menu_item_set_label")
805 core.PuregoSafeRegister(&xMenuItemSetLink, libs, "g_menu_item_set_link")
806 core.PuregoSafeRegister(&xMenuItemSetSection, libs, "g_menu_item_set_section")
807 core.PuregoSafeRegister(&xMenuItemSetSubmenu, libs, "g_menu_item_set_submenu")
808
809}