summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-05 16:30:06 -0600
committerJeff Carr <[email protected]>2025-02-05 16:30:06 -0600
commitefebe00640b7b44821c37fd2c9479c579bebc392 (patch)
treec5bcf67022d282ede1d2ab890aada1065a3cfa4f
parent07f6b7842e9ee6c933be365ab24839aec5c07298 (diff)
window dragging works fairly well
-rw-r--r--debug.go6
-rw-r--r--place.go2
-rw-r--r--size.go2
-rw-r--r--treeDraw.go2
-rw-r--r--window.go12
5 files changed, 19 insertions, 5 deletions
diff --git a/debug.go b/debug.go
index ff78f93..bde2cd1 100644
--- a/debug.go
+++ b/debug.go
@@ -30,9 +30,13 @@ func (w *guiWidget) dumpWindows(s string) {
log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.node.WidgetType, w.String())
return
}
- s += fmt.Sprintf("(%d,%d)", w.force.w0, w.force.h0)
if w.node.WidgetType == widget.Window {
+ s += fmt.Sprintf(" F(%d,%d)", w.force.w0, w.force.h0)
+ // can't set this here. doesn't work
+ // w.full.w0 = w.force.w0
+ // w.full.h0 = w.force.h0
w.dumpWidget("dumpWindow() " + s)
+ w.windowFrame.dumpWidget("dumpFrame() " + s)
}
for _, child := range w.children {
diff --git a/place.go b/place.go
index c400bb8..98e9c78 100644
--- a/place.go
+++ b/place.go
@@ -77,6 +77,8 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
switch tk.node.WidgetType {
case widget.Window:
+ tk.full.w0 = startW
+ tk.full.h0 = startH
startW += 4
startH += 4
for _, child := range tk.children {
diff --git a/size.go b/size.go
index 30aab68..5b9ff1f 100644
--- a/size.go
+++ b/size.go
@@ -194,6 +194,7 @@ func (tk *guiWidget) setFullSize() bool {
}
// widget might be forced to a certain location
if tk.full.w0 < tk.force.w0 {
+ tk.gocuiSize.w0 = tk.force.w0
tk.full.w0 = tk.force.w0
changed = false
}
@@ -207,6 +208,7 @@ func (tk *guiWidget) setFullSize() bool {
}
// widget might be forced to a certain location
if tk.full.h0 < tk.force.h0 {
+ tk.gocuiSize.h0 = tk.force.h0
tk.full.h0 = tk.force.h0
changed = false
}
diff --git a/treeDraw.go b/treeDraw.go
index adbeb92..fd3fdaa 100644
--- a/treeDraw.go
+++ b/treeDraw.go
@@ -43,6 +43,8 @@ func (tk *guiWidget) drawView() {
tk.resize = true
tk.textResize() // resize window only once
} else {
+ tk.full.w0 = tk.force.w0
+ tk.full.h0 = tk.force.h0
// for windows, make it the full size
a = tk.full.w0
b = tk.full.h0
diff --git a/window.go b/window.go
index 02f578c..0d25ed2 100644
--- a/window.go
+++ b/window.go
@@ -31,6 +31,10 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
tk.setColor(&colorActiveW) // sets the window to Green BG
tk.placeWidgets(w, h) // compute the sizes & places for each widget
+ // this is a test. this should not be needed
+ tk.full.w0 = tk.force.w0
+ tk.full.h0 = tk.force.h0
+
tk.setFullSize()
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
tk.Show()
@@ -43,13 +47,13 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
}
// tk.windowFrame.MoveToOffset(w, h+2)
r := tk.getFullSize()
- tk.windowFrame.gocuiSize.w0 = r.w0
+ tk.windowFrame.gocuiSize.w0 = tk.force.w0
tk.windowFrame.gocuiSize.w1 = r.w1 + 1
- tk.windowFrame.gocuiSize.h0 = r.h0 + 2
+ tk.windowFrame.gocuiSize.h0 = tk.force.h0 + 2
tk.windowFrame.gocuiSize.h1 = r.h1 + 1
- tk.windowFrame.full.w0 = r.w0
+ tk.windowFrame.full.w0 = tk.force.w0
tk.windowFrame.full.w1 = r.w1 + 1
- tk.windowFrame.full.h0 = r.h0 + 2
+ tk.windowFrame.full.h0 = tk.force.h0 + 2
tk.windowFrame.full.h1 = r.h1 + 1
// tk.windowFrame.drawView()
tk.windowFrame.Hide()