protobuf changes
This commit is contained in:
parent
3f09b2b6e4
commit
6b7fafbde2
16
place.go
16
place.go
|
@ -34,7 +34,7 @@ func (tk *guiWidget) Position() (int, int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *guiWidget) placeBox(startW int, startH int) {
|
func (w *guiWidget) placeBox(startW int, startH int) {
|
||||||
if w.node.WidgetType != widget.Box {
|
if w.WidgetType() != widget.Box {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
||||||
tk.startW = startW
|
tk.startW = startW
|
||||||
tk.startH = startH
|
tk.startH = startH
|
||||||
|
|
||||||
switch tk.node.WidgetType {
|
switch tk.WidgetType() {
|
||||||
case widget.Window:
|
case widget.Window:
|
||||||
tk.full.w0 = startW
|
tk.full.w0 = startW
|
||||||
tk.full.h0 = startH
|
tk.full.h0 = startH
|
||||||
|
@ -148,7 +148,7 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
||||||
// tk.color = nil
|
// tk.color = nil
|
||||||
// tk.defaultColor = nil
|
// tk.defaultColor = nil
|
||||||
/*
|
/*
|
||||||
if tk.node.IsEnabled() {
|
if tk.IsEnabled() {
|
||||||
tk.setColorButtonDense()
|
tk.setColorButtonDense()
|
||||||
} else {
|
} else {
|
||||||
tk.setColorDisable()
|
tk.setColorDisable()
|
||||||
|
@ -168,7 +168,7 @@ func (tk *guiWidget) placeWidgets(startW int, startH int) (int, int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tk *guiWidget) isWindowDense() bool {
|
func (tk *guiWidget) isWindowDense() bool {
|
||||||
if tk.node.WidgetType == widget.Window {
|
if tk.WidgetType() == widget.Window {
|
||||||
return tk.window.dense
|
return tk.window.dense
|
||||||
}
|
}
|
||||||
if tk.parent == nil {
|
if tk.parent == nil {
|
||||||
|
@ -178,7 +178,7 @@ func (tk *guiWidget) isWindowDense() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tk *guiWidget) isInGrid() bool {
|
func (tk *guiWidget) isInGrid() bool {
|
||||||
if tk.node.WidgetType == widget.Grid {
|
if tk.WidgetType() == widget.Grid {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if tk.parent == nil {
|
if tk.parent == nil {
|
||||||
|
@ -189,7 +189,7 @@ func (tk *guiWidget) isInGrid() bool {
|
||||||
|
|
||||||
func (w *guiWidget) placeGrid(startW int, startH int) (int, int) {
|
func (w *guiWidget) placeGrid(startW int, startH int) (int, int) {
|
||||||
// w.showWidgetPlacement("grid0:")
|
// w.showWidgetPlacement("grid0:")
|
||||||
if w.node.WidgetType != widget.Grid {
|
if w.WidgetType() != widget.Grid {
|
||||||
return 0, 0
|
return 0, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,8 +320,8 @@ func textSize(n *tree.Node) (int, int) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
func (tk *guiWidget) gocuiSetWH(sizeW, sizeH int) {
|
func (tk *guiWidget) gocuiSetWH(sizeW, sizeH int) {
|
||||||
w := len(tk.node.GetLabel())
|
w := len(tk.GetLabel())
|
||||||
lines := strings.Split(tk.node.GetLabel(), "\n")
|
lines := strings.Split(tk.GetLabel(), "\n")
|
||||||
h := len(lines)
|
h := len(lines)
|
||||||
|
|
||||||
if tk.Hidden() {
|
if tk.Hidden() {
|
||||||
|
|
|
@ -213,7 +213,7 @@ func (tk *guiWidget) Disable() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch tk.node.WidgetType {
|
switch tk.WidgetType() {
|
||||||
case widget.Box:
|
case widget.Box:
|
||||||
showDisable()
|
showDisable()
|
||||||
return
|
return
|
||||||
|
@ -231,7 +231,7 @@ func (tk *guiWidget) Enable() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
switch tk.node.WidgetType {
|
switch tk.WidgetType() {
|
||||||
case widget.Box:
|
case widget.Box:
|
||||||
hideDisable()
|
hideDisable()
|
||||||
return
|
return
|
||||||
|
|
20
treeDraw.go
20
treeDraw.go
|
@ -16,7 +16,7 @@ import (
|
||||||
// don't draw widgets that are too far down the window
|
// don't draw widgets that are too far down the window
|
||||||
func (tk *guiWidget) doNotDraw() bool {
|
func (tk *guiWidget) doNotDraw() bool {
|
||||||
var check bool
|
var check bool
|
||||||
switch tk.node.WidgetType {
|
switch tk.WidgetType() {
|
||||||
case widget.Button:
|
case widget.Button:
|
||||||
check = true
|
check = true
|
||||||
case widget.Label:
|
case widget.Label:
|
||||||
|
@ -46,7 +46,7 @@ func (tk *guiWidget) pageWidget() *rectType {
|
||||||
r := new(rectType)
|
r := new(rectType)
|
||||||
|
|
||||||
var check bool
|
var check bool
|
||||||
switch tk.node.WidgetType {
|
switch tk.WidgetType() {
|
||||||
case widget.Button:
|
case widget.Button:
|
||||||
check = true
|
check = true
|
||||||
case widget.Label:
|
case widget.Label:
|
||||||
|
@ -80,7 +80,7 @@ func (tk *guiWidget) pageWidget() *rectType {
|
||||||
// deletes the old view if it exists and recreates it
|
// deletes the old view if it exists and recreates it
|
||||||
func (tk *guiWidget) drawView() {
|
func (tk *guiWidget) drawView() {
|
||||||
var err error
|
var err error
|
||||||
log.Log(INFO, "drawView() START", tk.node.WidgetType, tk.String())
|
log.Log(INFO, "drawView() START", tk.WidgetType(), tk.String())
|
||||||
if me.baseGui == nil {
|
if me.baseGui == nil {
|
||||||
log.Log(ERROR, "drawView() ERROR: me.baseGui == nil", tk)
|
log.Log(ERROR, "drawView() ERROR: me.baseGui == nil", tk)
|
||||||
return
|
return
|
||||||
|
@ -88,7 +88,7 @@ func (tk *guiWidget) drawView() {
|
||||||
|
|
||||||
if tk.cuiName == "" {
|
if tk.cuiName == "" {
|
||||||
log.Log(ERROR, "drawView() tk.cuiName was not set for widget", tk)
|
log.Log(ERROR, "drawView() tk.cuiName was not set for widget", tk)
|
||||||
tk.cuiName = strconv.Itoa(tk.node.WidgetId) + " TK"
|
tk.cuiName = strconv.Itoa(tk.WidgetId()) + " TK"
|
||||||
}
|
}
|
||||||
log.Log(INFO, "drawView() labelN =", tk.labelN)
|
log.Log(INFO, "drawView() labelN =", tk.labelN)
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ func (tk *guiWidget) drawView() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if tk.node.WidgetType == widget.Window || tk.node.WidgetType == widget.Flag {
|
if tk.WidgetType() == widget.Window || tk.WidgetType() == widget.Flag {
|
||||||
if tk.window.pager != 0 {
|
if tk.window.pager != 0 {
|
||||||
if tk.gocuiSize.Height() > 40 {
|
if tk.gocuiSize.Height() > 40 {
|
||||||
tk.window.large = true
|
tk.window.large = true
|
||||||
|
@ -134,7 +134,7 @@ func (tk *guiWidget) drawView() {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// this is all terrible. This sets the title. kinda
|
// this is all terrible. This sets the title. kinda
|
||||||
if tk.node.WidgetType == widget.Window {
|
if tk.WidgetType() == widget.Window {
|
||||||
tk.textResize()
|
tk.textResize()
|
||||||
tk.full.w0 = tk.force.w0
|
tk.full.w0 = tk.force.w0
|
||||||
tk.full.h0 = tk.force.h0
|
tk.full.h0 = tk.force.h0
|
||||||
|
@ -175,16 +175,16 @@ func (tk *guiWidget) drawView() {
|
||||||
fmt.Fprint(tk.v, tk.labelN)
|
fmt.Fprint(tk.v, tk.labelN)
|
||||||
|
|
||||||
// tmp hack to disable buttons on window open
|
// tmp hack to disable buttons on window open
|
||||||
if tk.node.WidgetType == widget.Button {
|
if tk.WidgetType() == widget.Button {
|
||||||
if tk.node.IsEnabled() {
|
if tk.IsEnabled() {
|
||||||
} else {
|
} else {
|
||||||
tk.setColorDisable()
|
tk.setColorDisable()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch tk.node.WidgetType {
|
switch tk.WidgetType() {
|
||||||
case widget.Button:
|
case widget.Button:
|
||||||
if tk.node.IsEnabled() {
|
if tk.IsEnabled() {
|
||||||
if tk.isWindowDense() && tk.isInGrid() {
|
if tk.isWindowDense() && tk.isInGrid() {
|
||||||
tk.setColorButtonDense()
|
tk.setColorButtonDense()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -167,3 +167,7 @@ func (tk *guiWidget) WidgetId() int {
|
||||||
func (tk *guiWidget) GetLabel() string {
|
func (tk *guiWidget) GetLabel() string {
|
||||||
return tk.node.GetLabel()
|
return tk.node.GetLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (tk *guiWidget) IsEnabled() bool {
|
||||||
|
return tk.node.IsEnabled()
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue