summaryrefslogtreecommitdiff
path: root/redo/label_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-03 09:18:35 -0400
committerPietro Gagliardi <[email protected]>2014-08-03 09:18:35 -0400
commit1aea308645585f2fbc6c8b170381c811d562cc99 (patch)
tree1db721a972133a1ed0d9808eafabfbed66f6892f /redo/label_windows.go
parent585f5f5b62da3170d4398b39670d16811013d078 (diff)
Set up the Control restructure and migrated the Windows implementation over. Lots of repetition, but hopefully more correct and maintainable!
Diffstat (limited to 'redo/label_windows.go')
-rw-r--r--redo/label_windows.go32
1 files changed, 24 insertions, 8 deletions
diff --git a/redo/label_windows.go b/redo/label_windows.go
index e6b3e7f..516a14c 100644
--- a/redo/label_windows.go
+++ b/redo/label_windows.go
@@ -7,8 +7,7 @@ import "C"
type label struct {
*controlbase
- standalone bool
- supercommitResize func(c *allocation, d *sizing)
+ standalone bool
}
var labelclass = toUTF16("STATIC")
@@ -25,9 +24,6 @@ func finishNewLabel(text string, standalone bool) *label {
controlbase: c,
standalone: standalone,
}
- l.fpreferredSize = l.labelpreferredSize
- l.supercommitResize = l.fcommitResize
- l.fcommitResize = l.labelcommitResize
return l
}
@@ -47,6 +43,22 @@ func (l *label) SetText(text string) {
l.setText(text)
}
+func (l *label) setParent(p *controlParent) {
+ basesetParent(l.controlbase, p)
+}
+
+func (l *label) containerShow() {
+ basecontainerShow(l.controlbase)
+}
+
+func (l *label) containerHide() {
+ basecontainerHide(l.controlbase)
+}
+
+func (l *label) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
+ return baseallocate(l, x, y, width, height, d)
+}
+
const (
// via http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing
labelHeight = 8
@@ -54,15 +66,19 @@ const (
// TODO the label is offset slightly by default...
)
-func (l *label) labelpreferredSize(d *sizing) (width, height int) {
+func (l *label) preferredSize(d *sizing) (width, height int) {
return int(l.textlen), fromdlgunitsY(labelHeight, d)
}
-func (l *label) labelcommitResize(c *allocation, d *sizing) {
+func (l *label) commitResize(c *allocation, d *sizing) {
if !l.standalone {
yoff := fromdlgunitsY(labelYOffset, d)
c.y += yoff
c.height -= yoff
}
- l.supercommitResize(c, d)
+ basecommitResize(l.controlbase, c, d)
+}
+
+func (l *label) getAuxResizeInfo(d *sizing) {
+ basegetAuxResizeInfo(d)
}