Documentation
¶
Index ¶
- type ChildCommand
- type Item
- type Menu
- func (menu *Menu) AddCheckItem(commandID uint, label string)
- func (menu *Menu) AddItem(commandID uint, label string)
- func (menu *Menu) AddRadioItem(commandID uint, label string, groupID uint)
- func (menu *Menu) AddSeparator()
- func (menu *Menu) AddSubmenu(commandID uint, label string, child *Menu)
- func (menu *Menu) AttachToWindow(w *window.Window)
- func (menu *Menu) Call(command *Command)
- func (menu *Menu) CallWhenChildStable(command *Command, child *Menu)
- func (menu *Menu) CallWhenDisplayed(command *Command)
- func (menu *Menu) CallWhenReady(command *Command)
- func (menu *Menu) CallWhenTreeStable(command *Command)
- func (menu *Menu) Create(sendChannel *connection.In)
- func (menu *Menu) DispatchResponse(reply CommandResponse)
- func (menu *Menu) HandleError(reply CommandResponse)
- func (menu *Menu) HandleEvent(reply CommandResponse)
- func (menu *Menu) HandleReply(reply CommandResponse)
- func (menu *Menu) IsStable() bool
- func (menu *Menu) IsTarget(targetId uint) bool
- func (menu *Menu) IsTreeStable() bool
- func (menu *Menu) ItemAtCommandID(commandID uint) *MenuItem
- func (menu Menu) PrintRecursiveWaitingResponses()
- func (menu *Menu) RadioGroupAtGroupID(groupID uint) []*MenuItem
- func (menu *Menu) RegisterEventHandlerByCommandID(commandID uint, handler func(reply CommandResponse, item *MenuItem))
- func (menu *Menu) Send(command *Command)
- func (menu *Menu) SendThread()
- func (menu *Menu) SetApplicationMenu()
- func (menu *Menu) SetChecked(commandID uint, checked bool)
- func (menu *Menu) SetEnabled(commandID uint, enabled bool)
- func (menu *Menu) SetSendChannel(sendChannel *connection.In)
- func (menu *Menu) SetVisible(commandID uint, visible bool)
- func (menu *Menu) ToggleRadio(commandID, groupID uint, checked bool)
- type MenuItem
- type MenuSync
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChildCommand ¶
type Menu ¶
type Menu struct { TargetID uint `json:"target_id,omitempty"` WaitingResponses []*Command `json:"awaiting_responses,omitempty"` CommandQueue []*Command `json:"command_queue,omitempty"` Ready bool `json:"ready"` Displayed bool `json:"displayed"` Parent *Menu `json:"-"` Children []*Menu `json:"-"` Items []*MenuItem `json:"items,omitempty"` EventRegistry []uint `json:"events,omitempty"` SendChannel *connection.In `json:"-"` Sync MenuSync `jons:"-"` ReplyHandlers map[uint]func(reply CommandResponse, item *MenuItem) `json:"_"` }
func (*Menu) AddCheckItem ¶
Add a CheckItem to both the internal representation of menu and the external representation of menu
func (*Menu) AddItem ¶
Add a MenuItem to both the internal representation of menu and the external representation of menu
func (*Menu) AddRadioItem ¶
Add a RadioItem to both the internal representation of menu and the external representation of menu
func (*Menu) AddSeparator ¶
func (menu *Menu) AddSeparator()
Add a Seperator to both the internal representation of menu and the external representation of menu
func (*Menu) AddSubmenu ¶
Add a SubMenu to both the internal representation of menu and the external representation of menu
func (*Menu) AttachToWindow ¶
On Linux and Windows systems, Attach the menu to a window
func (*Menu) CallWhenChildStable ¶
func (*Menu) CallWhenDisplayed ¶
func (menu *Menu) CallWhenDisplayed(command *Command)
func (*Menu) CallWhenReady ¶
func (menu *Menu) CallWhenReady(command *Command)
func (*Menu) CallWhenTreeStable ¶
func (menu *Menu) CallWhenTreeStable(command *Command)
func (*Menu) Create ¶
func (menu *Menu) Create(sendChannel *connection.In)
func (*Menu) DispatchResponse ¶
func (menu *Menu) DispatchResponse(reply CommandResponse)
func (*Menu) HandleError ¶
func (menu *Menu) HandleError(reply CommandResponse)
func (*Menu) HandleEvent ¶
func (menu *Menu) HandleEvent(reply CommandResponse)
func (*Menu) HandleReply ¶
func (menu *Menu) HandleReply(reply CommandResponse)
func (*Menu) IsStable ¶
A menu is stable if and only if, it is Ready (meaning it was created successfully) and it has no Commands awaiting Responses.
func (*Menu) IsTreeStable ¶
A Menu Tree is considered stable if and only if its children nodes report that they are stable. Function is recursive, so factor that in to performance
func (*Menu) ItemAtCommandID ¶
Recursively searches the Menu Tree for an item with the commandID Returns the first found match. A proper menu should not reuse commandID's
func (Menu) PrintRecursiveWaitingResponses ¶
func (menu Menu) PrintRecursiveWaitingResponses()
DEBUG Functions
func (*Menu) RadioGroupAtGroupID ¶
Find all menu items that belong to group identified by groupID Not recursive, as a group should be identified at the same level. Since it is not recursive you can theoretically reuse a groupID but problems could creep up elsewhere, so please use unique groupID for radio items
func (*Menu) RegisterEventHandlerByCommandID ¶
func (*Menu) SendThread ¶
func (menu *Menu) SendThread()
func (*Menu) SetApplicationMenu ¶
func (menu *Menu) SetApplicationMenu()
On Darwin systems, Set the application menu in the UI
func (*Menu) SetChecked ¶
Checks or Unchecks a CheckItem in the UI
func (*Menu) SetEnabled ¶
Enables or Disables an item in the UI
func (*Menu) SetSendChannel ¶
func (menu *Menu) SetSendChannel(sendChannel *connection.In)
func (*Menu) SetVisible ¶
Enables or Disables an item in the UI
func (*Menu) ToggleRadio ¶
Checks or Unchecks a CheckItem in the UI
type MenuItem ¶
type MenuItem struct { CommandID uint `json:"command_id,omitempty"` Label string `json:"label,omitempty"` GroupID uint `json:"group_id,omitempty"` SubMenu *Menu `json:"submenu,omitempty"` Type string `json:"type,omitempty"` Checked bool `json:"checked"` Enabled bool `json:"enabled"` Visible bool `json:"visible"` Parent *Menu `json:"-"` }
func (MenuItem) HandleEvent ¶
func (mi MenuItem) HandleEvent()
func (MenuItem) IsCheckItem ¶
func (MenuItem) IsCommandID ¶
func (MenuItem) IsRadioItem ¶
type MenuSync ¶
type MenuSync struct { /* Channels for singaling queues */ ReadyChan chan bool DisplayedChan chan bool ChildStableChan chan uint TreeStableChan chan bool /*Queues for preserving command order and Priority*/ ReadyQueue []*commands.Command DisplayedQueue []*commands.Command // Not Exactly a Queue, more of a priority queue. Send out the first child that is stable. ChildStableQueue []*ChildCommand TreeStableQueue []*commands.Command /* Channels for control */ QuitChan chan bool }