summaryrefslogtreecommitdiff
path: root/label.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-14 15:12:03 -0500
committerPietro Gagliardi <[email protected]>2014-02-14 15:12:03 -0500
commit9070eae214fd8054bc888f61adbea7d6749dc71b (patch)
treebe3bedde74a97862c92db2bdbfb475948a279cf3 /label.go
parent681afdf0adfc42c64cf5dd898ec17988a31f9cb7 (diff)
Added labels.
Diffstat (limited to 'label.go')
-rw-r--r--label.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/label.go b/label.go
new file mode 100644
index 0000000..b2cf05b
--- /dev/null
+++ b/label.go
@@ -0,0 +1,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)
+}