From 12f7c691d310736e945cd77a943769fbcc5c0635 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 4 Aug 2014 21:33:58 -0400 Subject: [PATCH] Same as previous commit, but for showing and hiding containers on Windows. --- redo/container_windows.go | 8 ++++++++ redo/tab_windows.go | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/redo/container_windows.go b/redo/container_windows.go index b79a79f..b484094 100644 --- a/redo/container_windows.go +++ b/redo/container_windows.go @@ -57,6 +57,14 @@ 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)) } +func (c *container) show() { + C.ShowWindow(c.hwnd, C.SW_SHOW) +} + +func (c *container) hide() { + C.ShowWindow(c.hwnd, C.SW_HIDE) +} + //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 c16cdb4..4eb960d 100644 --- a/redo/tab_windows.go +++ b/redo/tab_windows.go @@ -44,8 +44,7 @@ func (t *tab) Append(name string, control Control) { } // initially hide tab 1..n controls; if we don't, they'll appear over other tabs, resulting in weird behavior if len(t.tabs) != 1 { - // TODO move these calls to container itself - C.ShowWindow(t.tabs[len(t.tabs) - 1].hwnd, C.SW_HIDE) + t.tabs[len(t.tabs) - 1].hide() } C.tabAppend(t._hwnd, toUTF16(name)) } @@ -53,13 +52,13 @@ func (t *tab) Append(name string, control Control) { //export tabChanging func tabChanging(data unsafe.Pointer, current C.LRESULT) { t := (*tab)(data) - C.ShowWindow(t.tabs[int(current)].hwnd, C.SW_HIDE) + t.tabs[int(current)].hide() } //export tabChanged func tabChanged(data unsafe.Pointer, new C.LRESULT) { t := (*tab)(data) - C.ShowWindow(t.tabs[int(new)].hwnd, C.SW_SHOW) + t.tabs[int(new)].show() } func (t *tab) hwnd() C.HWND {