kinda, sorta, but no. not yet

This commit is contained in:
Jeff Carr 2025-02-04 10:04:45 -06:00
parent a10582c846
commit acfb80a2e7
2 changed files with 31 additions and 17 deletions

View File

@ -9,6 +9,27 @@ import (
"go.wit.com/widget" "go.wit.com/widget"
) )
func (tk *guiWidget) redrawWindow(w int, h int) {
if tk.node.WidgetType != widget.Window {
return
}
// might make the green box the right size
tk.setFullSize()
// draw the current window
// w = tk.gocuiSize.w0 + 4
// h = tk.gocuiSize.h0 + 4
w = w + 4
h = h + 4
tk.DrawAt(w, h)
tk.setColor(&colorActiveW) // sets the window to Green BG
tk.showWidgets()
tk.placeWidgets(w, h) // compute the sizes & places for each widget
tk.setFullSize()
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
}
// this whole things was impossible to make but it got me where I am now // this whole things was impossible to make but it got me where I am now
// the debugging is way way better now with it being visible in the Stdout window // the debugging is way way better now with it being visible in the Stdout window
// so now it's possible to redo all this and make it better // so now it's possible to redo all this and make it better
@ -27,19 +48,8 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
me.currentWindow.isCurrent = true me.currentWindow.isCurrent = true
tk.active = false tk.active = false
// might make the green box the right size tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
tk.setFullSize() return
// draw the current window
w := tk.gocuiSize.w0 + 4
h := tk.gocuiSize.h0 + 4
tk.DrawAt(w, h)
tk.setColor(&colorActiveW) // sets the window to Green BG
tk.showWidgets()
tk.placeWidgets(w, h) // compute the sizes & places for each widget
tk.setFullSize()
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
case widget.Group: case widget.Group:
if tk.active { if tk.active {
tk.active = false tk.active = false

View File

@ -92,10 +92,14 @@ func mouseMove(g *gocui.Gui) {
func (tk *guiWidget) moveNew(g *gocui.Gui) { func (tk *guiWidget) moveNew(g *gocui.Gui) {
w, h := g.MousePosition() w, h := g.MousePosition()
if tk.node.WidgetType == widget.Window { if tk.node.WidgetType == widget.Window {
/*
w1, h1 := tk.Size() w1, h1 := tk.Size()
g.SetView(tk.cuiName, w, h, w+w1, h+h1, 0) g.SetView(tk.cuiName, w, h, w+w1, h+h1, 0)
tk.verifyRect() tk.verifyRect()
s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName) s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName)
*/
tk.redrawWindow(w, h)
s := fmt.Sprintf("move(%dx%d) %s WIN", w, h, tk.cuiName)
tk.dumpWidget(s) tk.dumpWidget(s)
return return
} }