blob: b2cf05b2ab9d512497593780edd2c5acb20a88e4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// 14 february 2014
//package ui
package main
import (
"sync"
)
// A Label is a static line of text used to mark other controls.
type Label struct {
lock sync.Mutex
created bool
sysData *sysData
initText string
}
// NewLabel creates a new Label with the specified text.
func NewLabel(text string) *Label {
return &Label{
sysData: mksysdata(c_label),
initText: text,
}
}
// TODO SetText()/Text()?
// TODO adorn error messages
func (l *Label) make(window *sysData) error {
l.lock.Lock()
defer l.lock.Unlock()
return l.sysData.make(l.initText, 300, 300, window)
}
func (l *Label) setRect(x int, y int, width int, height int) error {
l.lock.Lock()
defer l.lock.Unlock()
return l.sysData.setRect(x, y, width, height)
}
|