gocui/window.go

52 lines
1.3 KiB
Go

// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
package main
import (
"fmt"
"go.wit.com/widget"
)
func (tk *guiWidget) redrawWindow(w int, h int) {
if tk.node.WidgetType != widget.Window {
return
}
tk.setFullSize() // might make the green box the right size
tk.DrawAt(w, h)
tk.setColor(&colorActiveW) // sets the window to Green BG
tk.placeWidgets(w, h) // compute the sizes & places for each widget
tk.showWidgets()
tk.setFullSize()
me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
}
// re-draws the buttons for each of the windows
func (tk *guiWidget) redoWindows(nextW int, nextH int) {
for _, win := range findWindows() {
win.gocuiSize.w0 = nextW
win.gocuiSize.h0 = nextH
tmp := fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH)
win.dumpWidget(tmp)
win.frame = false
win.hasTabs = false
// this should make the window the full size and re-draw it
win.setFullSize() // win.gocuiSetWH(nextW, nextH)
win.Hide()
win.DrawAt(nextW, nextH)
win.Show()
tmp = fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH)
win.dumpWidget(tmp)
// increment the width for the next window
nextW += win.gocuiSize.Width() + 4
}
}