gocui: code cleanups
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
d67c7b2635
commit
38c161f39e
|
@ -48,8 +48,12 @@ func (w *cuiWidget) addWidget() {
|
||||||
w.showView()
|
w.showView()
|
||||||
return
|
return
|
||||||
case toolkit.Tab:
|
case toolkit.Tab:
|
||||||
w.setTabWH()
|
UnsetCurrent(me.rootNode)
|
||||||
w.showView()
|
me.rootNode.hideWidgets()
|
||||||
|
w.isCurrent = true
|
||||||
|
w.parent.isCurrent = true
|
||||||
|
w.placeWidgets()
|
||||||
|
w.showWidgets()
|
||||||
return
|
return
|
||||||
case toolkit.Box:
|
case toolkit.Box:
|
||||||
w.isFake = true
|
w.isFake = true
|
||||||
|
|
|
@ -19,6 +19,27 @@ func UnsetCurrent(w *cuiWidget) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateCurrentTabs() {
|
||||||
|
me.rootNode.nextW = 0
|
||||||
|
me.rootNode.nextH = 0
|
||||||
|
me.rootNode.redoTabs(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// shows the widgets in a tab
|
||||||
|
func setCurrent(w *cuiWidget) {
|
||||||
|
if w.widgetType != toolkit.Tab {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
me.current = w
|
||||||
|
UnsetCurrent(me.rootNode)
|
||||||
|
me.rootNode.hideWidgets()
|
||||||
|
w.isCurrent = true
|
||||||
|
w.parent.isCurrent = true
|
||||||
|
updateCurrentTabs()
|
||||||
|
w.placeWidgets()
|
||||||
|
w.showWidgets()
|
||||||
|
}
|
||||||
|
|
||||||
func (w *cuiWidget) doWidgetClick() {
|
func (w *cuiWidget) doWidgetClick() {
|
||||||
switch w.widgetType {
|
switch w.widgetType {
|
||||||
case toolkit.Root:
|
case toolkit.Root:
|
||||||
|
@ -50,13 +71,7 @@ func (w *cuiWidget) doWidgetClick() {
|
||||||
w.showWidgets()
|
w.showWidgets()
|
||||||
// THIS IS THE BEGINING OF THE LAYOUT
|
// THIS IS THE BEGINING OF THE LAYOUT
|
||||||
case toolkit.Tab:
|
case toolkit.Tab:
|
||||||
UnsetCurrent(me.rootNode)
|
setCurrent(w)
|
||||||
|
|
||||||
me.rootNode.hideWidgets()
|
|
||||||
w.isCurrent = true
|
|
||||||
w.parent.isCurrent = true
|
|
||||||
w.placeWidgets()
|
|
||||||
w.showWidgets()
|
|
||||||
case toolkit.Group:
|
case toolkit.Group:
|
||||||
w.placeWidgets()
|
w.placeWidgets()
|
||||||
w.toggleTree()
|
w.toggleTree()
|
||||||
|
|
|
@ -24,6 +24,7 @@ type config struct {
|
||||||
baseGui *gocui.Gui // the main gocui handle
|
baseGui *gocui.Gui // the main gocui handle
|
||||||
rootNode *cuiWidget // the base of the binary tree. it should have id == 0
|
rootNode *cuiWidget // the base of the binary tree. it should have id == 0
|
||||||
ctrlDown *cuiWidget // shown if you click the mouse when the ctrl key is pressed
|
ctrlDown *cuiWidget // shown if you click the mouse when the ctrl key is pressed
|
||||||
|
current *cuiWidget // this is the current tab or window to show
|
||||||
|
|
||||||
// this is the channel we send user events like
|
// this is the channel we send user events like
|
||||||
// mouse clicks or keyboard events back to the program
|
// mouse clicks or keyboard events back to the program
|
||||||
|
|
Loading…
Reference in New Issue