widget/action.go

123 lines
2.0 KiB
Go

package widget
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
// Put space around elements to improve look & feel
// Margin bool avoided due to use of action types
// Pad bool
// Make widgets fill up the space available
Expand bool
}
type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
const (
Add ActionType = iota
Delete
Get
Set
GetText
SetText
AddText
Checked
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 (s ActionType) String() string {
switch s {
case Add:
return "Add"
case Delete:
return "Delete"
case Get:
return "Get"
case Set:
return "Set"
case GetText:
return "GetText"
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"
}