Added an align method to label
This commit is contained in:
@@ -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 }
|
||||
|
||||
Reference in New Issue
Block a user