summaryrefslogtreecommitdiff
path: root/window.go
blob: 2f0673ab8572e5d938adf334c5c4121fd34defdc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// 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.gocuiSize.w0 = w - 2
	tk.gocuiSize.h0 = h - 1

	tk.setFullSize() // might make the green box the right size

	tk.frame = false
	tk.hasTabs = false

	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.setFullSize()
	me.baseGui.SetView(tk.cuiName, tk.gocuiSize.w0, tk.gocuiSize.h0, tk.gocuiSize.w1, tk.gocuiSize.h1, 0)
	tk.Show()
	tk.showWidgets()
}

// re-draws the buttons for each of the windows
func redoWindows(nextW int, nextH int) {
	for _, win := range findWindows() {
		win.gocuiSize.w0 = nextW
		win.gocuiSize.h0 = nextH

		win.dumpWidget(fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH))
		win.redrawWindow(nextW, nextH)
		win.dumpWidget(fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH))

		// increment the width for the next window
		nextW += win.gocuiSize.Width() + 4
	}
}