Share to mail and messages - objective-c

Where can I find any info about how to share image to mail or messages? Just like for example preview share function. Here is photos:
Is there any frameworks or something to achieve it easily, or there are some others methods?

Use the new share menu. Note that this is a new feature in Mountain Lion.
To create a Share menu in Interface Builder, select the appropriate
button. Then, in the Attributes pane of the inspector, specify
NSImageNameShareTemplate for the image. To create one using AppKit
programming interfaces, use NSImageNameShareTemplate to add an image
to a button
(NSButton).
If you create a Share button programmatically, in order for the Share
menu to behave as users expect, you need to set
sendActionOn:NSLeftMouseDownMask.

Related

How do I programmatically find an Eclipse view toolbar control?

I would like to support drag and drop of a file resource onto some plugin view toolbar buttons: this would involve attaching a DropTarget to the underlying Control (a Button). However it is unclear to me how programmatically to retrieve the Button - I can give it a unique id in the plugin.xml but what API calls would I use to then find it? Ideas welcome, thanks!
Update: the code fragment at Eclipse RCP obtain toolbar contributions programmatically shows how to navigate to get to the relevant IContributionItem, but then I need the model/widget...

How to dynamically add fields to a NSView similar to iCal New Task popup?

I'm trying to implement a NSView which will host a 'choose file' attachment button. If the user chooses to add a file, the user will be given an option to add another one (and from the 'new set of dropdowns' the user will essentially be able to pick the kind of file they're attaching').
The closest match to this functionality is iCal's New Task editor where you select an alarm and then it gives you an option to add another alarm right underneath.
What is the right way of doing this (I'm new to Mac OS X development)? I originally thought I'd create a custom NSView with all the 'file options' and then if the user was to attach a file I'd dynamically add another NSView right below it (in a NSScrollView). However so many apps do something similar that I almost feel as if there's something else out there in the set of controls that I should be using.
Please can someone guide me to the right direction? Is 'NSForm' or NSPredicateEditor used for this sort of stuff? This is what I mean:
Neither NSForm nor NSPredicateEditor would be useful for what you want to do. I think your thoughts about how to do this by adding a custom view below the original view, is the right way to go. You don't necessarily have to do it in a scroll view, you could expand the size of the window like iCal does.

Get live screenshot of window in objective-c

I'm trying to find a way to get a live view of a specific window. In the same way that Mission Control and Exposé will show you live views of windows that are currently obscured by other windows (this is also done by Hyperdock, so I'm pretty certain that its not a private API).
What is the functionality called? And so where is the documentation on it?
You want the Quartz Window Services API. Basically, you want to create a window list with the windows you're interested in and use CGWindowListCreateImage to get a picture of the window's contents.

How can I organize the "Window" menu?

I have a document based application. Every document can have multiple windows. Every window is automatically added to the "Window" menu. However, they are added in a more or less random and useless order. I would like the window titles to be organized according to the NSDocument they belong to, similar to how XCode or Photoshop do it.
How can I best do that? How can I prevent the default behaviour of AppKit to add all windows to this special menu, and where should I put the code that adds the menu items in the "correct" manner? I don't want to put handlers into every window controller!
It sure does seem like this is something Cocoa should do automatically. I don't know whether it does, but the first thing to check is whether the window controllers are properly connected to their documents. Does your document subclass's windowControllers property contain all the right objects?
If that's no good, then from NSWindow's reference it looks like the only way to prevent a window whose title has been set from being added to the Windows menu is -[NSWindow setExcludedFromWindowsMenu:]. It looks like you'll want to call that on all your windows, then set up an object (perhaps in the MainMenu nib) that takes care of all the windows' positions and grouping in the Windows menu (via NSApplication's methods). You may need to put in special disabled items and the like to get the grouping to look right. I would hope that windows could still be manually added even if you've previously asked them to be excluded.

Suggestion for dragster/dropzone like dock menu

I'd like to create a dragster/dropzone like dock menu. Looks a bit like a stack with a nsview in it.
After a lot if documentation searching and googling I've found a way to determine a dock icon's location.
(http://cocoadev.com/forums/comments.php?DiscussionID=1431)
Is nzbdrop creating a view which just looks like an stack to display it's menu or is there a better way of creating this?
Additional info:
I'm not looking for the drop like functionality just the nice way the DropBox window is displayed as an bubble/stack menu on top of it's app icon.
For anyone wanting to create something similar;
Matt Gemmell created a nice solution for this called MAAttachedWindow:
http://mattgemmell.com/source
Not exactly sure I understand your question but the Dragster and Dropzone apps clearly work something like this:
They have an application icon in the dock.
They respond to a drop request in the standard fashion.
Upon receiving a drop request, they open an application window above the dock which also accepts a drop request.
According to the link you provided, they use the accessibility API to locate their dock icon so they can open the application window above the dock icon.
The window is just a standard application window although most likely modal and floating (like a help window.) It can have any appearance you wish.