hmm. still no dice
This commit is contained in:
parent
652cf2b73b
commit
3cf873439d
|
@ -15,11 +15,6 @@ func (tk *guiWidget) redrawWindow(w int, h int) {
|
||||||
}
|
}
|
||||||
tk.setFullSize() // might make the green box the right size
|
tk.setFullSize() // might make the green box the right size
|
||||||
|
|
||||||
// draw the current window
|
|
||||||
// w = tk.gocuiSize.w0 + 4
|
|
||||||
// h = tk.gocuiSize.h0 + 4
|
|
||||||
w = w + 4
|
|
||||||
h = h + 4
|
|
||||||
tk.DrawAt(w, h)
|
tk.DrawAt(w, h)
|
||||||
tk.setColor(&colorActiveW) // sets the window to Green BG
|
tk.setColor(&colorActiveW) // sets the window to Green BG
|
||||||
tk.placeWidgets(w, h) // compute the sizes & places for each widget
|
tk.placeWidgets(w, h) // compute the sizes & places for each widget
|
||||||
|
@ -47,7 +42,7 @@ func (tk *guiWidget) doWidgetClick(w int, h int) {
|
||||||
me.currentWindow.isCurrent = true
|
me.currentWindow.isCurrent = true
|
||||||
tk.active = false
|
tk.active = false
|
||||||
|
|
||||||
tk.redrawWindow(tk.gocuiSize.w0, tk.gocuiSize.h0)
|
tk.redrawWindow(w, h)
|
||||||
return
|
return
|
||||||
case widget.Group:
|
case widget.Group:
|
||||||
if tk.active {
|
if tk.active {
|
||||||
|
|
22
place.go
22
place.go
|
@ -75,27 +75,13 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
||||||
|
|
||||||
switch tk.node.WidgetType {
|
switch tk.node.WidgetType {
|
||||||
case widget.Window:
|
case widget.Window:
|
||||||
newW := startW
|
|
||||||
newH := startH
|
|
||||||
// var maxH int = 0
|
|
||||||
for _, child := range tk.children {
|
for _, child := range tk.children {
|
||||||
child.placeWidgets(newW, newH)
|
child.placeWidgets(startW, startH)
|
||||||
sizeW, sizeH := child.Size()
|
sizeW, _ := child.Size()
|
||||||
/*
|
startW += sizeW + 4 // add the width to move the next widget over
|
||||||
if sizeW < 20 {
|
|
||||||
sizeW = 20
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
newW += sizeW
|
|
||||||
newH += sizeH
|
|
||||||
/*
|
|
||||||
if sizeH > maxH {
|
|
||||||
maxH = sizeH
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return newW - startW, newH - startH
|
return startW, startH
|
||||||
case widget.Tab:
|
case widget.Tab:
|
||||||
case widget.Grid:
|
case widget.Grid:
|
||||||
return tk.placeGrid(startW, startH)
|
return tk.placeGrid(startW, startH)
|
||||||
|
|
42
treeDraw.go
42
treeDraw.go
|
@ -101,7 +101,7 @@ func (w *guiWidget) DrawAt(offsetW, offsetH int) {
|
||||||
w.setColor(&colorActiveW)
|
w.setColor(&colorActiveW)
|
||||||
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
|
w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
|
||||||
w.active = false
|
w.active = false
|
||||||
w.dumpWidget("DrawAt()")
|
w.dumpWidget(fmt.Sprintf("DrawAt(%d,%d)", offsetW, offsetH))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *guiWidget) simpleDrawAt(offsetW, offsetH int) {
|
func (w *guiWidget) simpleDrawAt(offsetW, offsetH int) {
|
||||||
|
@ -139,3 +139,43 @@ func (w *guiWidget) drawTree(draw bool) {
|
||||||
child.drawTree(draw)
|
child.drawTree(draw)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *guiWidget) Show() {
|
||||||
|
// don't display fake widgets
|
||||||
|
if w.isFake {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// deprecate this
|
||||||
|
// if this isn't in the binary tree
|
||||||
|
// it's some internal widget so always display those
|
||||||
|
if w.node == nil {
|
||||||
|
w.drawView()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// deprecate this
|
||||||
|
// always show window titles
|
||||||
|
if w.node.WidgetType == widget.Window {
|
||||||
|
w.drawView()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
// if the widget is not in the current displayed windo
|
||||||
|
if !w.IsCurrent() {
|
||||||
|
// log.Log(GOCUI, "Show() w.IsCurrent == false. NOT drawing", w.cuiName, w.String())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// this comes from the application developer
|
||||||
|
// finally, check if the widget State is hidden or not
|
||||||
|
if w.node.Hidden() {
|
||||||
|
// log.Log(GOCUI, "Show() w.node.Hidden() = false. not drawing", w.cuiName, w.String())
|
||||||
|
// don't display hidden widgets
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// log.Log(GOCUI, "Show() doing w.drawView()", w.cuiName, w.String())
|
||||||
|
w.drawView()
|
||||||
|
}
|
||||||
|
|
|
@ -103,64 +103,6 @@ func (tk *guiWidget) Visible() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *guiWidget) Show() {
|
|
||||||
// always should the dropdown widget
|
|
||||||
/*
|
|
||||||
if w == me.dropdownV {
|
|
||||||
me.dropdownV.drawView()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// don't display fake widgets
|
|
||||||
if w.isFake {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// if this isn't in the binary tree
|
|
||||||
// it's some internal widget so always display those
|
|
||||||
if w.node == nil {
|
|
||||||
w.drawView()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// always show window titles
|
|
||||||
if w.node.WidgetType == widget.Window {
|
|
||||||
w.drawView()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
if w.node.WidgetType == widget.Dropdown {
|
|
||||||
log.Log(NOW, "Show() dropdown", w.cuiName, w.String())
|
|
||||||
log.Log(NOW, "Show() dropdown n.Strings() =", w.node.Strings())
|
|
||||||
}
|
|
||||||
if w.node.WidgetType == widget.Combobox {
|
|
||||||
log.Log(NOW, "Show() dropdown", w.cuiName, w.String())
|
|
||||||
log.Log(NOW, "Show() dropdown n.Strings() =", w.node.Strings())
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// if the widget is not in the current displayed windo
|
|
||||||
// then ignore it
|
|
||||||
// log.Log(GOCUI, "Show() widget =", w.cuiName, w.String())
|
|
||||||
// log.Log(GOCUI, "Show() w.IsCurrent() returned", w.IsCurrent())
|
|
||||||
if !w.IsCurrent() {
|
|
||||||
// log.Log(GOCUI, "Show() w.IsCurrent == false. NOT drawing", w.cuiName, w.String())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// finally, check if the widget State is hidden or not
|
|
||||||
if w.node.Hidden() {
|
|
||||||
// log.Log(GOCUI, "Show() w.node.Hidden() = false. not drawing", w.cuiName, w.String())
|
|
||||||
// don't display hidden widgets
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// log.Log(GOCUI, "Show() doing w.drawView()", w.cuiName, w.String())
|
|
||||||
// okay, if you made it this far, then display the widget
|
|
||||||
w.drawView()
|
|
||||||
}
|
|
||||||
|
|
||||||
func (tk *guiWidget) Hide() {
|
func (tk *guiWidget) Hide() {
|
||||||
tk.deleteView()
|
tk.deleteView()
|
||||||
}
|
}
|
||||||
|
|
23
window.go
23
window.go
|
@ -4,18 +4,23 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"go.wit.com/widget"
|
"go.wit.com/widget"
|
||||||
)
|
)
|
||||||
|
|
||||||
// re-draws the buttons for each of the windows
|
// re-draws the buttons for each of the windows
|
||||||
func (w *guiWidget) redoWindows(nextW int, nextH int) {
|
func (tk *guiWidget) redoWindows(nextW int, nextH int) {
|
||||||
var startW int = nextW
|
|
||||||
var startH int = nextH
|
|
||||||
|
|
||||||
for _, child := range w.children {
|
for _, child := range tk.children {
|
||||||
if child.node.WidgetType != widget.Window {
|
if child.node.WidgetType != widget.Window {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
child.gocuiSize.w0 = nextW
|
||||||
|
child.gocuiSize.h0 = nextH
|
||||||
|
|
||||||
|
tmp := fmt.Sprintf("redoWindowsS (%d,%d)", nextW, nextH)
|
||||||
|
child.dumpWidget(tmp)
|
||||||
|
|
||||||
child.frame = false
|
child.frame = false
|
||||||
child.hasTabs = false
|
child.hasTabs = false
|
||||||
|
@ -23,10 +28,18 @@ func (w *guiWidget) redoWindows(nextW int, nextH int) {
|
||||||
// this should make the window the full size and re-draw it
|
// this should make the window the full size and re-draw it
|
||||||
child.setFullSize() // child.gocuiSetWH(nextW, nextH)
|
child.setFullSize() // child.gocuiSetWH(nextW, nextH)
|
||||||
child.Hide()
|
child.Hide()
|
||||||
child.drawView()
|
child.DrawAt(nextW, nextH)
|
||||||
|
child.Show()
|
||||||
|
|
||||||
|
tmp = fmt.Sprintf("redoWindowsE (%d,%d)", nextW, nextH)
|
||||||
|
child.dumpWidget(tmp)
|
||||||
|
|
||||||
|
nextW += child.gocuiSize.Width() + 4
|
||||||
|
child.redoWindows(nextW, nextH)
|
||||||
|
/*
|
||||||
sizeW := child.gocuiSize.Width()
|
sizeW := child.gocuiSize.Width()
|
||||||
nextW += sizeW + 4
|
nextW += sizeW + 4
|
||||||
child.redoWindows(startW+3, startH+2)
|
child.redoWindows(startW+3, startH+2)
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue