menus

package
v0.0.0-...-0caaa62 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2017 License: GPL-3.0-or-later Imports: 8 Imported by: 0

Documentation

Overview

Package menus builds gtk menus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ButtonsEntry

type ButtonsEntry struct {
	gtk.MenuItem // extends MenuItem, the main widget.
	// contains filtered or unexported fields
}

ButtonsEntry defines a menu entry with buttons inside.

func NewButtonsEntry

func NewButtonsEntry(text string) *ButtonsEntry

NewButtonsEntry creates a menu entry with buttons management.

func (*ButtonsEntry) AddButton

func (o *ButtonsEntry) AddButton(tooltip, img string, call interface{}) *gtk.Button

AddButton adds a button to the entry.

type CallNewItem

type CallNewItem func(menu *gtk.Menu, label, iconPath string) *gtk.MenuItem

CallNewItem defines a func that creates a menu item and packs it to the menu.

type CallNewSubMenu

type CallNewSubMenu func(menu *gtk.Menu, label, iconPath string) (*gtk.Menu, *gtk.MenuItem)

CallNewSubMenu defines a func that creates a submenu and packs it to the menu.

type Check

type Check struct {
	Title  string
	Call   interface{}
	Active bool
}

Check defines a check item description.

type Item

type Item struct {
	Title string
	Call  interface{}
}

Item defines a simple entry description with Title and an optional argument.

Call can be of type:

nil              visible but disabled option (can't be clicked).
func()           callback to connect to the activate event.
[]interface{}    list of items for a submenu. Recursive call so the same options are allowed.

func NewItem

func NewItem(title string, call interface{}) Item

NewItem creates a menu item description.

type Menu struct {
	gtk.Menu
	// contains filtered or unexported fields
}

Menu builds gtk menus. Can be loaded manually or using MenuNewAttached.

func NewMenu

func NewMenu(items ...interface{}) *Menu

NewMenu creates a gtk menu builder.

Warning, don't forget to use ShowAll when you add entries manually.

func WrapMenu

func WrapMenu(menu *gtk.Menu) *Menu

WrapMenu wraps a gtk menu as a menu builder.

func (menu *Menu) AddButtonsEntry(label string) *ButtonsEntry

AddButtonsEntry adds a button entry to the menu.

func (menu *Menu) AddCheckEntry(label string, active bool, call interface{}, userData ...interface{}) (item *gtk.CheckMenuItem)

AddCheckEntry adds a check entry to the menu.

func (menu *Menu) AddEntry(label, iconPath string, call interface{}, userData ...interface{}) *gtk.MenuItem

AddEntry adds an item to the menu with its callback.

func (menu *Menu) AddList(items ...interface{})

AddList adds a list of custom entries to the menu.

items can be of type:

nil : a separator.
Check : a checkable entry.
Item : a simple entry with Title and an optional argument.
func (menu *Menu) AddRadioEntry(label string, active bool, groupID int, call interface{}, userData ...interface{}) (item *gtk.RadioMenuItem)

AddRadioEntry adds a radio entry to the menu.

func (menu *Menu) AddSeparator()

AddSeparator adds a separator to the menu.

func (menu *Menu) AddSubMenu(title, iconPath string) *Menu

AddSubMenu adds a submenu to the menu.

func (menu *Menu) AddSubMenuWrapped(title string, gtkmenu *gtk.Menu)

AddSubMenuWrapped adds the provided gtk menu as submenu.

func (menu *Menu) SetCallNewItem(call CallNewItem)

SetCallNewItem overrides the menu item creation and packing method.

func (menu *Menu) SetCallNewSubMenu(call CallNewSubMenu)

SetCallNewSubMenu overrides the submenu creation and packing method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL