Feeds

New vistas with windows frames

Open your mind

Providing a secure and efficient Helpdesk

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
Microsoft on the Threshold of a new name for Windows next week
Rebranded OS reportedly set to be flung open by Redmond
Business is back, baby! Hasta la VISTA, Win 8... Oh, yeah, Windows 9
Forget touchscreen millennials, Microsoft goes for mouse crowd
SMASH the Bash bug! Apple and Red Hat scramble for patch batches
'Applying multiple security updates is extremely difficult'
Apple: SO sorry for the iOS 8.0.1 UPDATE BUNGLE HORROR
Apple kills 'upgrade'. Hey, Microsoft. You sure you want to be like these guys?
ARM gives Internet of Things a piece of its mind – the Cortex-M7
32-bit core packs some DSP for VIP IoT CPU LOL
Lotus Notes inventor Ozzie invents app to talk to people on your phone
Imagine that. Startup floats with voice collab app for Win iPhone
'Google is NOT the gatekeeper to the web, as some claim'
Plus: 'Pretty sure iOS 8.0.2 will just turn the iPhone into a fax machine'
prev story

Whitepapers

A strategic approach to identity relationship management
ForgeRock commissioned Forrester to evaluate companies’ IAM practices and requirements when it comes to customer-facing scenarios versus employee-facing ones.
Storage capacity and performance optimization at Mizuno USA
Mizuno USA turn to Tegile storage technology to solve both their SAN and backup issues.
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?
Beginner's guide to SSL certificates
De-mystify the technology involved and give you the information you need to make the best decision when considering your online security options.
Security for virtualized datacentres
Legacy security solutions are inefficient due to the architectural differences between physical and virtual environments.