I am building an OSX app and would like to capture a portion of the screen with a similar interface as the cmd-shift-4 UX, IE initiating the action:
I've found a good starting point in http://code.google.com/p/captureme/ which presents an NSPanel and captures the area within the panel. However I'd like do a bit better and emulate the cmd-shift-4 interface.
I can't find if something like this is built in (or if there's an existing solution). I suppose the straight forward way is to use an NSResponder and replace the cursor on mouseDown, then on a mouse drag event draw a translucent rectangle between the mouseDown point and the current cursor location. Let me know if my thinking is along the correct lines.
Thanks!
Here's the nutshell version of what you want to do: Create a fullscreen transparent window at CGShieldingWindowLevel(), setIgnoresMouseEvents:NO
, have the view set the cursor to whatever you want, and implement dragging to draw the marquee in the dragged area.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With