78 lines
3.2 KiB
Go
78 lines
3.2 KiB
Go
/*
|
|
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"
|
|
|
|
// BlankWidget is just blank. It's a good placeholder, if needed.
|
|
type BlankWidget struct {
|
|
id string
|
|
x, y int
|
|
keyMap KeyMap
|
|
}
|
|
|
|
var _ Widget = (*BlankWidget)(nil)
|
|
|
|
func NewBlankWidget(id string) *BlankWidget {
|
|
ret := &BlankWidget{id: id}
|
|
return ret
|
|
}
|
|
|
|
func (w *BlankWidget) Init(id string, st tcell.Style) { w.keyMap = BlankKeyMap() }
|
|
func (w *BlankWidget) Id() string { return w.id }
|
|
func (w *BlankWidget) HandleResize(ev *tcell.EventResize) {}
|
|
func (w *BlankWidget) SetKeyMap(km KeyMap) { w.keyMap = km }
|
|
func (w *BlankWidget) AddToKeyMap(km KeyMap) { w.keyMap.Merge(km) }
|
|
func (w *BlankWidget) RemoveFromKeyMap(km KeyMap) {
|
|
for k := range km.Keys {
|
|
w.keyMap.Remove(k)
|
|
}
|
|
for r := range km.Runes {
|
|
w.keyMap.RemoveRune(r)
|
|
}
|
|
}
|
|
func (w *BlankWidget) HandleKey(ev *tcell.EventKey) bool { return false }
|
|
func (w *BlankWidget) HandleTime(ev *tcell.EventTime) {}
|
|
func (w *BlankWidget) Draw(screen tcell.Screen) {}
|
|
|
|
func (w *BlankWidget) Active() bool { return false }
|
|
func (w *BlankWidget) SetActive(a bool) {}
|
|
func (w *BlankWidget) Visible() bool { return true }
|
|
func (w *BlankWidget) SetVisible(v bool) {}
|
|
func (w *BlankWidget) Focusable() bool { return false }
|
|
func (w *BlankWidget) SetFocusable(t bool) {}
|
|
func (w *BlankWidget) SetX(x int) {}
|
|
func (w *BlankWidget) SetY(y int) {}
|
|
func (w *BlankWidget) GetX() int { return w.x }
|
|
func (w *BlankWidget) GetY() int { return w.y }
|
|
func (w *BlankWidget) GetPos() Coord { return Coord{X: w.x, Y: w.y} }
|
|
func (w *BlankWidget) SetPos(pos Coord) {}
|
|
func (w *BlankWidget) SetSize(size Coord) {}
|
|
func (w *BlankWidget) SetW(wd int) {}
|
|
func (w *BlankWidget) SetH(h int) {}
|
|
func (w *BlankWidget) GetW() int { return 0 }
|
|
func (w *BlankWidget) GetH() int { return 0 }
|
|
func (w *BlankWidget) WantW() int { return 0 }
|
|
func (w *BlankWidget) WantH() int { return 0 }
|
|
func (w *BlankWidget) MinW() int { return 0 }
|
|
func (w *BlankWidget) MinH() int { return 0 }
|