summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--window.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/window.go b/window.go
index c340d99..298d3ab 100644
--- a/window.go
+++ b/window.go
@@ -11,6 +11,24 @@ import (
"go.wit.com/widget"
)
+func (tk *guiWidget) setTitle(s string) {
+ if tk.node.WidgetType != widget.Window {
+ return
+ }
+ if tk.v == nil {
+ return
+ }
+ rect := tk.gocuiSize
+ rect.w1 = rect.w0 + tk.full.Width() + 1
+ // rect.h1 = rect.h0 + 1
+ me.baseGui.SetView(tk.v.Name(), rect.w0, rect.h0, rect.w1, rect.h1, 0)
+ tk.v.Clear()
+ f := "%-" + fmt.Sprintf("%d", tk.full.Width()-3) + "s %s"
+ tmp := tk.node.GetLabel() + " " + tk.v.Name() + " " + f
+ labelN := fmt.Sprintf(f, tmp, "XX")
+ tk.v.WriteString(labelN)
+}
+
func (tk *guiWidget) redrawWindow(w int, h int) {
if tk.node.WidgetType != widget.Window {
return
@@ -22,7 +40,8 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
// pin the window to (w,h)
tk.gocuiSize.w0 = w
tk.gocuiSize.h0 = h
- tk.gocuiSize.w1 = w + len(tk.GetText())
+ tk.gocuiSize.w1 = w + len(tk.node.GetLabel())
+ tk.labelN = tk.node.GetLabel() + " XX"
tk.force.w0 = w
tk.force.w1 = w
tk.force.h0 = h
@@ -92,6 +111,16 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
// so we have to redraw the widgets in the window anyway and then they will appear above he frame
tk.hideWidgets()
tk.showWidgets()
+
+ /*
+ tk.gocuiSize.w1 = tk.gocuiSize.w0 + tk.full.Width()
+ f := "%-" + fmt.Sprintf("%d", tk.full.Width()) + "s %s"
+ tk.labelN = fmt.Sprintf(f, tk.node.GetLabel(), "XX")
+ log.Info("f =", f)
+ log.Info("label =", tk.labelN)
+ tk.dumpWidget(fmt.Sprintf("label"))
+ */
+ tk.setTitle(tk.node.GetLabel() + " jwc")
}
// re-draws the buttons for each of the windows