summaryrefslogtreecommitdiff
path: root/newctrl/tab_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-18 12:47:19 -0400
committerPietro Gagliardi <[email protected]>2014-10-18 12:47:19 -0400
commitb1ac28cc938d2de25357328d9da910a84a2cc8cc (patch)
treed34d26f0022dd0e9d9c7179bd59b1c4dbe7b6942 /newctrl/tab_windows.go
parent0f6e65188af0c4b1d3e4dff17ceb96bbd8ebb271 (diff)
Fixed parenting weirdnesses.
Diffstat (limited to 'newctrl/tab_windows.go')
-rw-r--r--newctrl/tab_windows.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/newctrl/tab_windows.go b/newctrl/tab_windows.go
index e3fe01e..7203166 100644
--- a/newctrl/tab_windows.go
+++ b/newctrl/tab_windows.go
@@ -17,8 +17,9 @@ We'll create a dummy window using the container window class for each tab page.
type tab struct {
*controlSingleHWND
- tabs []*container
- children []Control
+ tabs []*container
+ children []Control
+ chainresize func(x int, y int, width int, height int, d *sizing)
}
func newTab() Tab {
@@ -28,8 +29,9 @@ func newTab() Tab {
t := &tab{
controlSingleHWND: newControlSingleHWND(hwnd),
}
- t.fpreferredSize = t.preferredSize
- t.fresize = t.resize
+ t.fpreferredSize = t.xpreferredSize
+ t.chainresize = t.fresize
+ t.fresize = t.xresize
// count tabs as 1 tab stop; the actual number of tab stops varies
C.controlSetControlFont(t.hwnd)
C.setTabSubclass(t.hwnd, unsafe.Pointer(t))
@@ -74,7 +76,7 @@ func tabTabHasChildren(data unsafe.Pointer, which C.LRESULT) C.BOOL {
return C.FALSE
}
-func (t *tab) preferredSize(d *sizing) (width, height int) {
+func (t *tab) xpreferredSize(d *sizing) (width, height int) {
for _, c := range t.children {
w, h := c.preferredSize(d)
if width < w {
@@ -88,10 +90,9 @@ func (t *tab) preferredSize(d *sizing) (width, height int) {
}
// a tab control contains other controls; size appropriately
-func (t *tab) resize(x int, y int, width int, height int, d *sizing) {
+func (t *tab) xresize(x int, y int, width int, height int, d *sizing) {
// first, chain up to the container base to keep the Z-order correct
- // TODO use a variable for this
- t.controlSingleHWND.resize(x, y, width, height, d)
+ t.chainresize(x, y, width, height, d)
// now resize the children
var r C.RECT