summaryrefslogtreecommitdiff
path: root/group_windows.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-10-27 10:41:10 -0400
committerPietro Gagliardi <[email protected]>2014-10-27 10:41:10 -0400
commitb6055d8a3557a589a6acc24741074459b9a4f811 (patch)
treefe7466eef4690309bc2b81447dd21d138a1c84bf /group_windows.go
parent1d53d4db1dab28efb2aa9c4bc8eee00a68e72766 (diff)
Fixed Group on Windows not sending events to children. I /think/ we're done with container madness on the Windows backend...
Diffstat (limited to 'group_windows.go')
-rw-r--r--group_windows.go25
1 files changed, 9 insertions, 16 deletions
diff --git a/group_windows.go b/group_windows.go
index 8666b99..18a3cc6 100644
--- a/group_windows.go
+++ b/group_windows.go
@@ -2,6 +2,10 @@
package ui
+import (
+ "unsafe"
+)
+
// #include "winapi_windows.h"
import "C"
@@ -9,7 +13,6 @@ type group struct {
*controlSingleHWNDWithText
child Control
margined bool
- chainresize func(x int, y int, width int, height int, d *sizing)
}
func newGroup(text string, control Control) Group {
@@ -21,11 +24,10 @@ func newGroup(text string, control Control) Group {
child: control,
}
g.fpreferredSize = g.xpreferredSize
- g.chainresize = g.fresize
- g.fresize = g.xresize
g.fnTabStops = control.nTabStops // groupbox itself is not tabbable but the contents might be
g.SetText(text)
C.controlSetControlFont(g.hwnd)
+ C.setGroupSubclass(g.hwnd, unsafe.Pointer(g))
control.setParent(&controlParent{g.hwnd})
return g
}
@@ -75,19 +77,10 @@ func (g *group) xpreferredSize(d *sizing) (width, height int) {
return int(r.right - r.left), int(r.bottom - r.top)
}
-func (g *group) xresize(x int, y int, width int, height int, d *sizing) {
- // first, chain up to the container base to keep the Z-order correct
- g.chainresize(x, y, width, height, d)
-
- // now resize the child container
- var r C.RECT
-
- // pretend that the client area of the group box only includes the actual empty space
- // container will handle the necessary adjustments properly
- r.left = 0
- r.top = 0
- r.right = C.LONG(width)
- r.bottom = C.LONG(height)
+//export groupResized
+func groupResized(data unsafe.Pointer, r C.RECT) {
+ g := (*group)(unsafe.Pointer(data))
+ d := beginResize(g.hwnd)
if g.margined {
// see above
marginRectDLU(&r, groupYMarginTop, groupYMarginBottom, groupXMargin, groupXMargin, d)