cocoa

How to get all available Paper Feeds and how to change it in NSPrintInfo obj

与世无争的帅哥 提交于 2021-02-11 04:31:28
问题 I'm trying to set the paper feed in a NSPrintInfo object By now, I'm obtaining the paper feed options (from now on trays) from an IPP call ipp_t *request; request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer_uri); respose = cupsDoRequest(http, request, "/"); ... string trays = ippGetString(ippFindAttribute(response, "media-source-supported", IPP_TAG_KEYWORD), 0, NULL); This returns me a comma-separated string

How to get all available Paper Feeds and how to change it in NSPrintInfo obj

我的梦境 提交于 2021-02-11 04:29:54
问题 I'm trying to set the paper feed in a NSPrintInfo object By now, I'm obtaining the paper feed options (from now on trays) from an IPP call ipp_t *request; request = ippNewRequest(IPP_GET_PRINTER_ATTRIBUTES); ippAddString(request, IPP_TAG_OPERATION, IPP_TAG_URI, "printer-uri", NULL, printer_uri); respose = cupsDoRequest(http, request, "/"); ... string trays = ippGetString(ippFindAttribute(response, "media-source-supported", IPP_TAG_KEYWORD), 0, NULL); This returns me a comma-separated string

Create new column cell on button click outlineview

本秂侑毒 提交于 2021-02-10 21:21:06
问题 I have an outlineview which displays list of data items. Attaching code and screenshot below. When I click on "Create New" button added to cell, I want to add a new item below selected cell.Any help? @IBAction func CreateFolderClicked(_ sender: Any) { let newMember = CubeData() let newIndex = selectedItemIndex let parent = foldersOutlineView.parent(forItem: foldersOutlineView.item(atRow: selectedRow)) if let parentTemp = parent as? CubeData{ let Temp = newMember.initWithNodeName(appName:

Create new column cell on button click outlineview

荒凉一梦 提交于 2021-02-10 21:16:58
问题 I have an outlineview which displays list of data items. Attaching code and screenshot below. When I click on "Create New" button added to cell, I want to add a new item below selected cell.Any help? @IBAction func CreateFolderClicked(_ sender: Any) { let newMember = CubeData() let newIndex = selectedItemIndex let parent = foldersOutlineView.parent(forItem: foldersOutlineView.item(atRow: selectedRow)) if let parentTemp = parent as? CubeData{ let Temp = newMember.initWithNodeName(appName:

How to write an OS X application that can effect changes (custom cursor, draw an image) even when it is not active?

孤人 提交于 2021-02-10 12:39:57
问题 I previously asked a question about changing the cursor system-wide on OSX. I used NSCursor to change the cursor, but the effects are only as long as the application is active. When another application becomes active, the custom cursor is lost. Here is a related, more general question. How can you write an application to have system-wife effects? For example drawing an image on-screen even when your application is not active, and something else is? I understand I probably need to go at a

How to write an OS X application that can effect changes (custom cursor, draw an image) even when it is not active?

风流意气都作罢 提交于 2021-02-10 12:31:55
问题 I previously asked a question about changing the cursor system-wide on OSX. I used NSCursor to change the cursor, but the effects are only as long as the application is active. When another application becomes active, the custom cursor is lost. Here is a related, more general question. How can you write an application to have system-wife effects? For example drawing an image on-screen even when your application is not active, and something else is? I understand I probably need to go at a

How to write an OS X application that can effect changes (custom cursor, draw an image) even when it is not active?

99封情书 提交于 2021-02-10 12:31:47
问题 I previously asked a question about changing the cursor system-wide on OSX. I used NSCursor to change the cursor, but the effects are only as long as the application is active. When another application becomes active, the custom cursor is lost. Here is a related, more general question. How can you write an application to have system-wife effects? For example drawing an image on-screen even when your application is not active, and something else is? I understand I probably need to go at a

NSScrollView how to start from top left corner

痴心易碎 提交于 2021-02-10 08:43:07
问题 How to set scrollView document view to be pinned to top left corner? If scrollView is big enough/bigger than its content, everything is drawn from bottom to up and it not looks right. I have to override isFlipped of scrollView? I was searching internet and overriding isFlipped to return true is not everything. I don't want to make my documentView flipped because then I have to make changes in that class to make everything looks like I want. 回答1: I created simple NSView class as an container

CoreMediaIO, incorrectly updated properties kCMIODevicePropertyDeviceIsRunningSomewhere

南笙酒味 提交于 2021-02-10 07:38:11
问题 I need to receive an event when some process starts using the camera. I did this through CMIOObjectGetPropertyData. But it does not work correctly, the correct value is only the first time it is accessed. I also tried to use the CMIOObjectAddPropertyListenerBlock but he did not work it from me. Tell me please, what am I doing wrong? I will be very grateful. while (1) { UInt32 value = 0; UInt32 valuePropertySize = sizeof(flag); CMIOObjectPropertyAddress opa =

Class does not conform to 'CBPeripheralManagerDelegate' in Swift

被刻印的时光 ゝ 提交于 2021-02-10 07:19:08
问题 I'm trying to build iBeacon emitter in Swift and I cannot get my class to adopt the CBPeripheralManagerDelegate protocol. This protocol is required in Objective-C for initializing the PeripheralManager object, but in Swift, I will get the following error: class MyBeacon: CBPeripheralManagerDelegate { // ... } gives error: 'MyBeacon' does not conform to 'CBPeripheralManagerDelegate' Since my class is not adopting the protocol, I also get an error when I try to initialize the PeripheralManager