GOOD: use global 'Stretchy' setting
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
50a33262c1
commit
2af6db4d6c
2
box.go
2
box.go
|
@ -37,7 +37,7 @@ func (n *Node) AddComboBox(title string, s ...string) *Node {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
box.Append(ecbox, false)
|
box.Append(ecbox, Config.Stretchy)
|
||||||
return newNode
|
return newNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ func (n *Node) AddButton(name string, custom func(*Node)) *Node {
|
||||||
log.Println("reflect.TypeOF(uiButton) =", reflect.TypeOf(button))
|
log.Println("reflect.TypeOF(uiButton) =", reflect.TypeOf(button))
|
||||||
}
|
}
|
||||||
// true == expand, false == make normal size button
|
// true == expand, false == make normal size button
|
||||||
n.uiBox.Append(button, false)
|
n.uiBox.Append(button, Config.Stretchy)
|
||||||
n.uiButton = button
|
n.uiButton = button
|
||||||
|
|
||||||
newNode := n.makeNode(name, 888, 888 + Config.counter)
|
newNode := n.makeNode(name, 888, 888 + Config.counter)
|
||||||
|
@ -73,6 +73,6 @@ func (n *Node) CreateColorButton(custom func(*Node), name string, values interfa
|
||||||
Data.MouseClick(n)
|
Data.MouseClick(n)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
n.uiBox.Append(n.uiColorButton, false)
|
n.uiBox.Append(n.uiColorButton, Config.Stretchy)
|
||||||
return n
|
return n
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ func makeWindowDebug() *ui.Box {
|
||||||
}
|
}
|
||||||
nodeCombo.SetSelected(0)
|
nodeCombo.SetSelected(0)
|
||||||
|
|
||||||
nodeBox.Append(nodeCombo, false)
|
nodeBox.Append(nodeCombo, Config.Stretchy)
|
||||||
|
|
||||||
nodeCombo.OnSelected(func(*ui.Combobox) {
|
nodeCombo.OnSelected(func(*ui.Combobox) {
|
||||||
y := nodeCombo.Selected()
|
y := nodeCombo.Selected()
|
||||||
|
@ -148,7 +148,7 @@ func addName(c *ui.Combobox, s string) {
|
||||||
func addGroup(b *ui.Box, name string) *ui.Box {
|
func addGroup(b *ui.Box, name string) *ui.Box {
|
||||||
group := ui.NewGroup(name)
|
group := ui.NewGroup(name)
|
||||||
group.SetMargined(true)
|
group.SetMargined(true)
|
||||||
b.Append(group, true)
|
b.Append(group, Config.Stretchy)
|
||||||
|
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
|
@ -164,7 +164,7 @@ func addButton(box *ui.Box, name string) *ui.Button {
|
||||||
log.Println("Should do something here")
|
log.Println("Should do something here")
|
||||||
})
|
})
|
||||||
|
|
||||||
box.Append(button, false)
|
box.Append(button, Config.Stretchy)
|
||||||
return button
|
return button
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ func (n *Node) AddGroup(title string) *Node {
|
||||||
}
|
}
|
||||||
group := ui.NewGroup(title)
|
group := ui.NewGroup(title)
|
||||||
group.SetMargined(true)
|
group.SetMargined(true)
|
||||||
hbox.Append(group, true)
|
hbox.Append(group, Config.Stretchy)
|
||||||
|
|
||||||
vbox := ui.NewVerticalBox()
|
vbox := ui.NewVerticalBox()
|
||||||
vbox.SetPadded(true)
|
vbox.SetPadded(true)
|
||||||
|
@ -77,7 +77,7 @@ func (n *Node) MakeGroupEdit(title string) *Node {
|
||||||
|
|
||||||
group := ui.NewGroup(title)
|
group := ui.NewGroup(title)
|
||||||
group.SetMargined(true)
|
group.SetMargined(true)
|
||||||
n.uiBox.Append(group, true)
|
n.uiBox.Append(group, Config.Stretchy)
|
||||||
|
|
||||||
entrybox := ui.NewNonWrappingMultilineEntry()
|
entrybox := ui.NewNonWrappingMultilineEntry()
|
||||||
|
|
||||||
|
@ -89,22 +89,4 @@ func (n *Node) MakeGroupEdit(title string) *Node {
|
||||||
newNode.uiMultilineEntry = entrybox
|
newNode.uiMultilineEntry = entrybox
|
||||||
newNode.uiGroup = group
|
newNode.uiGroup = group
|
||||||
return newNode
|
return newNode
|
||||||
|
|
||||||
/*
|
|
||||||
panic("dump")
|
|
||||||
entryForm := ui.NewForm()
|
|
||||||
entryForm.SetPadded(true)
|
|
||||||
group.SetChild(entryForm)
|
|
||||||
|
|
||||||
entryForm.Append("Entry", ui.NewEntry(), false)
|
|
||||||
entryForm.Append("Password Entry", ui.NewPasswordEntry(), false)
|
|
||||||
entryForm.Append("Search Entry", ui.NewSearchEntry(), false)
|
|
||||||
entryForm.Append("Multiline Entry", ui.NewMultilineEntry(), true)
|
|
||||||
entryForm.Append("Multiline Entry No Wrap", ui.NewNonWrappingMultilineEntry(), true)
|
|
||||||
|
|
||||||
origbox.Append(vbox, false)
|
|
||||||
newNode := n.AddNode(title)
|
|
||||||
newNode.uiBox = vbox
|
|
||||||
*/
|
|
||||||
return n
|
|
||||||
}
|
}
|
||||||
|
|
1
entry.go
1
entry.go
|
@ -12,7 +12,6 @@ import _ "github.com/andlabs/ui/winmanifest"
|
||||||
|
|
||||||
func (n *Node) NewLabel(text string) *Node {
|
func (n *Node) NewLabel(text string) *Node {
|
||||||
// make new node here
|
// make new node here
|
||||||
// n.Append(ui.NewLabel(text), false)
|
|
||||||
newNode := n.makeNode(text, 333, 334)
|
newNode := n.makeNode(text, 333, 334)
|
||||||
newNode.Dump()
|
newNode.Dump()
|
||||||
|
|
||||||
|
|
1
gui.go
1
gui.go
|
@ -24,6 +24,7 @@ func init() {
|
||||||
Config.prefix = "wit"
|
Config.prefix = "wit"
|
||||||
Config.DebugNode = false
|
Config.DebugNode = false
|
||||||
Config.DebugTabs = false
|
Config.DebugTabs = false
|
||||||
|
Config.Stretchy = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func GuiInit() {
|
func GuiInit() {
|
||||||
|
|
|
@ -242,7 +242,7 @@ func (n *Node) AddHorizontalBreak() *Node {
|
||||||
log.Println("AddHorizontalBreak added to node =", n.Name)
|
log.Println("AddHorizontalBreak added to node =", n.Name)
|
||||||
if (n.uiBox != nil) {
|
if (n.uiBox != nil) {
|
||||||
tmp := ui.NewHorizontalSeparator()
|
tmp := ui.NewHorizontalSeparator()
|
||||||
n.uiBox.Append(tmp, false)
|
n.uiBox.Append(tmp, Config.Stretchy)
|
||||||
} else {
|
} else {
|
||||||
n.Dump()
|
n.Dump()
|
||||||
return nil
|
return nil
|
||||||
|
@ -254,7 +254,7 @@ func (n *Node) AddVerticalBreak() *Node {
|
||||||
log.Println("AddVerticalBreak added to node =", n.Name)
|
log.Println("AddVerticalBreak added to node =", n.Name)
|
||||||
if (n.uiBox != nil) {
|
if (n.uiBox != nil) {
|
||||||
tmp := ui.NewVerticalSeparator()
|
tmp := ui.NewVerticalSeparator()
|
||||||
n.uiBox.Append(tmp, false)
|
n.uiBox.Append(tmp, Config.Stretchy)
|
||||||
} else {
|
} else {
|
||||||
n.Dump()
|
n.Dump()
|
||||||
return nil
|
return nil
|
||||||
|
@ -267,7 +267,7 @@ func (n *Node) AddHorizontalBox(title string) *Node {
|
||||||
hbox.SetPadded(true)
|
hbox.SetPadded(true)
|
||||||
if (n.uiBox != nil) {
|
if (n.uiBox != nil) {
|
||||||
log.Println("add new hbox to uiBox =", n.uiBox)
|
log.Println("add new hbox to uiBox =", n.uiBox)
|
||||||
n.uiBox.Append(hbox, false)
|
n.uiBox.Append(hbox, Config.Stretchy)
|
||||||
newNode := n.makeNode(title, 333, 333 + Config.counter)
|
newNode := n.makeNode(title, 333, 333 + Config.counter)
|
||||||
newNode.parent = n
|
newNode.parent = n
|
||||||
newNode.uiBox = hbox
|
newNode.uiBox = hbox
|
||||||
|
|
|
@ -22,6 +22,7 @@ type GuiConfig struct {
|
||||||
Title string
|
Title string
|
||||||
Width int
|
Width int
|
||||||
Height int
|
Height int
|
||||||
|
Stretchy bool
|
||||||
Exit func(*Node)
|
Exit func(*Node)
|
||||||
|
|
||||||
Debug bool
|
Debug bool
|
||||||
|
|
Loading…
Reference in New Issue