summaryrefslogtreecommitdiff
path: root/action.go
diff options
context:
space:
mode:
Diffstat (limited to 'action.go')
-rw-r--r--action.go104
1 files changed, 104 insertions, 0 deletions
diff --git a/action.go b/action.go
new file mode 100644
index 0000000..b42e8ab
--- /dev/null
+++ b/action.go
@@ -0,0 +1,104 @@
+package widget
+
+type Action struct {
+ ActionType ActionType
+ WidgetType WidgetType
+
+ WidgetId int
+ ParentId int
+
+ // 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
+
+ // 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
+
+ // 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
+ Show
+ Hide
+ Enable
+ Disable
+ Margin
+ Unmargin
+ Pad
+ Unpad
+ Append
+ Move
+ Dump
+ User // the user did something (mouse, keyboard, etc)
+ InitToolkit // initializes the toolkit
+ CloseToolkit // closes the toolkit
+ 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"
+}