summaryrefslogtreecommitdiff
path: root/redo/containerctrls_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-30 02:06:01 -0400
committerPietro Gagliardi <[email protected]>2014-07-30 02:06:01 -0400
commit210102fe95a72f32f9149fd674bb0c2190f14171 (patch)
treefad1fddb067ebc3705ff1ddba3c6f2673c03f36a /redo/containerctrls_windows.go
parent5a51263adc6d2e8ee7ea0dac4d92a66755c07cb1 (diff)
Set up a new, cleaner model for deriving Control's methods and applied it to the Windows backend.
Diffstat (limited to 'redo/containerctrls_windows.go')
-rw-r--r--redo/containerctrls_windows.go26
1 files changed, 16 insertions, 10 deletions
diff --git a/redo/containerctrls_windows.go b/redo/containerctrls_windows.go
index cc881e7..e81c340 100644
--- a/redo/containerctrls_windows.go
+++ b/redo/containerctrls_windows.go
@@ -18,24 +18,30 @@ TODO
*/
type tab struct {
- *widgetbase
- tabs []*container
+ *controlbase
+ tabs []*container
+ supersetParent func(p *controlParent)
+ superallocate func(x int, y int, width int, height int, d *sizing) []*allocation
}
func newTab() Tab {
- w := newWidget(C.xWC_TABCONTROL,
+ c := newControl(C.xWC_TABCONTROL,
C.TCS_TOOLTIPS | C.WS_TABSTOP,
0)
t := &tab{
- widgetbase: w,
+ controlbase: c,
}
- C.controlSetControlFont(w.hwnd)
- C.setTabSubclass(w.hwnd, unsafe.Pointer(t))
+ t.supersetParent = t.fsetParent
+ t.fsetParent = t.tabsetParent
+ t.superallocate = t.fallocate
+ t.fallocate = t.taballocate
+ C.controlSetControlFont(t.hwnd)
+ C.setTabSubclass(t.hwnd, unsafe.Pointer(t))
return t
}
-func (t *tab) setParent(p *controlParent) {
- t.widgetbase.setParent(p)
+func (t *tab) tabsetParent(p *controlParent) {
+ t.supersetParent(p)
for _, c := range t.tabs {
c.child.setParent(p)
}
@@ -68,7 +74,7 @@ func tabChanged(data unsafe.Pointer, new C.LRESULT) {
}
// a tab control contains other controls; size appropriately
-func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*allocation {
+func (t *tab) taballocate(x int, y int, width int, height int, d *sizing) []*allocation {
var r C.RECT
// figure out what the rect for each child is...
@@ -84,5 +90,5 @@ func (t *tab) allocate(x int, y int, width int, height int, d *sizing) []*alloca
c.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.widgetbase.allocate(x, y, width, height, d)
+ return t.superallocate(x, y, width, height, d)
}