gocui/window.go

44 lines
1.1 KiB
Go
Raw Normal View History

2025-02-01 11:42:31 -06:00
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
package main
import (
2025-02-04 13:31:48 -06:00
"fmt"
"go.wit.com/widget"
)
2025-02-04 14:27:32 -06:00
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.frame = false
tk.hasTabs = false
2025-02-04 14:27:32 -06:00
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
2025-02-04 14:45:23 -06:00
func redoWindows(nextW int, nextH int) {
2025-02-04 14:27:32 -06:00
for _, win := range findWindows() {
win.gocuiSize.w0 = nextW
win.gocuiSize.h0 = nextH
2025-02-04 13:31:48 -06:00
2025-02-04 15:48:14 -06:00
win.dumpWidget(fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH))
win.redrawWindow(nextW, nextH)
2025-02-04 15:48:14 -06:00
win.dumpWidget(fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH))
2025-02-04 14:27:32 -06:00
// increment the width for the next window
nextW += win.gocuiSize.Width() + 4
}
}