Implemented Area.Repaint() on Mac OS X.
This commit is contained in:
parent
0be1bf5caa
commit
2c305c8785
|
@ -35,6 +35,20 @@ func (a *area) SetSize(width, height int) {
|
||||||
C.moveControl(a._id, 0, 0, C.intptr_t(a.width), C.intptr_t(a.height))
|
C.moveControl(a._id, 0, 0, C.intptr_t(a.width), C.intptr_t(a.height))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *area) Repaint(r image.Rectangle) {
|
||||||
|
var s C.struct_xrect
|
||||||
|
|
||||||
|
r = image.Rect(0, 0, a.width, a.height).Intersect(r)
|
||||||
|
if r.Empty() {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
s.x = C.intptr_t(r.Min.X)
|
||||||
|
s.y = C.intptr_t(r.Min.Y)
|
||||||
|
s.width = C.intptr_t(r.Dx())
|
||||||
|
s.height = C.intptr_t(r.Dy())
|
||||||
|
C.areaRepaint(a._id, s)
|
||||||
|
}
|
||||||
|
|
||||||
func (a *area) RepaintAll() {
|
func (a *area) RepaintAll() {
|
||||||
C.areaRepaintAll(a._id)
|
C.areaRepaintAll(a._id)
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,6 +188,17 @@ uintptr_t keyCode(id e)
|
||||||
return (uintptr_t) ([toNSEvent(e) keyCode]);
|
return (uintptr_t) ([toNSEvent(e) keyCode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void areaRepaint(id view, struct xrect r)
|
||||||
|
{
|
||||||
|
NSRect s;
|
||||||
|
|
||||||
|
s.origin.x = (CGFloat) r.x;
|
||||||
|
s.origin.y = (CGFloat) r.y;
|
||||||
|
s.size.width = (CGFloat) r.width;
|
||||||
|
s.size.height = (CGFloat) r.height;
|
||||||
|
[toNSView(view) displayRect:s];
|
||||||
|
}
|
||||||
|
|
||||||
void areaRepaintAll(id view)
|
void areaRepaintAll(id view)
|
||||||
{
|
{
|
||||||
[toNSView(view) display];
|
[toNSView(view) display];
|
||||||
|
|
|
@ -125,6 +125,7 @@ extern intptr_t buttonNumber(id);
|
||||||
extern intptr_t clickCount(id);
|
extern intptr_t clickCount(id);
|
||||||
extern uintptr_t pressedMouseButtons(void);
|
extern uintptr_t pressedMouseButtons(void);
|
||||||
extern uintptr_t keyCode(id);
|
extern uintptr_t keyCode(id);
|
||||||
|
extern void areaRepaint(id, struct xrect);
|
||||||
extern void areaRepaintAll(id);
|
extern void areaRepaintAll(id);
|
||||||
|
|
||||||
/* common_darwin.m */
|
/* common_darwin.m */
|
||||||
|
|
Loading…
Reference in New Issue