Did some build fixes.
This commit is contained in:
parent
a6c0fbdb87
commit
e67ed84ad9
|
@ -0,0 +1,14 @@
|
||||||
|
// 16 december 2015
|
||||||
|
|
||||||
|
package ui
|
||||||
|
|
||||||
|
// #include "ui.h"
|
||||||
|
import "C"
|
||||||
|
|
||||||
|
// no need to lock this; only the GUI thread can access it
|
||||||
|
var areas = make(map[*C.uiArea]*Area)
|
||||||
|
|
||||||
|
// TODO.
|
||||||
|
type Area struct {
|
||||||
|
Control
|
||||||
|
}
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
|
// #include <stdlib.h>
|
||||||
// #include "ui.h"
|
// #include "ui.h"
|
||||||
// extern void doAreaHandlerDraw(uiAreaHandler *, uiArea *, uiAreaDrawParams *);
|
// extern void doAreaHandlerDraw(uiAreaHandler *, uiArea *, uiAreaDrawParams *);
|
||||||
// static inline uiAreaHandler *allocAreaHandler(void)
|
// static inline uiAreaHandler *allocAreaHandler(void)
|
||||||
|
@ -55,7 +56,7 @@ type AreaDrawParams struct {
|
||||||
VScrollPos int
|
VScrollPos int
|
||||||
}
|
}
|
||||||
|
|
||||||
// export doAreaHandlerDraw
|
//export doAreaHandlerDraw
|
||||||
func doAreaHandlerDraw(uah *C.uiAreaHandler, ua *C.uiArea, udp *C.uiAreaDrawParams) {
|
func doAreaHandlerDraw(uah *C.uiAreaHandler, ua *C.uiArea, udp *C.uiAreaDrawParams) {
|
||||||
ah := areahandlers[uah]
|
ah := areahandlers[uah]
|
||||||
a := areas[ua]
|
a := areas[ua]
|
||||||
|
|
27
draw.go
27
draw.go
|
@ -32,14 +32,35 @@ import "C"
|
||||||
// dp.Context.Clip(p)
|
// dp.Context.Clip(p)
|
||||||
// // ...
|
// // ...
|
||||||
// p.Free() // when done with the path
|
// p.Free() // when done with the path
|
||||||
|
//
|
||||||
|
// A Path also defines its fill mode. (This should ideally be a fill
|
||||||
|
// parameter, but some implementations prevent it.)
|
||||||
|
// TODO talk about fill modes
|
||||||
type Path struct {
|
type Path struct {
|
||||||
p *C.uiDrawPath
|
p *C.uiDrawPath
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPath creates a new Path.
|
// TODO
|
||||||
func NewPath() *Path {
|
type FillMode uint
|
||||||
|
const (
|
||||||
|
Winding FillMode = iota
|
||||||
|
Alternate
|
||||||
|
)
|
||||||
|
|
||||||
|
// NewPath creates a new Path with the given fill mode.
|
||||||
|
func NewPath(fillMode FillMode) *Path {
|
||||||
|
var fm C.uiDrawFillMode
|
||||||
|
|
||||||
|
switch fillMode {
|
||||||
|
case Winding:
|
||||||
|
fm = C.uiDrawFillModeWinding
|
||||||
|
case Alternate:
|
||||||
|
fm = C.uiDrawFillModeAlternate
|
||||||
|
default:
|
||||||
|
panic("invalid fill mode passed to ui.NewPath()")
|
||||||
|
}
|
||||||
return &Path{
|
return &Path{
|
||||||
p: C.uiDrawNewPath(),
|
p: C.uiDrawNewPath(fm),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue