// an up-down control will only properly position itself the first time // stupidly, there are no messages to force a size calculation, nor can I seem to reset the buddy window to force a new position // alas, we have to make a new up/down control each time :( // TODO we'll need to store a copy of the current position and range for this func (s *spinbox) remakeUpDown() { // destroying the previous one, setting the parent properly, and subclassing are handled here s.hwndUpDown = C.newUpDown(s.hwndUpDown, unsafe.Pointer(s)) // for this to work, hwndUpDown needs to have rect [0 0 0 0] C.moveWindow(s.hwndUpDown, 0, 0, 0, 0) C.SendMessageW(s.hwndUpDown, C.UDM_SETBUDDY, C.WPARAM(uintptr(unsafe.Pointer(s.hwndEdit))), 0) C.SendMessageW(s.hwndUpDown, C.UDM_SETRANGE32, C.WPARAM(s.min), C.LPARAM(s.max)) C.SendMessageW(s.hwndUpDown, C.UDM_SETPOS32, 0, C.LPARAM(s.value)) if s.updownVisible { C.ShowWindow(s.hwndUpDown, C.SW_SHOW) } }
func (c *controlSingleHWND) xresize(x int, y int, width int, height int, d *sizing) { C.moveWindow(c.hwnd, C.int(x), C.int(y), C.int(width), C.int(height)) }
func (s *spinbox) resize(x int, y int, width int, height int, d *sizing) { C.moveWindow(s.hwndEdit, C.int(x), C.int(y), C.int(width), C.int(height)) s.remakeUpDown() }
// 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)) }
func basecommitResize(c controlPrivate, a *allocation, d *sizing) { C.moveWindow(c.hwnd(), C.int(a.x), C.int(a.y), C.int(a.width), C.int(a.height)) }