Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Action ¶
type Action struct {
ActionType ActionType
WidgetType WidgetType
WidgetId int
ParentId int
State State
// Text string // what is visable to the user
ProgName string // a name useful for programming
// most primitive widgets just store a single thing
Value any
// how to arrange widgets
Direction Orientation
// All the strings for things like dropdown menus
// They must be sent in display order
// These must be unique
Strings []string
Range RangeType
// RETHINK / REDO EVERYTHING BELOW HERE
// This is used for things like a slider(0,100)
X int
Y int
// This is for the grid size & widget position
W int
H int
AtW int
AtH int
// Make widgets fill up the space available
Expand bool
}
type ActionType ¶
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
const ( Add ActionType = iota Delete Get Set GetText SetText AddText Show Hide Enable Disable SetMargin Margin Unmargin SetPad Pad Unpad SetExpand Append Move Dump User // the user did something (mouse, keyboard, etc) ToolkitLoad // attempts to load a new toolkit ToolkitInit // initializes the toolkit ToolkitClose // closes the toolkit ToolkitPanic CloseWindow UserQuit // the user closed the GUI EnableDebug // open the debugging window )
func (ActionType) String ¶
func (s ActionType) String() string
type GridOffset ¶
type Orientation ¶
type Orientation int
Horizontal means layout widgets like books on a bookshelf
--------------------------------- | W | W | W | W | W | W | W | W | | i | i | i | i | i | i | i | i | | d | d | d | d | d | d | d | d | | g | g | g | g | g | g | g | g | | e | e | e | e | e | e | e | e | | t | t | t | t | t | t | t | t | ---------------------------------
Vertical means layout widgets like books in a stack ---------- | Widget | ---------- | Widget | ---------- | Widget | ---------- | Widget | ----------
const ( Horizontal Orientation = iota Vertical )
func (Orientation) String ¶
func (s Orientation) String() string
type RangeType ¶
Range(1, 10) includes the values 1 and 10 almost all toolkits use integers so there doesn't seem to be a good idea to use 'type any' here as it just makes things more complicated for no good reason
type State ¶ added in v1.1.4
type State struct {
// This is a unmodifiable string that is displayed to the user.
Label string
// most primitive widgets just store a single thing
// it is the default value
Value any
// how to arrange widgets
Direction Orientation
//
// This is complicated. We must send a list of all the widgets
// in the binary tree to the toolkits because some toolkits
// must make the widgets exist and then hide them.
//
// However, when a widget is not visable, no updates to the
// widget is sent to the toolkit and no events from the
// widget are valid back to the program
//
Visable bool
// if false, pack things as tightly as possible
Pad bool
// trys to fill up available space
Expand bool
// All the strings for things like dropdown menus
// They must be sent in display order
// These must be unique
Strings []string
// for widgets that use a range
Range RangeType
Geom Geom
Size Size
GridSize GridSize
GridOffset GridOffset
// This is for the grid size & widget position
W int
H int
AtW int
AtH int
// a name useful for programming and the debugger.
// It is not intended to be displayed to the user
ProgName string
}
Range(1, 10) includes the values 1 and 10 almost all toolkits use integers so there doesn't seem to be a good idea to use 'type any' here as it just makes things more complicated for no good reason
type WidgetType ¶
type WidgetType int // Button, Menu, Checkbox, etc.
const ( Unknown WidgetType = iota 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 (WidgetType) String ¶
func (s WidgetType) String() string