Documentation ¶
Index ¶
- Constants
- Variables
- func NSEvent_GlobalMonitorMatchingMask(mask uint64, ch chan NSEvent)
- type NSApplication
- func (app NSApplication) ActivateIgnoringOtherApps(flag bool)
- func (app NSApplication) Delegate() objc.Object
- func (app NSApplication) MainMenu() NSMenu
- func (app NSApplication) Run()
- func (app NSApplication) SetActivationPolicy(policy int)
- func (app NSApplication) SetDelegate(delegate objc.Object)
- func (app NSApplication) SetMainMenu(menu NSMenu)
- func (app NSApplication) Terminate()
- type NSBackingStoreType
- type NSBundle
- type NSColor
- type NSEvent
- type NSFont
- type NSImage
- type NSImageView
- type NSLayoutManager
- type NSMenu
- type NSMenuItem
- func (i NSMenuItem) Action() objc.Selector
- func (i NSMenuItem) Enabled() bool
- func (i NSMenuItem) Hidden() bool
- func (i NSMenuItem) Image() NSImage
- func (i NSMenuItem) SetAction(sel objc.Selector)
- func (i NSMenuItem) SetEnabled(b bool)
- func (i NSMenuItem) SetHidden(b bool)
- func (i NSMenuItem) SetImage(obj NSImage)
- func (i NSMenuItem) SetState(state int)
- func (i NSMenuItem) SetSubmenu(submenu NSMenu)
- func (i NSMenuItem) SetTarget(obj objc.Object)
- func (i NSMenuItem) SetTitle(s string)
- func (i NSMenuItem) SetToolTip(s string)
- func (i NSMenuItem) State() int64
- func (i NSMenuItem) Submenu() NSMenu
- func (i NSMenuItem) Target() objc.Object
- func (i NSMenuItem) Title() string
- func (i NSMenuItem) ToolTip() string
- type NSNib
- type NSPasteboard
- func (pb NSPasteboard) AvailableTypeFromArray(types []NSPasteboardType) NSPasteboardType
- func (pb NSPasteboard) ClearContents()
- func (pb NSPasteboard) DataForType(t NSPasteboardType) core.NSData
- func (pb NSPasteboard) SetStringForType(s string, t NSPasteboardType)
- func (pb NSPasteboard) StringForType(t NSPasteboardType) string
- func (pb NSPasteboard) Types() []NSPasteboardType
- type NSPasteboardType
- type NSScreen
- type NSStatusBar
- type NSStatusBarButton
- func (b NSStatusBarButton) Image() NSImage
- func (b NSStatusBarButton) ImagePosition() int64
- func (b NSStatusBarButton) SetImage(obj NSImage)
- func (b NSStatusBarButton) SetImagePosition(state int)
- func (b NSStatusBarButton) SetTitle(s string)
- func (b NSStatusBarButton) SetToolTip(s string)
- func (b NSStatusBarButton) Title() string
- func (b NSStatusBarButton) ToolTip() string
- type NSStatusItem
- func (i NSStatusItem) Action() objc.Selector
- func (i NSStatusItem) Button() NSStatusBarButton
- func (i NSStatusItem) Menu() NSMenu
- func (i NSStatusItem) SetAction(sel objc.Selector)
- func (i NSStatusItem) SetMenu(menu NSMenu)
- func (i NSStatusItem) SetTarget(obj objc.Object)
- func (i NSStatusItem) Target() objc.Object
- type NSTextAlignment
- type NSTextContainer
- type NSTextView
- func (v NSTextView) Alignment() NSTextAlignment
- func (v NSTextView) DrawsBackground() bool
- func (v NSTextView) Editable() bool
- func (v NSTextView) FieldEditor() bool
- func (v NSTextView) Font() NSFont
- func (v NSTextView) ImportsGraphics() bool
- func (v NSTextView) LayoutManager() NSLayoutManager
- func (v NSTextView) RichText() bool
- func (v NSTextView) Selectable() bool
- func (v NSTextView) SetAlignment(d NSTextAlignment)
- func (v NSTextView) SetDrawsBackground(b bool)
- func (v NSTextView) SetEditable(b bool)
- func (v NSTextView) SetFieldEditor(b bool)
- func (v NSTextView) SetFont(f NSFont)
- func (v NSTextView) SetImportsGraphics(b bool)
- func (v NSTextView) SetLayoutManager(lm NSLayoutManager)
- func (v NSTextView) SetRichText(b bool)
- func (v NSTextView) SetSelectable(b bool)
- func (v NSTextView) SetString(s string)
- func (v NSTextView) SetTextContainer(tc NSTextContainer)
- func (v NSTextView) String() string
- func (v NSTextView) TextContainer() NSTextContainer
- type NSView
- func (v NSView) AddSubviewPositionedRelativeTo(subview objc.Object, positioned int, relativeTo objc.Object)
- func (v NSView) BackgroundColor() NSColor
- func (v NSView) Bounds() (frame core.NSRect)
- func (v NSView) Frame() (frame core.NSRect)
- func (v NSView) Layer() core.CALayer
- func (v NSView) Opaque() bool
- func (v NSView) SetBackgroundColor(color NSColor)
- func (v NSView) SetBoundsOrigin(p core.NSPoint)
- func (v NSView) SetBoundsSize(s core.NSSize)
- func (v NSView) SetFrameOrigin(p core.NSPoint)
- func (v NSView) SetFrameSize(s core.NSSize)
- func (v NSView) SetOpaque(b bool)
- func (v NSView) SetValueForKey(value, key objc.Object)
- func (v NSView) SetWantsLayer(b bool)
- func (v NSView) WantsLayer() bool
- type NSVisualEffectView
- type NSWindow
- func (w NSWindow) BackgroundColor() NSColor
- func (w NSWindow) Center()
- func (w NSWindow) Close()
- func (w NSWindow) CollectionBehavior() int64
- func (w NSWindow) ContentRectForFrameRect(frameRect core.NSRect) (rect core.NSRect)
- func (w NSWindow) ContentView() NSView
- func (w NSWindow) Display()
- func (w NSWindow) Frame() (frame core.NSRect)
- func (w NSWindow) HasShadow() bool
- func (w NSWindow) IgnoresMouseEvents() bool
- func (w NSWindow) IsVisible() bool
- func (w NSWindow) Level() int64
- func (w NSWindow) MakeKeyAndOrderFront(sender objc.Object)
- func (w NSWindow) MovableByWindowBackground() bool
- func (w NSWindow) Opaque() bool
- func (w NSWindow) OrderBack(sender objc.Object)
- func (w NSWindow) OrderFront(sender objc.Object)
- func (w NSWindow) OrderOut(sender objc.Object)
- func (w NSWindow) SetBackgroundColor(color NSColor)
- func (w NSWindow) SetCollectionBehavior(collectionBehavior int)
- func (w NSWindow) SetContentView(view objc.Object)
- func (w NSWindow) SetFrameDisplay(frame core.NSRect, display bool)
- func (w NSWindow) SetHasShadow(b bool)
- func (w NSWindow) SetIgnoresMouseEvents(b bool)
- func (w NSWindow) SetLevel(level int)
- func (w NSWindow) SetMovableByWindowBackground(b bool)
- func (w NSWindow) SetOpaque(b bool)
- func (w NSWindow) SetStyleMask(mask int)
- func (w NSWindow) SetTitle(title string)
- func (w NSWindow) SetTitleVisibility(v int)
- func (w NSWindow) SetTitlebarAppearsTransparent(b bool)
- func (w NSWindow) StyleMask() int64
- func (w NSWindow) Title() string
- func (w NSWindow) TitleVisibility() int64
- func (w NSWindow) TitlebarAppearsTransparent() bool
- func (w NSWindow) ToggleFullScreen(s objc.Object)
Examples ¶
Constants ¶
const ( NSApplicationActivationPolicyRegular = 0 NSApplicationActivationPolicyAccessory = 1 NSApplicationActivationPolicyProhibited = 2 )
const ( NSControlStateValueMixed = -1 NSControlStateValueOff = 0 NSControlStateValueOn = 1 NSNoImage = 0 NSImageOnly = 1 NSImageLeft = 2 NSImageRight = 3 NSImageBelow = 4 NSImageAbove = 5 NSImageOverlaps = 6 )
const ( NSEventTypeLeftMouseDown = 1 NSEventTypeLeftMouseUp = 2 NSEventTypeRightMouseDown = 3 NSEventTypeRightMouseUp = 4 NSEventTypeMouseMoved = 5 NSEventTypeLeftMouseDragged = 6 NSEventTypeRightMouseDragged = 7 NSEventTypeMouseEntered = 8 NSEventTypeMouseExited = 9 NSEventTypeKeyDown = 10 NSEventTypeKeyUp = 11 NSEventTypeFlagsChanged = 12 NSEventTypeAppKitDefined = 13 NSEventTypeSystemDefined = 14 NSEventTypeApplicationDefined = 15 NSEventTypePeriodic = 16 NSEventTypeCursorUpdate = 17 NSEventTypeRotate = 18 NSEventTypeBeginGesture = 19 NSEventTypeEndGesture = 20 NSEventTypeScrollWheel = 22 NSEventTypeTabletPoint = 23 NSEventTypeTabletProximity = 24 NSEventTypeOtherMouseDown = 25 NSEventTypeOtherMouseUp = 26 NSEventTypeOtherMouseDragged = 27 NSEventTypeGesture = 29 NSEventTypeMagnify = 30 NSEventTypeSwipe = 31 NSEventTypeSmartMagnify = 32 NSEventTypeQuickLook = 33 NSEventTypePressure = 34 NSEventTypeDirectTouch = 37 NSEventTypeChangeMode = 38 NSEventMaskLeftMouseDown uint64 = 1 << NSEventTypeLeftMouseDown NSEventMaskLeftMouseUp uint64 = 1 << NSEventTypeLeftMouseUp NSEventMaskRightMouseDown uint64 = 1 << NSEventTypeRightMouseDown NSEventMaskRightMouseUp uint64 = 1 << NSEventTypeRightMouseUp NSEventMaskMouseMoved uint64 = 1 << NSEventTypeMouseMoved NSEventMaskLeftMouseDragged uint64 = 1 << NSEventTypeLeftMouseDragged NSEventMaskRightMouseDragged uint64 = 1 << NSEventTypeRightMouseDragged NSEventMaskMouseEntered uint64 = 1 << NSEventTypeMouseEntered NSEventMaskMouseExited uint64 = 1 << NSEventTypeMouseExited NSEventMaskKeyDown uint64 = 1 << NSEventTypeKeyDown NSEventMaskKeyUp uint64 = 1 << NSEventTypeKeyUp NSEventMaskFlagsChanged uint64 = 1 << NSEventTypeFlagsChanged NSEventMaskAppKitDefined uint64 = 1 << NSEventTypeAppKitDefined NSEventMaskSystemDefined uint64 = 1 << NSEventTypeSystemDefined NSEventMaskApplicationDefined uint64 = 1 << NSEventTypeApplicationDefined NSEventMaskPeriodic uint64 = 1 << NSEventTypePeriodic NSEventMaskCursorUpdate uint64 = 1 << NSEventTypeCursorUpdate NSEventMaskRotate uint64 = 1 << NSEventTypeRotate NSEventMaskBeginGesture uint64 = 1 << NSEventTypeBeginGesture NSEventMaskEndGesture uint64 = 1 << NSEventTypeEndGesture NSEventMaskScrollWheel uint64 = 1 << NSEventTypeScrollWheel NSEventMaskTabletPoint uint64 = 1 << NSEventTypeTabletPoint NSEventMaskTabletProximity uint64 = 1 << NSEventTypeTabletProximity NSEventMaskOtherMouseDown uint64 = 1 << NSEventTypeOtherMouseDown NSEventMaskOtherMouseUp uint64 = 1 << NSEventTypeOtherMouseUp NSEventMaskOtherMouseDragged uint64 = 1 << NSEventTypeOtherMouseDragged NSEventMaskGesture uint64 = 1 << NSEventTypeGesture NSEventMaskMagnify uint64 = 1 << NSEventTypeMagnify NSEventMaskSwipe uint64 = 1 << NSEventTypeSwipe NSEventMaskSmartMagnify uint64 = 1 << NSEventTypeSmartMagnify NSEventMaskQuickLook uint64 = 1 << NSEventTypeQuickLook NSEventMaskPressure uint64 = 1 << NSEventTypePressure NSEventMaskDirectTouch uint64 = 1 << NSEventTypeDirectTouch NSEventMaskChangeMode uint64 = 1 << NSEventTypeChangeMode NSEventMaskAny uint64 = 18446744073709551615 )
const ( // NSPasteboardTypeURL holds URL data for one file or resource. NSPasteboardTypeURL = NSPasteboardType("public.url") // NSPasteboardTypeColor holds color data. NSPasteboardTypeColor = NSPasteboardType("com.apple.cocoa.pasteboard.color") // NSPasteboardTypeFileURL holds a file URL. NSPasteboardTypeFileURL = NSPasteboardType("public.file-url") // NSPasteboardTypeFont holds font and character information. NSPasteboardTypeFont = NSPasteboardType("com.apple.cocoa.pasteboard.character-formatting") // NSPasteboardTypeHTML holds type for HTML content. NSPasteboardTypeHTML = NSPasteboardType("public.html") // NSPasteboardTypeMultipleTextSelection holds multiple text selection. NSPasteboardTypeMultipleTextSelection = NSPasteboardType("com.apple.cocoa.pasteboard.multiple-text-selection") // NSPasteboardTypePDF holds PDF data. NSPasteboardTypePDF = NSPasteboardType("com.adobe.pdf") // NSPasteboardTypePNG holds PNG image data. NSPasteboardTypePNG = NSPasteboardType("public.png") // NSPasteboardTypeRTF holds rich Text Format (RTF) data. NSPasteboardTypeRTF = NSPasteboardType("public.rtf") // NSPasteboardTypeRTFD holds RTFD formatted file contents. NSPasteboardTypeRTFD = NSPasteboardType("com.apple.flat-rtfd") // NSPasteboardTypeRuler holds paragraph formatting information. NSPasteboardTypeRuler = NSPasteboardType("com.apple.cocoa.pasteboard.paragraph-formatting") // NSPasteboardTypeSound holds sound data. NSPasteboardTypeSound = NSPasteboardType("com.apple.cocoa.pasteboard.sound") // NSPasteboardTypeString holds string data. NSPasteboardTypeString = NSPasteboardType("public.utf8-plain-text") // NSPasteboardTypeTabularText holds tab-separated fields of text. NSPasteboardTypeTabularText = NSPasteboardType("public.utf8-tab-separated-values-text") // NSPasteboardTypeTextFinderOptions holds type for the Find panel metadata property list. NSPasteboardTypeTextFinderOptions = NSPasteboardType("com.apple.cocoa.pasteboard.find-panel-search-options") // NSPasteboardTypeTIFF holds tag Image File Format (TIFF) data. NSPasteboardTypeTIFF = NSPasteboardType("public.tiff") )
const ( NSVariableStatusItemLength = -1.0 NSSquareStatusItemLength = -2.0 )
const ( NSVisualEffectBlendingModeBehindWindow = 0 NSVisualEffectBlendingModeWithinWindow = 1 )
const ( NSBorderlessWindowMask = 0 NSTitledWindowMask = 1 << 0 NSClosableWindowMask = 1 << 1 NSMiniaturizableWindowMask = 1 << 2 NSResizableWindowMask = 1 << 3 NSTexturedBackgroundWindowMask = 1 << 8 NSWindowStyleMaskFullScreen = 1 << 14 NSFullSizeContentViewWindowMask = 32768 NSWindowTitleVisible = 0 NSWindowTitleHidden = 1 NSWindowAbove = 1 NSWindowBelow = -1 NSWindowOut = 0 NSBackingStoreRetained NSBackingStoreType = 0 NSBackingStoreNonretained NSBackingStoreType = 1 NSBackingStoreBuffered NSBackingStoreType = 2 NSFloatingWindowLevel = 3 NSMainMenuWindowLevel = 24 NSWindowCollectionBehaviorDefault = 0 NSWindowCollectionBehaviorCanJoinAllSpaces = 1 << 0 NSWindowCollectionBehaviorMoveToActiveSpace = 1 << 1 NSWindowCollectionBehaviorManaged = 1 << 2 NSWindowCollectionBehaviorTransient = 1 << 3 NSWindowCollectionBehaviorStationary = 1 << 4 NSWindowCollectionBehaviorParticipatesInCycle = 1 << 5 NSWindowCollectionBehaviorIgnoresCycle = 1 << 6 NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7 NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8 NSWindowCollectionBehaviorFullScreenNone = 1 << 9 NSWindowCollectionBehaviorFullScreenAllowsTiling = 1 << 11 NSWindowCollectionBehaviorFullScreenDisallowsTiling = 1 << 12 )
Variables ¶
Functions ¶
Types ¶
type NSApplication ¶
func NSApp ¶
func NSApp() NSApplication
func NSApp_WithDidLaunch ¶
func NSApp_WithDidLaunch(cb func(notification objc.Object)) NSApplication
func NSApplication_New ¶
func NSApplication_New() NSApplication
func (NSApplication) ActivateIgnoringOtherApps ¶
func (app NSApplication) ActivateIgnoringOtherApps(flag bool)
func (NSApplication) Delegate ¶
func (app NSApplication) Delegate() objc.Object
func (NSApplication) MainMenu ¶
func (app NSApplication) MainMenu() NSMenu
func (NSApplication) Run ¶
func (app NSApplication) Run()
func (NSApplication) SetActivationPolicy ¶
func (app NSApplication) SetActivationPolicy(policy int)
func (NSApplication) SetDelegate ¶
func (app NSApplication) SetDelegate(delegate objc.Object)
func (NSApplication) SetMainMenu ¶
func (app NSApplication) SetMainMenu(menu NSMenu)
func (NSApplication) Terminate ¶
func (app NSApplication) Terminate()
type NSBackingStoreType ¶
type NSBackingStoreType uintptr
type NSBundle ¶
func NSBundle_Main ¶
func NSBundle_Main() NSBundle
func (NSBundle) InfoDictionary ¶
func (bundle NSBundle) InfoDictionary() core.NSDictionary
type NSEvent ¶
func (NSEvent) Characters ¶ added in v0.0.2
type NSFont ¶
func NSFont_Init ¶
type NSImage ¶
func NSImage_ImageNamed ¶
func NSImage_InitWithData ¶
func (NSImage) IsTemplate ¶
func (NSImage) SetTemplate ¶
func (NSImage) SetValueForKey ¶
func (i NSImage) SetValueForKey(value, key interface{})
type NSImageView ¶
func NSImageView_New ¶
func NSImageView_New() NSImageView
func (NSImageView) Image ¶
func (imgView NSImageView) Image() NSImage
func (NSImageView) SetImage ¶
func (imgView NSImageView) SetImage(img objc.Object)
type NSLayoutManager ¶
func (NSLayoutManager) EnsureLayoutForTextContainer ¶
func (lm NSLayoutManager) EnsureLayoutForTextContainer(tc NSTextContainer)
func (NSLayoutManager) UsedRectForTextContainer ¶
func (lm NSLayoutManager) UsedRectForTextContainer(tc NSTextContainer) (rect core.NSRect)
type NSMenu ¶
func NSMenu_Init ¶
func NSMenu_New ¶
func NSMenu_New() NSMenu
func (NSMenu) AddItem ¶
func (menu NSMenu) AddItem(item NSMenuItem)
func (NSMenu) AutoenablesItems ¶
func (NSMenu) RemoveItem ¶
func (menu NSMenu) RemoveItem(item NSMenuItem)
func (NSMenu) SetAutoenablesItems ¶
type NSMenuItem ¶
NSMenuItem is a command item in an app menu. https://developer.apple.com/documentation/appkit/nsmenuitem?language=objc
func NSMenuItem_Init ¶
func NSMenuItem_Init(itemName string, action objc.Selector, keyEquivalent string) NSMenuItem
NSMenuItem_Init returns an initialized instance of NSMenuItem. https://developer.apple.com/documentation/appkit/nsmenuitem/1514858-initwithtitle?language=objc
func NSMenuItem_New ¶
func NSMenuItem_New() NSMenuItem
NSMenuItem_New returns an initialized instance of NSMenuItem.
func NSMenuItem_Separator ¶
func NSMenuItem_Separator() NSMenuItem
NSMenuItem_Separator returns a menu item that is used to separate logical groups of menu commands. https://developer.apple.com/documentation/appkit/nsmenuitem/1514838-separatoritem?language=objc
func (NSMenuItem) Action ¶
func (i NSMenuItem) Action() objc.Selector
Action returns the menu item's action-method selector. https://developer.apple.com/documentation/appkit/nsmenuitem/1514825-action?language=objc
func (NSMenuItem) Enabled ¶
func (i NSMenuItem) Enabled() bool
Enabled returns a boolean value that indicates whether the menu item is enabled. https://developer.apple.com/documentation/appkit/nsmenuitem/1514863-enabled?language=objc
func (NSMenuItem) Hidden ¶
func (i NSMenuItem) Hidden() bool
Hidden returns a boolean value that indicates whether the menu item is hidden. https://developer.apple.com/documentation/appkit/nsmenuitem/1514846-hidden?language=objc
func (NSMenuItem) Image ¶
func (i NSMenuItem) Image() NSImage
Image returns the menu item’s image. https://developer.apple.com/documentation/appkit/nsmenuitem/1514819-image?language=objc
func (NSMenuItem) SetAction ¶
func (i NSMenuItem) SetAction(sel objc.Selector)
SetAction sets the menu item's action-method selector. https://developer.apple.com/documentation/appkit/nsmenuitem/1514825-action?language=objc
func (NSMenuItem) SetEnabled ¶
func (i NSMenuItem) SetEnabled(b bool)
SetEnabled sets a boolean value that indicates whether the menu item is enabled. https://developer.apple.com/documentation/appkit/nsmenuitem/1514863-enabled?language=objc
func (NSMenuItem) SetHidden ¶
func (i NSMenuItem) SetHidden(b bool)
SetHidden sets a boolean value that indicates whether the menu item is hidden. https://developer.apple.com/documentation/appkit/nsmenuitem/1514846-hidden?language=objc
func (NSMenuItem) SetImage ¶
func (i NSMenuItem) SetImage(obj NSImage)
SetImage sets the menu item’s image. https://developer.apple.com/documentation/appkit/nsmenuitem/1514819-image?language=objc
func (NSMenuItem) SetState ¶
func (i NSMenuItem) SetState(state int)
SetState sets the state of the menu item. https://developer.apple.com/documentation/appkit/nsmenuitem/1514804-state?language=objc
func (NSMenuItem) SetSubmenu ¶
func (i NSMenuItem) SetSubmenu(submenu NSMenu)
SetSubmenu sets the submenu of the menu item. https://developer.apple.com/documentation/appkit/nsmenuitem/1514845-submenu?language=objc
func (NSMenuItem) SetTarget ¶
func (i NSMenuItem) SetTarget(obj objc.Object)
SetTarget sets the menu item's target. https://developer.apple.com/documentation/appkit/nsmenuitem/1514843-target?language=objc
func (NSMenuItem) SetTitle ¶
func (i NSMenuItem) SetTitle(s string)
SetTitle sets the menu item's title. https://developer.apple.com/documentation/appkit/nsmenuitem/1514805-title?language=objc
func (NSMenuItem) SetToolTip ¶
func (i NSMenuItem) SetToolTip(s string)
SetToolTip sets a help tag for the menu item. https://developer.apple.com/documentation/appkit/nsmenuitem/1514848-tooltip?language=objc
func (NSMenuItem) State ¶
func (i NSMenuItem) State() int64
State returns the state of the menu item. https://developer.apple.com/documentation/appkit/nsmenuitem/1514804-state?language=objc
func (NSMenuItem) Submenu ¶
func (i NSMenuItem) Submenu() NSMenu
Submenu returns the submenu of the menu item. https://developer.apple.com/documentation/appkit/nsmenuitem/1514845-submenu?language=objc
func (NSMenuItem) Target ¶
func (i NSMenuItem) Target() objc.Object
Target returns the menu item's target. https://developer.apple.com/documentation/appkit/nsmenuitem/1514843-target?language=objc
func (NSMenuItem) Title ¶
func (i NSMenuItem) Title() string
Title returns the menu item's title. https://developer.apple.com/documentation/appkit/nsmenuitem/1514805-title?language=objc
func (NSMenuItem) ToolTip ¶
func (i NSMenuItem) ToolTip() string
ToolTip returns a help tag for the menu item. https://developer.apple.com/documentation/appkit/nsmenuitem/1514848-tooltip?language=objc
type NSPasteboard ¶ added in v0.0.2
Wrapper for NSPasteboard https://developer.apple.com/documentation/appkit/nspasteboard?language=objc
Example ¶
package main import ( "fmt" "github.com/progrium/macdriver/cocoa" ) func main() { // get general pasteboard gp := cocoa.NSPasteboard_GeneralPasteboard() // clear pasteboard and write to pasteboard gp.ClearContents() gp.SetStringForType("test-content", cocoa.NSPasteboardTypeString) // read data from pasteboard fmt.Println(gp.StringForType(cocoa.NSPasteboardTypeString)) }
Output: test-content
func NSPasteboard_GeneralPasteboard ¶ added in v0.0.2
func NSPasteboard_GeneralPasteboard() NSPasteboard
NSPasteboard_GeneralPasteboard is the shared pasteboard object to use for general content. https://developer.apple.com/documentation/appkit/nspasteboard/1530091-generalpasteboard?language=objc
func (NSPasteboard) AvailableTypeFromArray ¶ added in v0.0.3
func (pb NSPasteboard) AvailableTypeFromArray(types []NSPasteboardType) NSPasteboardType
AvailableTypeFromArray scans the specified types for a type that the receiver supports. https://developer.apple.com/documentation/appkit/nspasteboard/1526078-availabletypefromarray?language=objc
func (NSPasteboard) ClearContents ¶ added in v0.0.2
func (pb NSPasteboard) ClearContents()
ClearContents clears the existing contents of the pasteboard. https://developer.apple.com/documentation/appkit/nspasteboard/1533599-clearcontents?language=objc
func (NSPasteboard) DataForType ¶ added in v0.0.3
func (pb NSPasteboard) DataForType(t NSPasteboardType) core.NSData
DataForType returns the data for the specified type from the first item in the receiver that contains the type. https://developer.apple.com/documentation/appkit/nspasteboard/1531810-datafortype?language=objc
Example ¶
package main import ( "github.com/progrium/macdriver/cocoa" "io/ioutil" "log" ) func main() { // get general pasteboard gp := cocoa.NSPasteboard_GeneralPasteboard() // check which is the best available type (list all the types you can to handle here) pbType := gp.AvailableTypeFromArray([]cocoa.NSPasteboardType{cocoa.NSPasteboardTypePNG, cocoa.NSPasteboardTypeTIFF}) if pbType == "" { // check which types are in the pasteboard right now log.Printf("no matching type found. only found: %s \n", gp.Types()) return } // fetch data data := gp.DataForType(pbType) var bs []byte // turn into go bytes bs = data.Bytes() f, err := ioutil.TempFile("", "out-img") if err != nil { log.Fatalln(err) } _, err = f.Write(bs) if err != nil { log.Fatalln(err) } log.Printf("png written to file: %s\n", f.Name()) }
Output:
func (NSPasteboard) SetStringForType ¶ added in v0.0.2
func (pb NSPasteboard) SetStringForType(s string, t NSPasteboardType)
SetStringForType sets the given string as the representation for the specified type for the first item on the receiver. https://developer.apple.com/documentation/appkit/nspasteboard/1528225-setstring?language=objc
func (NSPasteboard) StringForType ¶ added in v0.0.2
func (pb NSPasteboard) StringForType(t NSPasteboardType) string
StringForType returns a concatenation of the strings for the specified type from all the items in the receiver that contain the type. https://developer.apple.com/documentation/appkit/nspasteboard/1533566-stringfortype?language=objc
func (NSPasteboard) Types ¶ added in v0.0.3
func (pb NSPasteboard) Types() []NSPasteboardType
Types is an array of the receiver’s supported data types. https://developer.apple.com/documentation/appkit/nspasteboard/1529599-types?language=objc
type NSPasteboardType ¶ added in v0.0.2
type NSPasteboardType string
The supported pasteboard types. https://developer.apple.com/documentation/appkit/nspasteboardtype?language=objc
type NSScreen ¶
func NSScreen_Main ¶
func NSScreen_Main() NSScreen
type NSStatusBar ¶
func NSStatusBar_System ¶
func NSStatusBar_System() NSStatusBar
func (NSStatusBar) RemoveStatusItem ¶
func (sb NSStatusBar) RemoveStatusItem(i NSStatusItem)
func (NSStatusBar) StatusItemWithLength ¶
func (sb NSStatusBar) StatusItemWithLength(l float64) NSStatusItem
type NSStatusBarButton ¶
type NSStatusBarButton struct {
NSView
}
func (NSStatusBarButton) Image ¶
func (b NSStatusBarButton) Image() NSImage
func (NSStatusBarButton) ImagePosition ¶
func (b NSStatusBarButton) ImagePosition() int64
func (NSStatusBarButton) SetImage ¶
func (b NSStatusBarButton) SetImage(obj NSImage)
func (NSStatusBarButton) SetImagePosition ¶
func (b NSStatusBarButton) SetImagePosition(state int)
func (NSStatusBarButton) SetTitle ¶
func (b NSStatusBarButton) SetTitle(s string)
func (NSStatusBarButton) SetToolTip ¶
func (b NSStatusBarButton) SetToolTip(s string)
func (NSStatusBarButton) Title ¶
func (b NSStatusBarButton) Title() string
func (NSStatusBarButton) ToolTip ¶
func (b NSStatusBarButton) ToolTip() string
type NSStatusItem ¶
func (NSStatusItem) Action ¶
func (i NSStatusItem) Action() objc.Selector
func (NSStatusItem) Button ¶
func (i NSStatusItem) Button() NSStatusBarButton
func (NSStatusItem) Menu ¶
func (i NSStatusItem) Menu() NSMenu
func (NSStatusItem) SetAction ¶
func (i NSStatusItem) SetAction(sel objc.Selector)
func (NSStatusItem) SetMenu ¶
func (i NSStatusItem) SetMenu(menu NSMenu)
func (NSStatusItem) SetTarget ¶
func (i NSStatusItem) SetTarget(obj objc.Object)
func (NSStatusItem) Target ¶
func (i NSStatusItem) Target() objc.Object
type NSTextAlignment ¶
type NSTextAlignment uint
const ( NSTextAlignmentLeft NSTextAlignment = 0 NSTextAlignmentRight NSTextAlignment = 1 NSTextAlignmentCenter NSTextAlignment = 2 NSTextAlignmentJustified NSTextAlignment = 3 NSTextAlignmentNatural NSTextAlignment = 4 )
type NSTextContainer ¶
func (NSTextContainer) HeightTracksTextView ¶
func (tc NSTextContainer) HeightTracksTextView() bool
func (NSTextContainer) SetHeightTracksTextView ¶
func (tc NSTextContainer) SetHeightTracksTextView(b bool)
func (NSTextContainer) Size ¶
func (tc NSTextContainer) Size() (size core.NSSize)
type NSTextView ¶
type NSTextView struct {
NSView
}
func NSTextView_Init ¶
func NSTextView_Init(frame core.NSRect) NSTextView
func (NSTextView) Alignment ¶
func (v NSTextView) Alignment() NSTextAlignment
func (NSTextView) DrawsBackground ¶
func (v NSTextView) DrawsBackground() bool
func (NSTextView) Editable ¶
func (v NSTextView) Editable() bool
func (NSTextView) FieldEditor ¶
func (v NSTextView) FieldEditor() bool
func (NSTextView) Font ¶
func (v NSTextView) Font() NSFont
func (NSTextView) ImportsGraphics ¶
func (v NSTextView) ImportsGraphics() bool
func (NSTextView) LayoutManager ¶
func (v NSTextView) LayoutManager() NSLayoutManager
func (NSTextView) RichText ¶
func (v NSTextView) RichText() bool
func (NSTextView) Selectable ¶
func (v NSTextView) Selectable() bool
func (NSTextView) SetAlignment ¶
func (v NSTextView) SetAlignment(d NSTextAlignment)
func (NSTextView) SetDrawsBackground ¶
func (v NSTextView) SetDrawsBackground(b bool)
func (NSTextView) SetEditable ¶
func (v NSTextView) SetEditable(b bool)
func (NSTextView) SetFieldEditor ¶
func (v NSTextView) SetFieldEditor(b bool)
func (NSTextView) SetFont ¶
func (v NSTextView) SetFont(f NSFont)
func (NSTextView) SetImportsGraphics ¶
func (v NSTextView) SetImportsGraphics(b bool)
func (NSTextView) SetLayoutManager ¶
func (v NSTextView) SetLayoutManager(lm NSLayoutManager)
func (NSTextView) SetRichText ¶
func (v NSTextView) SetRichText(b bool)
func (NSTextView) SetSelectable ¶
func (v NSTextView) SetSelectable(b bool)
func (NSTextView) SetString ¶
func (v NSTextView) SetString(s string)
func (NSTextView) SetTextContainer ¶
func (v NSTextView) SetTextContainer(tc NSTextContainer)
func (NSTextView) String ¶
func (v NSTextView) String() string
func (NSTextView) TextContainer ¶
func (v NSTextView) TextContainer() NSTextContainer
type NSView ¶
func NSView_Init ¶
func (NSView) AddSubviewPositionedRelativeTo ¶
func (NSView) BackgroundColor ¶
func (NSView) SetBackgroundColor ¶
func (NSView) SetBoundsOrigin ¶
func (NSView) SetBoundsSize ¶
func (NSView) SetFrameOrigin ¶
func (NSView) SetFrameSize ¶
func (NSView) SetValueForKey ¶
func (NSView) SetWantsLayer ¶
func (NSView) WantsLayer ¶
type NSVisualEffectView ¶
func NSVisualEffectView_New ¶
func NSVisualEffectView_New() NSVisualEffectView
type NSWindow ¶
func NSWindow_Init ¶
func NSWindow_Init(rect core.NSRect, windowStyle core.NSUInteger, bufferingType NSBackingStoreType, deferCreation bool) NSWindow
func NSWindow_New ¶
func NSWindow_New() NSWindow
func (NSWindow) BackgroundColor ¶
func (NSWindow) CollectionBehavior ¶
func (NSWindow) ContentRectForFrameRect ¶
func (NSWindow) ContentView ¶
func (NSWindow) HasShadow ¶ added in v0.0.3
HasShadow returns a Boolean value that indicates whether the window has a shadow. https://developer.apple.com/documentation/appkit/nswindow/1419234-hasshadow?language=objc
func (NSWindow) IgnoresMouseEvents ¶
func (NSWindow) MakeKeyAndOrderFront ¶
func (NSWindow) MovableByWindowBackground ¶
func (NSWindow) OrderBack ¶ added in v0.0.3
OrderBack moves the window to the back of its level in the screen list, without changing either the key window or the main window. https://developer.apple.com/documentation/appkit/nswindow/1419204-orderback?language=objc
func (NSWindow) OrderFront ¶ added in v0.0.3
OrderFront moves the window to the front of its level in the screen list, without changing either the key window or the main window. https://developer.apple.com/documentation/appkit/nswindow/1419495-orderfront?language=objc
func (NSWindow) OrderOut ¶ added in v0.0.3
OrderOut removes the window from the screen list, which hides the window. https://developer.apple.com/documentation/appkit/nswindow/1419660-orderout?language=objc
func (NSWindow) SetBackgroundColor ¶
func (NSWindow) SetCollectionBehavior ¶
func (NSWindow) SetContentView ¶
func (NSWindow) SetFrameDisplay ¶
func (NSWindow) SetHasShadow ¶ added in v0.0.3
SetHasShadow sets a Boolean value that indicates whether the window has a shadow. https://developer.apple.com/documentation/appkit/nswindow/1419234-hasshadow?language=objc
func (NSWindow) SetIgnoresMouseEvents ¶
func (NSWindow) SetMovableByWindowBackground ¶
func (NSWindow) SetStyleMask ¶
func (NSWindow) SetTitleVisibility ¶
func (NSWindow) SetTitlebarAppearsTransparent ¶
func (NSWindow) TitleVisibility ¶
func (NSWindow) TitlebarAppearsTransparent ¶
func (NSWindow) ToggleFullScreen ¶
Source Files ¶
- NSApplication.go
- NSBundle.go
- NSCell.go
- NSColor.go
- NSEvent.go
- NSEvent_monitor.go
- NSFont.go
- NSImage.go
- NSImageView.go
- NSLayoutManager.go
- NSMenu.go
- NSMenuItem.go
- NSNib.go
- NSPasteboard.go
- NSScreen.go
- NSStatusBar.go
- NSStatusBarButton.go
- NSStatusItem.go
- NSTextContainer.go
- NSTextView.go
- NSView.go
- NSVisualEffectView.go
- NSWindow.go
- NSWindow_const.go
- init.go