// Bounds returns the outer bounding box Rectangle of the WidgetBase, including // decorations. // // The coordinates are relative to the parent of the Widget. func (wb *WidgetBase) Bounds() Rectangle { b := wb.WindowBase.Bounds() if wb.parent != nil { p := win.POINT{int32(b.X), int32(b.Y)} if !win.ScreenToClient(wb.parent.Handle(), &p) { newError("ScreenToClient failed") return Rectangle{} } b.X = int(p.X) b.Y = int(p.Y) } return b }
func (tw *TabWidget) resizePages() { var r win.RECT if !win.GetWindowRect(tw.hWndTab, &r) { lastError("GetWindowRect") return } p := win.POINT{ r.Left, r.Top, } if !win.ScreenToClient(tw.hWnd, &p) { newError("ScreenToClient failed") return } r = win.RECT{ p.X, p.Y, r.Right - r.Left + p.X, r.Bottom - r.Top + p.Y, } win.SendMessage(tw.hWndTab, win.TCM_ADJUSTRECT, 0, uintptr(unsafe.Pointer(&r))) for _, page := range tw.pages.items { if err := page.SetBounds( Rectangle{ int(r.Left - 2), int(r.Top), int(r.Right - r.Left + 2), int(r.Bottom - r.Top), }); err != nil { return } } }