2024-01-05 12:59:07 -06:00
|
|
|
package widget
|
2024-01-05 12:55:21 -06:00
|
|
|
|
2024-01-05 12:59:07 -06:00
|
|
|
// passes information between the gui package and the toolkit plugins
|
2024-01-05 12:55:21 -06:00
|
|
|
//
|
|
|
|
// This is the only thing that is passed between the toolkit plugin
|
|
|
|
//
|
|
|
|
// what names should be used? This is not part of [[Graphical Widget]]
|
2024-01-11 16:41:37 -06:00
|
|
|
// Event() seems like a good name.
|
2024-01-05 12:55:21 -06:00
|
|
|
// Event is used too much: web dev, cloud, etc
|
|
|
|
// I'm using "Action". Maybe it should really be
|
|
|
|
// "Interaction" as per wikipedia [[User interface]]
|
|
|
|
//
|
|
|
|
// TODO: convert this to a protobuf (?)
|
|
|
|
//
|
|
|
|
|
|
|
|
type WidgetType int // Button, Menu, Checkbox, etc.
|
|
|
|
|
|
|
|
const (
|
2024-02-27 23:49:08 -06:00
|
|
|
Unknown WidgetType = iota + 1
|
2024-01-05 12:55:21 -06:00
|
|
|
Root // the master 'root' node of the binary tree
|
|
|
|
Flag // used to send configuration values to plugins
|
|
|
|
Window // in certain gui's (ncurses), these are tabs
|
|
|
|
Tab // internally, this is a window
|
|
|
|
Frame // deprecate?
|
|
|
|
Grid // like drawers in a chest
|
|
|
|
Group // like the 'Appetizers' section on a menu
|
|
|
|
Box // a vertical or horizontal stack of widgets
|
|
|
|
Button
|
|
|
|
Checkbox // select 'on' or 'off'
|
|
|
|
Dropdown
|
|
|
|
Combobox // dropdown with edit=true
|
|
|
|
Label
|
|
|
|
Textbox // is this a Label with edit=true
|
|
|
|
Slider // like a progress bar
|
|
|
|
Spinner // like setting the oven temperature
|
|
|
|
Separator // TODO
|
|
|
|
Image // TODO
|
|
|
|
Area // TODO
|
|
|
|
Form // TODO
|
|
|
|
Font // TODO
|
|
|
|
Color // TODO
|
|
|
|
Dialog // TODO
|
|
|
|
Stdout // can be used to capture and display log output
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s WidgetType) String() string {
|
|
|
|
switch s {
|
|
|
|
case Root:
|
|
|
|
return "Root"
|
|
|
|
case Flag:
|
|
|
|
return "Flag"
|
|
|
|
case Window:
|
|
|
|
return "Window"
|
|
|
|
case Tab:
|
|
|
|
return "Tab"
|
|
|
|
case Frame:
|
|
|
|
return "Frame"
|
|
|
|
case Grid:
|
|
|
|
return "Grid"
|
|
|
|
case Group:
|
|
|
|
return "Group"
|
|
|
|
case Box:
|
|
|
|
return "Box"
|
|
|
|
case Button:
|
|
|
|
return "Button"
|
|
|
|
case Checkbox:
|
|
|
|
return "Checkbox"
|
|
|
|
case Dropdown:
|
|
|
|
return "Dropdown"
|
|
|
|
case Combobox:
|
|
|
|
return "Combobox"
|
|
|
|
case Label:
|
|
|
|
return "Label"
|
|
|
|
case Textbox:
|
|
|
|
return "Textbox"
|
|
|
|
case Slider:
|
|
|
|
return "Slider"
|
|
|
|
case Spinner:
|
|
|
|
return "Spinner"
|
|
|
|
case Separator:
|
|
|
|
return "Separator"
|
|
|
|
case Image:
|
|
|
|
return "Image"
|
|
|
|
case Area:
|
|
|
|
return "Area"
|
|
|
|
case Form:
|
|
|
|
return "Form"
|
|
|
|
case Font:
|
|
|
|
return "Font"
|
|
|
|
case Color:
|
|
|
|
return "Color"
|
|
|
|
case Dialog:
|
|
|
|
return "Dialog"
|
|
|
|
case Stdout:
|
|
|
|
return "Stdout"
|
|
|
|
case Unknown:
|
|
|
|
return "Unknown"
|
|
|
|
}
|
|
|
|
return "WidgetType.String() Error"
|
|
|
|
}
|