Feeds

New vistas with windows frames

Open your mind

Internet Security Threat Report 2014

In the same vein, there's another method, _setUtilityWindow: that will enable you to turn a regular window into a utility window, or vice versa. Frankly, I can't see why you would ever want to do this, and it would confuse the hell out of the user, so this one's best avoided!

Cocoa window with padlock

The lock of love: work with showsLockButton

Although not strictly part of the frame view functionality, another useful trick is to be able to display the little "padlock" icon in the top-right corner of a window, just like Safari does when accessing a secure site. I've seen several Cocoa developers ponder how to do this on the web. The NSWindow class implements an undocumented method called showsLockButton. If this method returns YES, then a lock icon will be displayed.

In order to change the state of this on the fly, though, you'll need to "nudge" the frame view object to let it know that the buttons should be updated. This is accomplished as below:

 


[[self _borderView] _updateButtons];

If you want to know when the lock button was clicked, add a lockButtonClicked: method to your window class. It would be nice if you could easily customise the lock button's icon for other purposes, but that's beyond the scope of this article.

To access the real power of what's available here, we need to create our own custom subclass NSThemeFrame, and associate it with the application window. We do this by providing a special method on the window class, frameViewClassForStyleMask, which returns the custom frame view class we want to use. This method is called periodically by the guts of the NSWindow code whenever it needs to access the window's frame view - usually to establish geometry.

Next month, I'll be looking in more detail at what can be done through the provision of a custom border view. Until then, take a look see at how easy it is to drastically alter the appearance of a window simply by overriding the contentAlpha and contentFill methods. You can download the demo application and source code, mentioned earlier, here

Choosing a cloud hosting partner with confidence

More from The Register

next story
Netscape Navigator - the browser that started it all - turns 20
It was 20 years ago today, Marc Andreeesen taught the band to play
Sway: Microsoft's new Office app doesn't have an Undo function
Content aggregation, meet the workplace ... oh
Sign off my IT project or I’ll PHONE your MUM
Honestly, it’s a piece of piss
Return of the Jedi – Apache reclaims web server crown
.london, .hamburg and .公司 - that's .com in Chinese - storm the web server charts
NetWare sales revive in China thanks to that man Snowden
If it ain't Microsoft, it's in fashion behind the Great Firewall
Chrome 38's new HTML tag support makes fatties FIT and SKINNIER
First browser to protect networks' bandwith using official spec
Admins! Never mind POODLE, there're NEW OpenSSL bugs to splat
Four new patches for open-source crypto libraries
prev story

Whitepapers

Forging a new future with identity relationship management
Learn about ForgeRock's next generation IRM platform and how it is designed to empower CEOS's and enterprises to engage with consumers.
Why cloud backup?
Combining the latest advancements in disk-based backup with secure, integrated, cloud technologies offer organizations fast and assured recovery of their critical enterprise data.
Win a year’s supply of chocolate
There is no techie angle to this competition so we're not going to pretend there is, but everyone loves chocolate so who cares.
High Performance for All
While HPC is not new, it has traditionally been seen as a specialist area – is it now geared up to meet more mainstream requirements?
Intelligent flash storage arrays
Tegile Intelligent Storage Arrays with IntelliFlash helps IT boost storage utilization and effciency while delivering unmatched storage savings and performance.