1package cointop 2 3// Size returns window width and height 4func (ct *Cointop) size() (int, int) { 5 ct.debuglog("size()") 6 if ct.g == nil { 7 return 0, 0 8 } 9 10 return ct.g.Size() 11} 12 13// Width returns window width 14func (ct *Cointop) width() int { 15 ct.debuglog("width()") 16 w, _ := ct.size() 17 return w 18} 19 20// Height returns window height 21func (ct *Cointop) height() int { 22 ct.debuglog("height()") 23 _, h := ct.size() 24 return h 25} 26 27// viewWidth returns view width 28func (ct *Cointop) viewWidth(view string) int { 29 ct.debuglog("viewWidth()") 30 v, err := ct.g.View(view) 31 if err != nil { 32 return 0 33 } 34 w, _ := v.Size() 35 return w 36} 37 38// ClampedWidth returns the clamped width 39func (ct *Cointop) ClampedWidth() int { 40 ct.debuglog("clampedWidth()") 41 w := ct.width() 42 if w > ct.maxTableWidth { 43 return ct.maxTableWidth 44 } 45 46 return w 47} 48