2014-07-30 01:06:01 -05:00
|
|
|
// 30 july 2014
|
|
|
|
|
|
|
|
package ui
|
|
|
|
|
|
|
|
// #include "winapi_windows.h"
|
|
|
|
import "C"
|
|
|
|
|
2014-08-03 19:42:45 -05:00
|
|
|
type controlPrivate interface {
|
2014-08-03 20:52:21 -05:00
|
|
|
hwnd() C.HWND
|
2014-08-03 19:42:45 -05:00
|
|
|
Control
|
|
|
|
}
|
|
|
|
|
2014-07-30 01:06:01 -05:00
|
|
|
type controlParent struct {
|
2014-08-14 12:05:31 -05:00
|
|
|
c *container
|
2014-07-30 01:06:01 -05:00
|
|
|
}
|
|
|
|
|
2014-08-03 20:52:21 -05:00
|
|
|
func basesetParent(c controlPrivate, p *controlParent) {
|
2014-08-14 12:05:31 -05:00
|
|
|
C.controlSetParent(c.hwnd(), p.c.hwnd)
|
|
|
|
p.c.nchildren++
|
2014-08-03 08:18:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// don't specify basepreferredSize; it is custom on ALL controls
|
|
|
|
|
2014-08-03 20:52:21 -05:00
|
|
|
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))
|
2014-08-03 08:18:35 -05:00
|
|
|
}
|
|
|
|
|
2014-08-03 19:42:45 -05:00
|
|
|
func basegetAuxResizeInfo(c controlPrivate, d *sizing) {
|
2014-08-03 08:18:35 -05:00
|
|
|
// do nothing
|
|
|
|
}
|
|
|
|
|
2014-07-30 01:06:01 -05:00
|
|
|
// these are provided for convenience
|
|
|
|
|
2014-08-03 20:52:21 -05:00
|
|
|
type textableControl interface {
|
|
|
|
controlPrivate
|
|
|
|
textlen() C.LONG
|
|
|
|
settextlen(C.LONG)
|
|
|
|
}
|
|
|
|
|
|
|
|
func baseText(c textableControl) string {
|
|
|
|
return getWindowText(c.hwnd())
|
2014-07-30 01:06:01 -05:00
|
|
|
}
|
|
|
|
|
2014-08-03 20:52:21 -05:00
|
|
|
func baseSetText(c textableControl, text string) {
|
|
|
|
hwnd := c.hwnd()
|
2014-08-01 18:24:57 -05:00
|
|
|
t := toUTF16(text)
|
2014-08-03 20:52:21 -05:00
|
|
|
C.setWindowText(hwnd, t)
|
|
|
|
c.settextlen(C.controlTextLength(hwnd, t))
|
2014-07-30 01:06:01 -05:00
|
|
|
}
|