summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-04 21:27:35 -0400
committerPietro Gagliardi <[email protected]>2014-08-04 21:27:35 -0400
commit95815841aa7574f5fd91d11795ceacaa4b7fa5fa (patch)
treea9569fc11ba893880861f797d5a546c7e46534a5
parent4606f5c2ee732b42140aab159f0a62605082517e (diff)
Merged cases of C.moveWindow() on Windows containers to one place (container_windows.go) as a method on container.
-rw-r--r--redo/container_windows.go5
-rw-r--r--redo/tab_windows.go4
-rw-r--r--redo/window_windows.go3
3 files changed, 7 insertions, 5 deletions
diff --git a/redo/container_windows.go b/redo/container_windows.go
index 06fbb5b..b79a79f 100644
--- a/redo/container_windows.go
+++ b/redo/container_windows.go
@@ -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)
diff --git a/redo/tab_windows.go b/redo/tab_windows.go
index 3456502..c16cdb4 100644
--- a/redo/tab_windows.go
+++ b/redo/tab_windows.go
@@ -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)
diff --git a/redo/window_windows.go b/redo/window_windows.go
index 2c391c8..3a551c2 100644
--- a/redo/window_windows.go
+++ b/redo/window_windows.go
@@ -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