Same as previous commit, but for showing and hiding containers on Windows.

This commit is contained in:
Pietro Gagliardi 2014-08-04 21:33:58 -04:00
parent 95815841aa
commit 12f7c691d3
2 changed files with 11 additions and 4 deletions

View File

@ -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)

View File

@ -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 {