Panel: inherit from baseComponent struct
This commit is contained in:
parent
70e32e0b5c
commit
e0079bbdb5
19
ui/panel.go
19
ui/panel.go
@ -34,11 +34,8 @@ type Panel struct {
|
|||||||
Right Component
|
Right Component
|
||||||
SplitAt int
|
SplitAt int
|
||||||
Kind PanelKind
|
Kind PanelKind
|
||||||
Focused bool
|
|
||||||
|
|
||||||
x, y int
|
baseComponent
|
||||||
width int
|
|
||||||
height int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateSplits uses the position and size of the Panel, along with its Weight
|
// 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.
|
// GetMinSize returns the combined minimum sizes of the Panel's children.
|
||||||
func (p *Panel) GetMinSize() (int, int) {
|
func (p *Panel) GetMinSize() (int, int) {
|
||||||
switch p.Kind {
|
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
|
// 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
|
// 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.
|
// Panel's SplitAt to be within the new size of the Panel.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user