Panel: inherit from baseComponent struct

This commit is contained in:
Luke I. Wilson 2021-04-08 18:39:06 -05:00
parent 70e32e0b5c
commit e0079bbdb5

View File

@ -34,11 +34,8 @@ type Panel struct {
Right Component
SplitAt int
Kind PanelKind
Focused bool
x, y int
width int
height int
baseComponent
}
// UpdateSplits uses the position and size of the Panel, along with its Weight
@ -159,16 +156,6 @@ func (p *Panel) SetTheme(theme *Theme) {
}
}
// GetPos returns the position of the panel.
func (p *Panel) GetPos() (int, int) {
return p.width, p.height
}
// SetPos sets the position of the panel.
func (p *Panel) SetPos(x, y int) {
p.x, p.y = x, y
}
// GetMinSize returns the combined minimum sizes of the Panel's children.
func (p *Panel) GetMinSize() (int, int) {
switch p.Kind {
@ -189,10 +176,6 @@ func (p *Panel) GetMinSize() (int, int) {
}
}
func (p *Panel) GetSize() (int, int) {
return p.width, p.height
}
// SetSize sets the Panel size to the given width, and height. It will not check
// against GetMinSize() because it may be costly to do so. SetSize clamps the
// Panel's SplitAt to be within the new size of the Panel.