Added sysData.setWindowSize(), which will simplify a few things in Window.Open() and Control.make().
This commit is contained in:
parent
0247935cbf
commit
32e70f6414
|
@ -48,6 +48,9 @@ func (c *cSysData) selectedIndices() ([]int, error) {
|
||||||
func (c *cSysData) selectedTexts() ([]string, error) {
|
func (c *cSysData) selectedTexts() ([]string, error) {
|
||||||
panic(runtime.GOOS + " sysData does not define selectedIndex()")
|
panic(runtime.GOOS + " sysData does not define selectedIndex()")
|
||||||
}
|
}
|
||||||
|
func (c *cSysData) setWindowSize(int, int) error {
|
||||||
|
panic(runtime.GOOS + " sysData does not define setWindowSize()")
|
||||||
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
c_window = iota
|
c_window = iota
|
||||||
|
|
|
@ -240,7 +240,7 @@ func (s *sysData) setRect(x int, y int, width int, height int) error {
|
||||||
}
|
}
|
||||||
r := <-ret
|
r := <-ret
|
||||||
if r.ret == 0 { // failure
|
if r.ret == 0 { // failure
|
||||||
return r.err
|
return fmt.Errorf("error setting window/control rect: %v", r.err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -437,3 +437,27 @@ func (s *sysData) selectedTexts() ([]string, error) {
|
||||||
}
|
}
|
||||||
return strings, nil
|
return strings, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *sysData) setWindowSize(width int, height int) error {
|
||||||
|
var rect _RECT
|
||||||
|
|
||||||
|
ret := make(chan uiret)
|
||||||
|
defer close(ret)
|
||||||
|
uitask <- &uimsg{
|
||||||
|
call: _getClientRect,
|
||||||
|
p: []uintptr{
|
||||||
|
uintptr(s.hwnd),
|
||||||
|
uintptr(unsafe.Pointer(&rect)),
|
||||||
|
},
|
||||||
|
ret: ret,
|
||||||
|
}
|
||||||
|
r := <-ret
|
||||||
|
if r.ret == 0 {
|
||||||
|
return fmt.Errorf("error getting upper-left of window for resize: %v", r.err)
|
||||||
|
}
|
||||||
|
err := s.setRect(int(rect.Left), int(rect.Top), width, height)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("error actually resizing window: %v", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue