Skip to content

Commit

Permalink
add NSTreeController
Browse files Browse the repository at this point in the history
  • Loading branch information
hsiafan committed Aug 21, 2023
1 parent 99ac660 commit 0ad0be7
Show file tree
Hide file tree
Showing 6 changed files with 1,072 additions and 0 deletions.
80 changes: 80 additions & 0 deletions appkit/controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// auto-generated code, do not modify
package appkit

import (
"unsafe"

"github.com/hsiafan/cocoa/objc"
)

var ControllerClass = _ControllerClass{objc.GetClass("NSController")}

type _ControllerClass struct {
objc.Class
}

type IController interface {
objc.IObject
ObjectDidBeginEditing(editor objc.IObject)
ObjectDidEndEditing(editor objc.IObject)
CommitEditing() bool
CommitEditingWithDelegate_DidCommitSelector_ContextInfo(delegate objc.IObject, didCommitSelector objc.Selector, contextInfo unsafe.Pointer)
DiscardEditing()
IsEditing() bool
}

type Controller struct {
objc.Object
}

func MakeController(ptr unsafe.Pointer) Controller {
return Controller{
Object: objc.MakeObject(ptr),
}
}

func (c_ Controller) Init() Controller {
rv := objc.CallMethod[Controller](c_, objc.GetSelector("init"))
return rv
}

func (cc _ControllerClass) Alloc() Controller {
rv := objc.CallMethod[Controller](cc, objc.GetSelector("alloc"))
return rv
}

func (cc _ControllerClass) New() Controller {
rv := objc.CallMethod[Controller](cc, objc.GetSelector("new"))
rv.Autorelease()
return rv
}

func NewController() Controller {
return ControllerClass.New()
}

func (c_ Controller) ObjectDidBeginEditing(editor objc.IObject) {
objc.CallMethod[objc.Void](c_, objc.GetSelector("objectDidBeginEditing:"), objc.ExtractPtr(editor))
}

func (c_ Controller) ObjectDidEndEditing(editor objc.IObject) {
objc.CallMethod[objc.Void](c_, objc.GetSelector("objectDidEndEditing:"), objc.ExtractPtr(editor))
}

func (c_ Controller) CommitEditing() bool {
rv := objc.CallMethod[bool](c_, objc.GetSelector("commitEditing"))
return rv
}

func (c_ Controller) CommitEditingWithDelegate_DidCommitSelector_ContextInfo(delegate objc.IObject, didCommitSelector objc.Selector, contextInfo unsafe.Pointer) {
objc.CallMethod[objc.Void](c_, objc.GetSelector("commitEditingWithDelegate:didCommitSelector:contextInfo:"), objc.ExtractPtr(delegate), didCommitSelector, contextInfo)
}

func (c_ Controller) DiscardEditing() {
objc.CallMethod[objc.Void](c_, objc.GetSelector("discardEditing"))
}

func (c_ Controller) IsEditing() bool {
rv := objc.CallMethod[bool](c_, objc.GetSelector("isEditing"))
return rv
}
200 changes: 200 additions & 0 deletions appkit/object_controller.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
// auto-generated code, do not modify
package appkit

import (
"unsafe"

"github.com/hsiafan/cocoa/foundation"
"github.com/hsiafan/cocoa/objc"
)

var ObjectControllerClass = _ObjectControllerClass{objc.GetClass("NSObjectController")}

type _ObjectControllerClass struct {
objc.Class
}

type IObjectController interface {
IController
PrepareContent()
NewObject() objc.Object
AddObject(object objc.IObject)
RemoveObject(object objc.IObject)
Add(sender objc.IObject)
Remove(sender objc.IObject)
Fetch(sender objc.IObject)
ValidateUserInterfaceItem(item objc.IObject) bool
Content() objc.Object
SetContent(value objc.IObject)
AutomaticallyPreparesContent() bool
SetAutomaticallyPreparesContent(value bool)
ObjectClass() objc.Class
SetObjectClass(value objc.IClass)
CanAdd() bool
CanRemove() bool
IsEditable() bool
SetEditable(value bool)
EntityName() string
SetEntityName(value string)
UsesLazyFetching() bool
SetUsesLazyFetching(value bool)
FetchPredicate() foundation.Predicate
SetFetchPredicate(value foundation.IPredicate)
SelectedObjects() []objc.Object
Selection() objc.Object
}

type ObjectController struct {
Controller
}

func MakeObjectController(ptr unsafe.Pointer) ObjectController {
return ObjectController{
Controller: MakeController(ptr),
}
}

func (o_ ObjectController) InitWithContent(content objc.IObject) ObjectController {
rv := objc.CallMethod[ObjectController](o_, objc.GetSelector("initWithContent:"), objc.ExtractPtr(content))
return rv
}

