summaryrefslogtreecommitdiff
path: root/redo/containerctrls_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-01 23:36:13 -0400
committerPietro Gagliardi <[email protected]>2014-08-01 23:36:13 -0400
commit0356d0fd7046071c1320db7340a14df54c79cb0f (patch)
treea6a9f389090a7cb32b4b16818da8080e43ed2f43 /redo/containerctrls_windows.go
parente9b2f9f478750539ff9c76147b2d024e70fe958a (diff)
Migrated the Windows backend to use sizer.
Diffstat (limited to 'redo/containerctrls_windows.go')
-rw-r--r--redo/containerctrls_windows.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/redo/containerctrls_windows.go b/redo/containerctrls_windows.go
index e81c340..1aa2c57 100644
--- a/redo/containerctrls_windows.go
+++ b/redo/containerctrls_windows.go
@@ -19,7 +19,7 @@ TODO
type tab struct {
*controlbase
- tabs []*container
+ tabs []*sizer
supersetParent func(p *controlParent)
superallocate func(x int, y int, width int, height int, d *sizing) []*allocation
}
@@ -48,15 +48,15 @@ func (t *tab) tabsetParent(p *controlParent) {
}
func (t *tab) Append(name string, control Control) {
- c := new(container)
- t.tabs = append(t.tabs, c)
- c.child = control
+ s := new(sizer)
+ t.tabs = append(t.tabs, s)
+ s.child = control
if t.parent != nil {
- c.child.setParent(&controlParent{t.parent})
+ s.child.setParent(&controlParent{t.parent})
}
// initially hide tab 1..n controls; if we don't, they'll appear over other tabs, resulting in weird behavior
if len(t.tabs) != 1 {
- c.child.containerHide()
+ s.child.containerHide()
}
C.tabAppend(t.hwnd, toUTF16(name))
}
@@ -74,6 +74,7 @@ func tabChanged(data unsafe.Pointer, new C.LRESULT) {
}
// a tab control contains other controls; size appropriately
+// TODO change this to commitResize()
func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*allocation {
var r C.RECT
@@ -85,9 +86,9 @@ func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*all
C.tabGetContentRect(t.hwnd, &r)
// and allocate
// don't allocate to just the current tab; allocate to all tabs!
- for _, c := range t.tabs {
+ for _, s := range t.tabs {
// because each widget is actually a child of the Window, the origin is the one we calculated above
- c.resize(int(r.left), int(r.top), int(r.right - r.left), int(r.bottom - r.top))
+ s.resize(int(r.left), int(r.top), int(r.right - r.left), int(r.bottom - r.top))
}
// and now allocate the tab control itself
return t.superallocate(x, y, width, height, d)