Added an align method to label

This commit is contained in:
Sasha Koshka
2023-03-16 15:58:26 -04:00
parent b90ffeb4fd
commit 6258c77f86
2 changed files with 56 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ type Label struct {
*core.Core
core core.CoreControl
align textdraw.Align
wrap bool
text string
drawer textdraw.Drawer
@@ -121,6 +122,20 @@ func (element *Label) SetWrap (wrap bool) {
}
}
// SetAlign sets the alignment method of the label.
func (element *Label) SetAlign (align textdraw.Align) {
if align == element.align { return }
element.align = align
element.drawer.SetAlign(align)
element.updateMinimumSize()
if element.core.HasImage () {
element.draw()
element.core.DamageAll()
}
}
// SetTheme sets the element's theme.
func (element *Label) SetTheme (new theme.Theme) {
if new == element.theme.Theme { return }