summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/andlabs/window.go2
-rw-r--r--toolkit/gocui/common.go22
-rw-r--r--toolkit/gocui/place.go7
-rw-r--r--toolkit/gocui/structs.go2
-rw-r--r--toolkit/widget.go10
5 files changed, 23 insertions, 20 deletions
diff --git a/toolkit/andlabs/window.go b/toolkit/andlabs/window.go
index 34245d8..42a2baa 100644
--- a/toolkit/andlabs/window.go
+++ b/toolkit/andlabs/window.go
@@ -23,7 +23,7 @@ func newWindow(a toolkit.Action) {
newt.wId = a.WidgetId
// menubar bool is if the OS defined border on the window should be used
- win := ui.NewWindow(a.Name, a.Width, a.Height, menubar)
+ win := ui.NewWindow(a.Name, a.X, a.Y, menubar)
win.SetBorderless(canvas)
win.SetMargined(margin)
win.OnClosing(func(*ui.Window) bool {
diff --git a/toolkit/gocui/common.go b/toolkit/gocui/common.go
index 09c58f0..9f10e94 100644
--- a/toolkit/gocui/common.go
+++ b/toolkit/gocui/common.go
@@ -17,27 +17,27 @@ func makeWidget(a *toolkit.Action) *cuiWidget {
w.s = a.S
w.x = a.X
w.y = a.Y
- w.width = a.Width
- w.height = a.Height
+
t := len(w.text)
- w.realWidth = t + me.buttonPadding
- w.realHeight = me.DefaultHeight
- w.gocuiSize.width = t + me.buttonPadding
- w.gocuiSize.height = me.DefaultHeight
+ w.gocuiSize.width = t + me.PadW
+ w.gocuiSize.height = me.DefaultHeight + me.PadH
+
+ w.realWidth = w.gocuiSize.width
+ w.realHeight = w.gocuiSize.height
- w.widgetType = a.WidgetType
- w.id = a.WidgetId
- // set the name used by gocui to the id
- w.cuiName = strconv.Itoa(w.id)
// set the gocui view.Frame = true by default
w.frame = true
-
if (w.frame) {
w.realHeight += me.FramePadH
w.gocuiSize.height += me.FramePadH
}
+ w.widgetType = a.WidgetType
+ w.id = a.WidgetId
+ // set the name used by gocui to the id
+ w.cuiName = strconv.Itoa(w.id)
+
if w.widgetType == toolkit.Root {
log(logInfo, "setupWidget() FOUND ROOT w.id =", w.id, "w.parent", w.parent, "ParentId =", a.ParentId)
w.id = 0
diff --git a/toolkit/gocui/place.go b/toolkit/gocui/place.go
index 2ff791a..50e3b6f 100644
--- a/toolkit/gocui/place.go
+++ b/toolkit/gocui/place.go
@@ -48,13 +48,13 @@ func (w *cuiWidget) placeBox() {
w.showWidgetPlacement(logNow, "boxE()")
}
+/*
func (w *cuiWidget) getGroupWH() {
p := w.parent // the parent must be a group widget
// update parent gocuiSize
- p.realWidth = 0
- p.realHeight = 0
- p.realHeight += me.buttonPadding // pad height for the group label
+ // p.realWidth =
+ // p.realHeight += me.DefaultHeight + me.PadH + me.FramePadH
for _, child := range p.children {
p.realWidth += child.realWidth
p.realHeight += child.realHeight
@@ -71,6 +71,7 @@ func (w *cuiWidget) getGroupWH() {
}
return
}
+*/
func (w *cuiWidget) placeWidgets() {
if (w == nil) {
diff --git a/toolkit/gocui/structs.go b/toolkit/gocui/structs.go
index 78ca36d..b3c780f 100644
--- a/toolkit/gocui/structs.go
+++ b/toolkit/gocui/structs.go
@@ -69,7 +69,7 @@ type config struct {
// horizontalPadding int
// groupPadding int `default:"6" dense:"2"` // this is supposed to be how far to indent to the left
- buttonPadding int `default:"4" dense:"3"` // if 3, buttons slightly overlap
+ // buttonPadding int `default:"4" dense:"3"` // if 3, buttons slightly overlap
}
var (
diff --git a/toolkit/widget.go b/toolkit/widget.go
index 1a5a45f..51fe8b5 100644
--- a/toolkit/widget.go
+++ b/toolkit/widget.go
@@ -34,14 +34,16 @@ type Action struct {
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
// This is used for things like a slider(0,100)
- Width int
- Height int
X int
Y int
+ // This GUI is intended for simple things
+ // Is having an option like 640x480 really a good idea?
+ // TODO: remove Width & Height measured in pixels?
+// Width int
+// Height int
+
// Put space around elements to improve look & feel
Margin bool