2024-01-11 16:41:37 -06:00
|
|
|
package widget
|
|
|
|
|
|
|
|
type Action struct {
|
|
|
|
ActionType ActionType
|
|
|
|
WidgetType WidgetType
|
|
|
|
|
|
|
|
WidgetId int
|
|
|
|
ParentId int
|
|
|
|
|
2024-01-17 21:05:52 -06:00
|
|
|
State State
|
|
|
|
|
2024-01-11 16:41:37 -06:00
|
|
|
// 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
|
|
|
|
|
2024-01-13 13:31:35 -06:00
|
|
|
// All the strings for things like dropdown menus
|
|
|
|
// They must be sent in display order
|
|
|
|
// These must be unique
|
|
|
|
Strings []string
|
|
|
|
|
|
|
|
Range RangeType
|
|
|
|
|
2024-01-14 10:42:36 -06:00
|
|
|
// RETHINK / REDO EVERYTHING BELOW HERE
|
2024-01-11 16:41:37 -06:00
|
|
|
// 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
|
|
|
|
|
|
|
|
// Put space around elements to improve look & feel
|
2024-01-14 10:42:36 -06:00
|
|
|
// Margin bool avoided due to use of action types
|
|
|
|
// Pad bool
|
2024-01-11 16:41:37 -06:00
|
|
|
|
|
|
|
// Make widgets fill up the space available
|
|
|
|
Expand bool
|
|
|
|
}
|
|
|
|
|
|
|
|
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
|
|
|
|
|
|
|
|
const (
|
2024-02-27 23:49:08 -06:00
|
|
|
Add ActionType = iota + 1
|
2024-01-11 16:41:37 -06:00
|
|
|
Delete
|
|
|
|
SetText
|
|
|
|
AddText
|
2024-01-19 03:45:56 -06:00
|
|
|
Checked
|
2024-01-11 16:41:37 -06:00
|
|
|
Show
|
|
|
|
Hide
|
|
|
|
Enable
|
|
|
|
Disable
|
2024-01-13 13:31:35 -06:00
|
|
|
SetMargin
|
2024-01-11 16:41:37 -06:00
|
|
|
Margin
|
|
|
|
Unmargin
|
2024-01-13 13:31:35 -06:00
|
|
|
SetPad
|
2024-01-11 16:41:37 -06:00
|
|
|
Pad
|
|
|
|
Unpad
|
2024-01-13 13:31:35 -06:00
|
|
|
SetExpand
|
2024-01-11 16:41:37 -06:00
|
|
|
Append
|
|
|
|
Move
|
|
|
|
Dump
|
|
|
|
User // the user did something (mouse, keyboard, etc)
|
2024-01-17 21:05:52 -06:00
|
|
|
ToolkitLoad // attempts to load a new toolkit
|
|
|
|
ToolkitInit // initializes the toolkit
|
|
|
|
ToolkitClose // closes the toolkit
|
|
|
|
ToolkitPanic
|
2024-02-05 15:01:28 -06:00
|
|
|
Heartbeat
|
2024-01-17 21:05:52 -06:00
|
|
|
CloseWindow
|
2024-01-11 16:41:37 -06:00
|
|
|
UserQuit // the user closed the GUI
|
|
|
|
EnableDebug // open the debugging window
|
|
|
|
)
|
|
|
|
|
|
|
|
func (s ActionType) String() string {
|
|
|
|
switch s {
|
|
|
|
case Add:
|
|
|
|
return "Add"
|
|
|
|
case Delete:
|
|
|
|
return "Delete"
|
|
|
|
case SetText:
|
|
|
|
return "SetText"
|
|
|
|
case AddText:
|
|
|
|
return "AddText"
|
|
|
|
case Show:
|
|
|
|
return "Show"
|
|
|
|
case Hide:
|
|
|
|
return "Hide"
|
|
|
|
case Enable:
|
|
|
|
return "Enable"
|
|
|
|
case Disable:
|
|
|
|
return "Disable"
|
|
|
|
case Margin:
|
|
|
|
return "Margin"
|
|
|
|
case Unmargin:
|
|
|
|
return "Unmargin"
|
|
|
|
case Pad:
|
|
|
|
return "Pad"
|
|
|
|
case Unpad:
|
|
|
|
return "Unpad"
|
|
|
|
case Append:
|
|
|
|
return "Append"
|
|
|
|
case Move:
|
|
|
|
return "Move"
|
|
|
|
case Dump:
|
|
|
|
return "Dump"
|
|
|
|
}
|
|
|
|
return "ActionType.String() Error"
|
|
|
|
}
|