Re: QuickTime Player - like application
Re: QuickTime Player - like application
- Subject: Re: QuickTime Player - like application
- From: John Pannell <email@hidden>
- Date: Wed, 11 May 2011 15:09:42 -0600
Hi Nick-
These things are all possible, but none of it comes for free... you'll need to draw your window contents yourself. To start with, you'll need a "transparent" window:
http://www.google.com/search?q=NSBorderlessWindowMask
Also look at Apple's RoundTransparentWindow sample code:
http://developer.apple.com/library/mac/#samplecode/RoundTransparentWindow/Introduction/Intro.html
But wait, there's more...
> How to force the window to make its titlebar/playback control bar
> disappear, when the mouse is not over the window?
http://www.google.com/search?client=safari&rls=en&q=cocoa+mouse+tracking
You'll need to track the mouse in the main content view of the window, and draw your UI (or not) as the mouse enters and exits.
> How to change the color of the window/titlebar?
You'll need to draw this view yourself. There are many different ways to draw in a view; I used CoreGraphics/Quartz to draw the borders, rounded corners, etc. and CGContextDrawTiledImage to draw the background of the "toolbar". Be attentive: there are transparency effects around the edges of windows; use Pixie to examine a standard OS X window over a variety of backgrounds. Also note - you'll need your drawing routine to draw differently for windows that are foreground/background.
http://www.google.com/search?client=safari&rls=en&q=NSView+drawing
> how to make a control panel (with play/pause/stop buttons) that can
> slide only within the main window that's being displayed?
I would make another transparent window with the controls. Listen to the windowWillMove: delegate method in your controller to prevent unwanted movement. You'll need to draw your own controls (a common theme in this endeavor).
> how to make such a customized control buttons? (they look very
> different from default default mac os buttons
You can get the "stoplight" buttons via standardWindowButton:forStyleMask: and place these into your view hierarchy. These may not look right with the background you're drawing; if that is the case, you'll need to draw your own buttons. If you *do* use those buttons, I should warn you that the only way I've found to duplicate OS X's mouse over behavior is to employ a private method.
Any other buttons or controls are on your own. I'll also note you'll need to draw the window title correctly (i.e. centered in window with proper shadow).
> how to make the window resize preserving a specific aspect ratio?
Listen to the delegate method - (NSSize)windowWillResize:(NSWindow *)sender toSize:(NSSize)proposedFrameSize in your controller and only return sizes that match your desired aspect ratio.
>
> Sorry if my questions seem naive, i am a beginner in cocoa development :)
I've never been one to try to talk a beginner out of things... it can be a great way to learn a lot. I would note a few potential pitfalls before you launch down this path:
1. As mentioned, it will be a lot of work to re-invent this wheel - Apple provides a very good window drawing framework for free. Could your development time be better spent on something else?
2. If you diverge too far from the standard UI, you will run the risk of getting denied while trying to get your app in the App Store. From the approval guidelines:
6. User interface
• 6.1 Apps must comply with all terms and conditions explained in the Apple Macintosh Human Interface Guidelines
• 6.2 Apps that look similar to Apple Products or apps bundled on the Mac, including the Finder, iChat, iTunes, and Dashboard, will be rejected
• 6.3 Apps that do not use system provided items, such as buttons and icons, correctly and as described in the Apple Macintosh Human Interface Guidelines will be rejected
• 6.4 Apple and our customers place a high value on simple, refined, creative, well thought through interfaces. They take more work but are worth it. Apple sets a high bar. If your user interface is complex or less than very good it may be rejected
• 6.5 Apps that change the native user interface elements or behaviors of Mac OS X will be rejected
> Could you please point what guides/references (the names) to look at
> to make such things?
> Thank you!
Good Luck!
John
John Pannell
http://www.positivespinmedia.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden