Implemented window resize handling on Mac OS X. Now for actually setting child controls and resizing them.
This commit is contained in:
parent
c61666b6b4
commit
474436e9f6
|
@ -4,6 +4,7 @@ package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
"fmt"
|
||||||
)
|
)
|
||||||
|
|
||||||
// #include "objc_darwin.h"
|
// #include "objc_darwin.h"
|
||||||
|
@ -124,6 +125,12 @@ func windowClosing(xw unsafe.Pointer) C.BOOL {
|
||||||
return C.NO
|
return C.NO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//export windowResized
|
||||||
|
func windowResized(xw unsafe.Pointer, width C.uintptr_t, height C.uintptr_t) {
|
||||||
|
w := (*window)(unsafe.Pointer(xw))
|
||||||
|
_=w//TODO
|
||||||
|
fmt.Printf("new size %d x %d\n", width, height)
|
||||||
|
}
|
||||||
|
|
||||||
// TODO for testing
|
// TODO for testing
|
||||||
func newButton(string) *Request { return nil }
|
func newButton(string) *Request { return nil }
|
||||||
|
|
|
@ -20,6 +20,16 @@
|
||||||
return windowClosing(self->gowin);
|
return windowClosing(self->gowin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)windowDidResize:(NSNotification *)n
|
||||||
|
{
|
||||||
|
NSWindow *w;
|
||||||
|
NSRect r;
|
||||||
|
|
||||||
|
w = toNSWindow([n object]);
|
||||||
|
r = [[w contentView] frame];
|
||||||
|
windowResized(self->gowin, (uintptr_t) r.size.width, (uintptr_t) r.size.height);
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
id newWindow(intptr_t width, intptr_t height)
|
id newWindow(intptr_t width, intptr_t height)
|
||||||
|
|
Loading…
Reference in New Issue