Merged cases of C.moveWindow() on Windows containers to one place (container_windows.go) as a method on container.

This commit is contained in:
Pietro Gagliardi 2014-08-04 21:27:35 -04:00
parent 4606f5c2ee
commit 95815841aa
3 changed files with 7 additions and 5 deletions

View File

@ -52,6 +52,11 @@ func (c *container) setParent(p *controlParent) {
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
func storeContainerHWND(data unsafe.Pointer, hwnd C.HWND) {
c := (*container)(data)

View File

@ -106,9 +106,7 @@ func (t *tab) commitResize(c *allocation, d *sizing) {
// don't resize just the current tab; resize all tabs!
for _, c := range t.tabs {
// 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
// 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))
c.move(&r)
}
// and now resize the tab control itself
basecommitResize(t, c, d)

View File

@ -88,8 +88,7 @@ func storeWindowHWND(data unsafe.Pointer, hwnd C.HWND) {
func windowResize(data unsafe.Pointer, r *C.RECT) {
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
// TODO
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))
w.container.move(r)
}
//export windowClosing