Update documentation.

This commit is contained in:
Greg Pomerantz 2021-11-16 18:11:25 -05:00
parent e4f7e32887
commit c2113215e9

View File

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