diff options
| author | Jeff Carr <[email protected]> | 2024-01-17 21:05:52 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-17 21:05:52 -0600 |
| commit | d91e80a9eabf79cc376c725aaf3a877856faa6b9 (patch) | |
| tree | da31050456b7c6f53de8e8a5748f94ee85343605 /state.go | |
| parent | 38595e75f2f35ecce9cc6a8d887f393d34975957 (diff) | |
works with new toolkit and gui changesv1.1.4
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'state.go')
| -rw-r--r-- | state.go | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/state.go b/state.go new file mode 100644 index 0000000..bb460b4 --- /dev/null +++ b/state.go @@ -0,0 +1,63 @@ +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 + 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 +} |
