Fix TopMenu
Add Shrinkwrap
This commit is contained in:
66
wdgt_shrinkwrap.go
Normal file
66
wdgt_shrinkwrap.go
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
Copyright © Brian Buller <brian@bullercodeworks.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
package widgets
|
||||
|
||||
import "github.com/gdamore/tcell"
|
||||
|
||||
// ShrinkWrap is a widget that limits the size of it's child
|
||||
type ShrinkWrap struct {
|
||||
widget Widget
|
||||
}
|
||||
|
||||
var _ Widget = (*ShrinkWrap)(nil)
|
||||
|
||||
func NewShrinkWrap(w Widget) *ShrinkWrap {
|
||||
ret := &ShrinkWrap{widget: w}
|
||||
return ret
|
||||
}
|
||||
|
||||
func (w *ShrinkWrap) Init(id string, st tcell.Style) { w.widget.Init(id, st) }
|
||||
func (w *ShrinkWrap) Id() string { return w.widget.Id() }
|
||||
func (w *ShrinkWrap) HandleResize(ev *tcell.EventResize) { w.widget.HandleResize(ev) }
|
||||
func (w *ShrinkWrap) HandleKey(ev *tcell.EventKey) bool { return w.widget.HandleKey(ev) }
|
||||
func (w *ShrinkWrap) HandleTime(ev *tcell.EventTime) { w.widget.HandleTime(ev) }
|
||||
func (w *ShrinkWrap) Draw(screen tcell.Screen) { w.widget.Draw(screen) }
|
||||
|
||||
func (w *ShrinkWrap) Active() bool { return w.widget.Active() }
|
||||
func (w *ShrinkWrap) SetActive(a bool) { w.widget.SetActive(a) }
|
||||
func (w *ShrinkWrap) Visible() bool { return w.widget.Visible() }
|
||||
func (w *ShrinkWrap) SetVisible(v bool) { w.widget.SetVisible(v) }
|
||||
func (w *ShrinkWrap) Focusable() bool { return w.widget.Focusable() }
|
||||
func (w *ShrinkWrap) Tabbable() bool { return w.widget.Tabbable() }
|
||||
func (w *ShrinkWrap) SetTabbable(t bool) { w.widget.SetTabbable(t) }
|
||||
func (w *ShrinkWrap) SetX(x int) { w.widget.SetX(x) }
|
||||
func (w *ShrinkWrap) SetY(y int) { w.widget.SetY(y) }
|
||||
func (w *ShrinkWrap) GetX() int { return w.widget.GetX() }
|
||||
func (w *ShrinkWrap) GetY() int { return w.widget.GetY() }
|
||||
func (w *ShrinkWrap) GetPos() Coord { return w.widget.GetPos() }
|
||||
func (w *ShrinkWrap) SetPos(pos Coord) { w.widget.SetPos(pos) }
|
||||
func (w *ShrinkWrap) SetSize(size Coord) { w.widget.SetSize(size) }
|
||||
func (w *ShrinkWrap) SetW(wd int) { w.widget.SetW(wd) }
|
||||
func (w *ShrinkWrap) SetH(h int) { w.widget.SetH(h) }
|
||||
func (w *ShrinkWrap) GetW() int { return w.widget.GetW() }
|
||||
func (w *ShrinkWrap) GetH() int { return w.widget.GetH() }
|
||||
func (w *ShrinkWrap) WantW() int { return w.widget.MinW() }
|
||||
func (w *ShrinkWrap) WantH() int { return w.widget.MinH() }
|
||||
func (w *ShrinkWrap) MinW() int { return w.widget.MinW() }
|
||||
func (w *ShrinkWrap) MinH() int { return w.widget.MinH() }
|
||||
Reference in New Issue
Block a user