The Register® — Biting the hand that feeds IT

Feeds

Cloud storage: Lower cost and increase uptime

However, you'll notice that NSFrameView implements a method called _shadowType, which returns a bit-mask; effectively, an integer between 0 and 31. Leopard uses subtly different shadowing effects depending whether the window is a utility window, a sheet, or a normal window, whether it is opaque, is the key window, and so on.

What if you want your app to really, er, stand out from the crowd? Do you remember some earlier betas of Leopard? One release had a much more forceful looking window shadow than currently used. If you want to experiment with this, sub-classing the window frame is, once again, the only way to travel. Take a look at the following code:



- (void) _setShadowParameters
{
        extern OSStatus CGSSetWindowShadowAndRimParameters (void * cid, int wid, 
                  float standardDeviation, float density, 
                  int offsetX, int offsetY, unsigned int flags);
        
        int stype;
        if ((stype = [self _shadowType]) != [self shadowState])
        {
                [self setShadowState: stype];
                CGSSetWindowShadowAndRimParameters ([NSApp contextID], 
                                           [_window windowNumber], 
                                           35.0, 0.75, 0, 28, 0);
        }
}

The _setShadowParameters method is called, as needed, to set the shadow parameters associated with the window. Normally, this method looks at the type of window and sets the appropriate type of shadow. Here, we've overridden that behaviour and used the undocumented GSSetWindowShadowAndRimParameters routine to give the window a much more imposing screen presence!

You'll find that it's possible to push the standardDeviation and density values quite a bit higher than I've done, but don't go mad or you'll get unpleasant boundary effects appearing. You have been warned!

As ever, you can download the demo application and source code here

Customer Success Testimonial: Recovery is Everything

Latest Comments

I too am starting to wonder about the point

There are so many interesting _supported_ parts of Cocoa that could use articles like these...why do we care about hacking around in private methods?

0
0

RE: Appearance...

> The Mac OS X restrictions help reduce bad design. It's pretty

> rare that you find a freeware or shareware OS X application

> that looks like shit.

True enough. I remember when VB first came out for the PC, and everyone freaked because of the psychedelic user interfaces that could be put together with a few mouse-clicks.

Personally, in a commercial app, I'd hardly ever see the justification in using these specific techniques, unless I was intentionally setting out to create an alternative look like -- as you say -- the PowerGoo stuff. Next month, I promise to be much better behaved.... but still undocumented.... ;-)

Dave

0
0

Appearance

It is possible to have a window with no header, essentially enabling you to make your own UI. Kai's PowerGoo is one application that decided to make their own GUI... and I think they intentionally made it confusing.

Windows has a lot more flexibility when controlling aspects of the GUI. However, there are some really ugly-assed Windows applications out there (mostly freeware and shareware) with no sense of good, usable GUI design at all.

The Mac OS X restrictions help reduce bad design. It's pretty rare that you find a freeware or shareware OS X application that looks like shit.

0
0

More from The Register

SCO vs. IBM battle resumes over ownership of Unix
Zombie lawsuit back and wants to suck the brains out of Linux
Bjarne Again: Hallelujah for C++
Plus: Now officially OK to admit you never used STL algorithms
Interwebs taunt Sir Jony over Apple eye candy makeover
Hey Ive, Ive... add more unicorns, willya?
Apple: iOS7 dayglo Barbie makeover is UNFINISHED - report
Plus: You don't like the icons? Blame marketing
Red Hat to ditch MySQL for MariaDB in RHEL 7
So long, Oracle! Don't let the door hit you on the way out
Shy? Socially inadequate? Fiddling with your phone could help
App 'tells the brutal truth' about social inadequates' chatup lines
Java EE 7 melds HTML5 with enterprise apps
New release arrives with GlassFish, NetBeans support
 breaking news
'Office Facebook' firm Tibbr wants you to PAY for mobe-meetings app
Great idea. Punters won't cough for it though
 breaking news
The only Waze is Google: Ad giant tipped to gobble map app 'for $1.3bn'
Pac-Man-satnav-ish upstart in bidding war with Apple, Facebook
 breaking news
PM Cameron calls for modern, programmable computers! (We think)
IT education musings to G8 chiefs to mystify IT industry