Feeds

New vistas with windows frames

Open your mind

Build a business case: developing custom apps

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

Boost IT visibility and business value

More from The Register

next story
The Return of BSOD: Does ANYONE trust Microsoft patches?
Sysadmins, you're either fighting fires or seen as incompetents now
Microsoft refuses to nip 'Windows 9' unzip lip slip
Look at the shiny Windows 8.1, why can't you people talk about 8.1, sobs an exec somewhere
Intel's Raspberry Pi rival Galileo can now run Windows
Behold the Internet of Things. Wintel Things
Linux Foundation says many Linux admins and engineers are certifiable
Floats exam program to help IT employers lock up talent
Microsoft cries UNINSTALL in the wake of Blue Screens of Death™
Cache crash causes contained choloric calamity
Eat up Martha! Microsoft slings handwriting recog into OneNote on Android
Freehand input on non-Windows kit for the first time
Linux kernel devs made to finger their dongles before contributing code
Two-factor auth enabled for Kernel.org repositories
prev story

Whitepapers

Implementing global e-invoicing with guaranteed legal certainty
Explaining the role local tax compliance plays in successful supply chain management and e-business and how leading global brands are addressing this.
7 Elements of Radically Simple OS Migration
Avoid the typical headaches of OS migration during your next project by learning about 7 elements of radically simple OS migration.
BYOD's dark side: Data protection
An endpoint data protection solution that adds value to the user and the organization so it can protect itself from data loss as well as leverage corporate data.
Consolidation: The Foundation for IT Business Transformation
In this whitepaper learn how effective consolidation of IT and business resources can enable multiple, meaningful business benefits.
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?