Cleaned up loose ends with the previous commit and got window close events working on Mac OS X. Woo!

This commit is contained in:
Pietro Gagliardi 2014-03-01 17:15:26 -05:00
parent 8b497b2188
commit 5caf0fe84a
3 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@ import (
This creates a class goAppDelegate that will be used as the delegate for /everything/. Specifically, it:
- runs uitask requests (uitask:)
- handles window close events (windowShouldClose:)
- handles window resize events (xxxx:)
- handles window resize events (windowDidResize: (TODO also windowDidEndLiveResize:?))
- handles button click events (buttonClick:)
*/
@ -82,7 +82,7 @@ func makeDelegateClass(name string) (C.Class, error) {
var (
delegate_void = []C.char{'v', '@', ':', '@', 0} // void (*)(id, SEL, id)
delegate_bool = []C.char{'#', '@', ':', '@', 0} // BOOL (*)(id, SEL, id)
delegate_bool = []C.char{'c', '@', ':', '@', 0} // BOOL (*)(id, SEL, id)
)
// according to errors spit out by cgo, C function pointers are unsafe.Pointer

View File

@ -65,12 +65,14 @@ var classTypes = [nctypes]*classData{
// we have to specify a content rect to start; it will be overridden soon though
win := objc_alloc(_NSWindow)
return objc_msgSend_rect_uint_uint_bool(win,
win = objc_msgSend_rect_uint_uint_bool(win,
_initWithContentRect,
0, 0, 100, 100,
NSTitledWindowMask | NSClosableWindowMask | NSClosableWindowMask | NSResizableWindowMask,
2, // NSBackingStoreBuffered - the only backing store method that Apple says we should use (the others are legacy)
C.BOOL(C.YES)) // defer creation of device until we show the window
objc_setDelegate(win, appDelegate)
return win
},
show: func(what C.id) {
C.objc_msgSend_id(what, _makeKeyAndOrderFront, what)

View File

@ -26,7 +26,7 @@ important things:
- ui.Go() should exit when the main() you pass in exits
- because the main event loop is not called if initialization fails, it is presently impossible for MsgBoxError() to work if UI initialization fails; this basically means we cannot allow initializiation to fail on Mac OS X if we want to be able to report UI init failures to the user with one
- Cocoa coordinates have (0,0) at the bottom left: need to fix this somehow
- Cocoa windows seem to ignore the minizeable flag and closing them always works (is the latter because I don't have a delegate yet?)
- Cocoa windows seem to ignore the minizeable flag and cannot be live-resized
- there's no GTK+ error handling whatsoever; we need to figure out how it works
- make sure GTK+ documentation point differences don't matter
- button sizes and LineEdit sizes on Windows seem too big; Comboboxes have margins