godock: github.com/sqp/godock/widgets/gtk/menus Index | Files

package menus

import "github.com/sqp/godock/widgets/gtk/menus"

Package menus builds gtk menus.

Index

Package Files

menus.go

type ButtonsEntry Uses

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 Uses

func NewButtonsEntry(text string) *ButtonsEntry

NewButtonsEntry creates a menu entry with buttons management.

func (*ButtonsEntry) AddButton Uses

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

AddButton adds a button to the entry.

type CallNewItem Uses

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 Uses

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 Uses

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

Check defines a check item description.

type Item Uses

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 Uses

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 Uses

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 Uses

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.

Package menus imports 8 packages (graph) and is imported by 2 packages. Updated 2016-08-06. Refresh now. Tools for package owners.