Merged cases of C.moveWindow() on Windows containers to one place (container_windows.go) as a method on container.
This commit is contained in:
parent
4606f5c2ee
commit
95815841aa
|
@ -52,6 +52,11 @@ func (c *container) setParent(p *controlParent) {
|
||||||
C.controlSetParent(c.hwnd, p.hwnd)
|
C.controlSetParent(c.hwnd, p.hwnd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is needed because Windows won't move/resize a child window for us
|
||||||
|
func (c *container) move(r *C.RECT) {
|
||||||
|
C.moveWindow(c.hwnd, C.int(r.left), C.int(r.top), C.int(r.right - r.left), C.int(r.bottom - r.top))
|
||||||
|
}
|
||||||
|
|
||||||
//export storeContainerHWND
|
//export storeContainerHWND
|
||||||
func storeContainerHWND(data unsafe.Pointer, hwnd C.HWND) {
|
func storeContainerHWND(data unsafe.Pointer, hwnd C.HWND) {
|
||||||
c := (*container)(data)
|
c := (*container)(data)
|
||||||
|
|
|
@ -106,9 +106,7 @@ func (t *tab) commitResize(c *allocation, d *sizing) {
|
||||||
// don't resize just the current tab; resize all tabs!
|
// don't resize just the current tab; resize all tabs!
|
||||||
for _, c := range t.tabs {
|
for _, c := range t.tabs {
|
||||||
// because each widget is actually a child of the Window, the origin is the one we calculated above
|
// because each widget is actually a child of the Window, the origin is the one we calculated above
|
||||||
// we use moveWindow() rather than calling resize() directly
|
c.move(&r)
|
||||||
// TODO
|
|
||||||
C.moveWindow(c.hwnd, C.int(r.left), C.int(r.top), C.int(r.right - r.left), C.int(r.bottom - r.top))
|
|
||||||
}
|
}
|
||||||
// and now resize the tab control itself
|
// and now resize the tab control itself
|
||||||
basecommitResize(t, c, d)
|
basecommitResize(t, c, d)
|
||||||
|
|
|
@ -88,8 +88,7 @@ func storeWindowHWND(data unsafe.Pointer, hwnd C.HWND) {
|
||||||
func windowResize(data unsafe.Pointer, r *C.RECT) {
|
func windowResize(data unsafe.Pointer, r *C.RECT) {
|
||||||
w := (*window)(data)
|
w := (*window)(data)
|
||||||
// the origin of the window's content area is always (0, 0), but let's use the values from the RECT just to be safe
|
// the origin of the window's content area is always (0, 0), but let's use the values from the RECT just to be safe
|
||||||
// TODO
|
w.container.move(r)
|
||||||
C.moveWindow(w.container.hwnd, C.int(r.left), C.int(r.top), C.int(r.right - r.left), C.int(r.bottom - r.top))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//export windowClosing
|
//export windowClosing
|
||||||
|
|
Loading…
Reference in New Issue