initialize initializes this label and is normally used by other components which contain a label.
(msg string, font *text.Font)
| 53 | // initialize initializes this label and is normally used by other |
| 54 | // components which contain a label. |
| 55 | func (l *Label) initialize(msg string, font *text.Font) { |
| 56 | |
| 57 | l.font = font |
| 58 | l.Panel.Initialize(l, 0, 0) |
| 59 | l.Panel.mat.SetTransparent(true) |
| 60 | |
| 61 | // TODO: Remove this hack in an elegant way e.g. set the label style depending of if it's an icon or text label and have two defaults (one for icon labels one for text tabels) |
| 62 | if font != StyleDefault().FontIcon { |
| 63 | l.Panel.SetPaddings(2, 0, 2, 0) |
| 64 | } |
| 65 | |
| 66 | // Copy the style based on the default Label style |
| 67 | styleCopy := StyleDefault().Label |
| 68 | l.style = &styleCopy |
| 69 | |
| 70 | l.SetText(msg) |
| 71 | } |
| 72 | |
| 73 | // SetText sets and draws the label text using the font. |
| 74 | func (l *Label) SetText(text string) { |
no test coverage detected