summaryrefslogtreecommitdiff
path: root/toolkit/widget.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-23 09:47:54 -0500
committerJeff Carr <[email protected]>2023-04-23 09:47:54 -0500
commit1322a011e7f5b8665b671d4c5ee4e65804ca75be (patch)
tree24ed995ace7694128d5ecdb4ebafc5da7cd868e3 /toolkit/widget.go
parent2d4d2b6b3e115a86a10f98c20de0e4e82be519c2 (diff)
andlabs: ran without crashing
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/widget.go')
-rw-r--r--toolkit/widget.go46
1 files changed, 7 insertions, 39 deletions
diff --git a/toolkit/widget.go b/toolkit/widget.go
index 658475e..1a5a45f 100644
--- a/toolkit/widget.go
+++ b/toolkit/widget.go
@@ -1,15 +1,7 @@
package toolkit
-type WidgetType int
-type ActionType int
-
// passes information between the toolkit library (plugin)
//
-// All Toolkit interactions should be done via a channel or Queue()
-// TODO: FIGURE OUT HOW TO IMPLEMENT THIS
-// https://ieftimov.com/post/golang-datastructures-trees/
-// TODO: protobuf ?
-//
// This is the only thing that is passed between the toolkit plugin
//
// what names should be used? This is not part of [[Graphical Widget]]
@@ -17,29 +9,12 @@ type ActionType int
// Event is used too much: web dev, cloud, etc
// I'm using "Action". Maybe it should really be
// "Interaction" as per wikipedia [[User interface]]
-// Could a protobuf be used here? (Can functions be passed?)
-type Widget2 struct {
- // Name string
- Type WidgetType
-
- // This function is how you interact with the toolkit
- // latest attempt. seems to work so far (2023/02/28)
- // Hopefully this will be the barrier between the goroutines
- // TODO: move this interaction to channels
- Custom func()
-
- // re-adding an id to test channels
- Id int
+//
+// TODO: convert this to a protobuf (?)
+//
- // This is how the values are passed back and forth
- // values from things like checkboxes & dropdown's
- // The string is also used to set the button name
- B bool
- I int
- // maybe safe if there is correctly working Custom() between goroutines?
- // (still probably not, almost certainly not. not possible. layer violation?)
- S string // not safe to have 'S'
-}
+type WidgetType int // Button, Menu, Checkbox, etc.
+type ActionType int // Add, SetText, Click, Hide, Append, Delete, etc
type Action struct {
ActionType ActionType
@@ -51,20 +26,13 @@ type Action struct {
Text string // what is visable to the user
Name string // a name useful for programming
- // this should be the widget
- // if the action is New, Hide, Enable, etc
- // Widget *Widget
-
// This is how the values are passed back and forth
// values from things like checkboxes & dropdown's
- // The string is also used to set the button name
B bool
I int
- // maybe safe if there is correctly working Custom() between goroutines?
- // (still probably not, almost certainly not. not possible. layer violation?)
- S string // not safe to have 'S'
+ S string
- A any
+ A any // switch to this or deprecate this? pros/cons?
// This GUI is intended for simple things
// We are not laying out PDF's here