summaryrefslogtreecommitdiff
path: root/window.go
diff options
context:
space:
mode:
Diffstat (limited to 'window.go')
-rw-r--r--window.go24
1 files changed, 10 insertions, 14 deletions
diff --git a/window.go b/window.go
index 543e0c6..51f40e1 100644
--- a/window.go
+++ b/window.go
@@ -13,7 +13,7 @@ import (
)
func (tk *guiWidget) setTitle(s string) {
- if tk.node.WidgetType != widget.Window {
+ if tk.WidgetType() != widget.Window {
return
}
if tk.v == nil {
@@ -26,14 +26,13 @@ func (tk *guiWidget) setTitle(s string) {
me.baseGui.SetView(tk.v.Name(), rect.w0-1, rect.h0, rect.w1+1, rect.h1, 0)
tk.v.Clear()
f := " %-" + fmt.Sprintf("%d", tk.full.Width()-3) + "s %s"
- // tmp := tk.node.GetLabel() + " " + tk.v.Name() + " " + f
- tmp := tk.node.GetLabel()
+ tmp := tk.GetLabel()
labelN := fmt.Sprintf(f, tmp, "X")
tk.v.WriteString(labelN)
}
func (tk *guiWidget) redrawWindow(w int, h int) {
- if tk.node.WidgetType != widget.Window {
+ if tk.WidgetType() != widget.Window {
return
}
// tk.dumpWidget(fmt.Sprintf("redrawWindow(%d,%d)", w, h))
@@ -43,8 +42,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.node.GetLabel())
- tk.labelN = tk.node.GetLabel() // could set XX here also but don't have final size of window yet
+ tk.gocuiSize.w1 = w + len(tk.GetLabel())
+ tk.labelN = tk.GetLabel() // could set XX here also but don't have final size of window yet
tk.force.w0 = w
tk.force.w1 = w
tk.force.h0 = h
@@ -77,8 +76,7 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
tk.showWidgets()
if tk.windowFrame == nil {
- tk.addWindowFrameTK(0 - tk.node.WidgetId)
- tk.windowFrame.node.State.Label = "" // temporary name. blank out when ready for release
+ tk.addWindowFrameTK(0 - tk.WidgetId())
tk.windowFrame.makeTK([]string{""})
}
@@ -106,7 +104,7 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
tk.showWidgets()
// draw the window title
- tk.setTitle(tk.node.GetLabel())
+ tk.setTitle(tk.GetLabel())
}
// re-draws the buttons for each of the windows
@@ -154,8 +152,6 @@ func (win *guiWidget) addWindowFrame(wId int) *tree.Node {
if tk.node.Parent == nil {
tk.node.Parent = me.treeRoot
}
- // copy the data from the action message
- tk.node.State.Label = "windowFrame"
// set the name used by gocui to the id
tk.cuiName = fmt.Sprintf("%d DR", wId)
@@ -175,7 +171,7 @@ func (win *guiWidget) addWindowFrame(wId int) *tree.Node {
}
func (tk *guiWidget) isWindowActive() bool {
- if !(tk.node.WidgetType == widget.Window || tk.node.WidgetType == widget.Stdout) {
+ if !(tk.WidgetType() == widget.Window || tk.WidgetType() == widget.Stdout) {
// only allow Window or the Stdout widgets to be made active
return false
}
@@ -184,12 +180,12 @@ func (tk *guiWidget) isWindowActive() bool {
// always redraws at the corner of the gocuiSize box
func (tk *guiWidget) makeWindowActive() {
- if !(tk.node.WidgetType == widget.Window || tk.node.WidgetType == widget.Stdout) {
+ if !(tk.WidgetType() == widget.Window || tk.WidgetType() == widget.Stdout) {
// only allow Window or the Stdout widgets to be made active
return
}
- if tk.node.WidgetType == widget.Stdout {
+ if tk.WidgetType() == widget.Stdout {
me.stdout.outputOnTop = true
} else {
// me.stdout.outputOnTop = false // ?