summaryrefslogtreecommitdiff
path: root/state.go
blob: 7b7c7d81d52a6ee94729be3a96138cbb1a6f94ad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package widget

// This is the state of the widget

// The whole state of the widget is sent
// when the widget action is Add() or Show()

// 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 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
	DefaultS	string
	CurrentS	string
	CurrentI	int
	NewString	string

	// most primitive widgets just store a single thing
	// it is the default value
	// Value	any

	// how to arrange widgets
	Direction Orientation

	// for widgets that have on/off things
	Checked bool

	//
	// 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

	// this tells the toolkit to hide the widget from being displayed
	// again, this is different than Visable. The hidden state is
	// specifically ONLY for the gui toolkit
	Hidden bool

	// is the widget usable by the user?
	Enable bool

	// if false, pack things as tightly as possible
	Pad bool

	// trys to fill up available space
	Expand bool

	// for toolkits with borderless window options
	Borderless 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
}