func (o_ ObjectController) Init() ObjectController {
rv := objc.CallMethod[ObjectController](o_, objc.GetSelector("init"))
return rv
}

func (oc _ObjectControllerClass) Alloc() ObjectController {
rv := objc.CallMethod[ObjectController](oc, objc.GetSelector("alloc"))
return rv
}

func (oc _ObjectControllerClass) New() ObjectController {
rv := objc.CallMethod[ObjectController](oc, objc.GetSelector("new"))
rv.Autorelease()
return rv
}

func NewObjectController() ObjectController {
return ObjectControllerClass.New()
}

func (o_ ObjectController) PrepareContent() {
objc.CallMethod[objc.Void](o_, objc.GetSelector("prepareContent"))
}

func (o_ ObjectController) NewObject() objc.Object {
rv := objc.CallMethod[objc.Object](o_, objc.GetSelector("newObject"))
rv.Autorelease()
return rv
}

func (o_ ObjectController) AddObject(object objc.IObject) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("addObject:"), objc.ExtractPtr(object))
}

func (o_ ObjectController) RemoveObject(object objc.IObject) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("removeObject:"), objc.ExtractPtr(object))
}

func (o_ ObjectController) Add(sender objc.IObject) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("add:"), objc.ExtractPtr(sender))
}

func (o_ ObjectController) Remove(sender objc.IObject) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("remove:"), objc.ExtractPtr(sender))
}

func (o_ ObjectController) Fetch(sender objc.IObject) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("fetch:"), objc.ExtractPtr(sender))
}

func (o_ ObjectController) ValidateUserInterfaceItem(item objc.IObject) bool {
rv := objc.CallMethod[bool](o_, objc.GetSelector("validateUserInterfaceItem:"), objc.ExtractPtr(item))
return rv
}

func (o_ ObjectController) Content() objc.Object {
rv := objc.CallMethod[objc.Object](o_, objc.GetSelector("content"))
return rv
}

func (o_ ObjectController) SetContent(value objc.IObject) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("setContent:"), objc.ExtractPtr(value))
}

func (o_ ObjectController) AutomaticallyPreparesContent() bool {
rv := objc.CallMethod[bool](o_, objc.GetSelector("automaticallyPreparesContent"))
return rv
}

func (o_ ObjectController) SetAutomaticallyPreparesContent(value bool) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("setAutomaticallyPreparesContent:"), value)
}

// weak property
func (o_ ObjectController) ObjectClass() objc.Class {
rv := objc.CallMethod[objc.Class](o_, objc.GetSelector("objectClass"))
return rv
}

// weak property
func (o_ ObjectController) SetObjectClass(value objc.IClass) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("setObjectClass:"), objc.ExtractPtr(value))
}

func (o_ ObjectController) CanAdd() bool {
rv := objc.CallMethod[bool](o_, objc.GetSelector("canAdd"))
return rv
}

func (o_ ObjectController) CanRemove() bool {
rv := objc.CallMethod[bool](o_, objc.GetSelector("canRemove"))
return rv
}

func (o_ ObjectController) IsEditable() bool {
rv := objc.CallMethod[bool](o_, objc.GetSelector("isEditable"))
return rv
}

func (o_ ObjectController) SetEditable(value bool) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("setEditable:"), value)
}

func (o_ ObjectController) EntityName() string {
rv := objc.CallMethod[string](o_, objc.GetSelector("entityName"))
return rv
}

func (o_ ObjectController) SetEntityName(value string) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("setEntityName:"), value)
}

func (o_ ObjectController) UsesLazyFetching() bool {
rv := objc.CallMethod[bool](o_, objc.GetSelector("usesLazyFetching"))
return rv
}

func (o_ ObjectController) SetUsesLazyFetching(value bool) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("setUsesLazyFetching:"), value)
}

func (o_ ObjectController) FetchPredicate() foundation.Predicate {
rv := objc.CallMethod[foundation.Predicate](o_, objc.GetSelector("fetchPredicate"))
return rv
}

func (o_ ObjectController) SetFetchPredicate(value foundation.IPredicate) {
objc.CallMethod[objc.Void](o_, objc.GetSelector("setFetchPredicate:"), objc.ExtractPtr(value))
}

func (o_ ObjectController) SelectedObjects() []objc.Object {
rv := objc.CallMethod[[]objc.Object](o_, objc.GetSelector("selectedObjects"))
return rv
}

func (o_ ObjectController) Selection() objc.Object {
rv := objc.CallMethod[objc.Object](o_, objc.GetSelector("selection"))
return rv
}
Loading

0 comments on commit 0ad0be7

Please sign in to comment.