Compare commits

...

1 Commits

Author SHA1 Message Date
1576891247 Update documentation. 2021-11-16 18:11:25 -05:00

View File

@ -606,18 +606,21 @@ frameworks: [ Foundation, AppKit, CoreGraphics ]
//go:generate nswrap
package main
//go:generate nswrap
package main
import (
"fmt"
"runtime"
"git.wow.st/gmp/nswrap/examples/app/ns" // point to your own NSWrap output directory
"ns" // point to your own NSWrap output directory
)
func didFinishLaunching(n *ns.NSNotification) {
func didFinishLaunching(self ns.AppDelegate, n *ns.NSNotification) {
fmt.Println("Go: did finish launching!")
}
func shouldTerminate(s *ns.NSApplication) ns.BOOL {
return 1
func shouldTerminate(self ns.AppDelegate, s *ns.NSApplication) ns.BOOL {
return true
}
var (
@ -629,7 +632,7 @@ var (
func main() {
runtime.LockOSThread()
a = ns.NSApplicationSharedApplication()
a.SetActivationPolicy(ns.NSApplicationActivationPolicyRegular)
a.SetActivationPolicy(ns.NSApplicationActivationPolicy(ns.NSApplicationActivationPolicyRegular))
del = ns.AppDelegateAlloc()
del.ApplicationDidFinishLaunchingCallback(didFinishLaunching)
del.ApplicationShouldTerminateAfterLastWindowClosedCallback(shouldTerminate)
@ -637,9 +640,9 @@ func main() {
win = ns.NSWindowAlloc().InitWithContentRectStyleMask(
ns.NSMakeRect(200,200,600,600),
ns.NSWindowStyleMaskTitled | ns.NSWindowStyleMaskClosable,
ns.NSBackingStoreBuffered,
0,
ns.NSWindowStyleMask(ns.NSWindowStyleMaskTitled | ns.NSWindowStyleMaskClosable),
ns.NSBackingStoreType(ns.NSBackingStoreBuffered),
false,
)
win.SetTitle(ns.NSStringWithGoString("Hi World"))
win.MakeKeyAndOrderFront(win)
@ -653,6 +656,8 @@ menus, visual format-based auto layout, and a custom button class.
## Subclasses
# NOTE: SUBCLASS FUNCTIONALITY IS CURRENTLY PARTIALLY BROKEN
NSWrap includes functionality to generate subclasses as specified in
`nswrap.yaml`.