Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Drop Shadow Text and Emulating Button Highlighting

Drop Shadow Text and Emulating Button Highlighting
Thread Tools
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 1, 2001, 09:21 PM
 
Hello ...

Two things, for a Cocoa project:

x How do I put text (and/or images) in an Aqua window that
will have the same drop-shadow effect as the "Mac OS X"
string in the login window?

x I'm emulating some buttons with click-sensitive Views
(because I need finer control over their appearance).
I want to darken the image when pressed, but I need
this to match the way regular Aqua buttons darken. How?

(Ideally, I'd like to sub-class NSButtonView and tweak
its "drawRect:" method slightly. But apparently, I can
use the standard method, or roll my own completely from
scratch; there is no "tweak". Is there a way around
that? All I *really* want is to say "draw the button as
normal, then draw >this< over the image".)

Suggestions?


Thanks ...

Day Late Don
     
Forum Regular
Join Date: Jan 2001
Location: San Luis Obispo, California, USA
Status: Offline
Reply With Quote
May 3, 2001, 01:05 AM
 
To answer your first question....
I believe that the text in the login window is just a tiff.


-robotic
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 3, 2001, 05:00 AM
 
> I believe that the text in the login window is just a tiff.

True enough. But Apple has built-in drop-shadowing for window titles and stuff. Can we tap into that functionality for our own text? (It'd be very cool Apple implemented it as a new "Shadow" style.)

As for my other question, I believe I've found a solution for my particular situation: I just cover a normal button with a view that contains the image I want drawn over the button, and I just pass mouse events through that view to the button (which, of course, then darkens properly). It seems a little kludgy to have to use an auxiliary view, but I can cope.

I wonder though ... Is there a way to create a view that I can use to draw "on top of" various buttons and other elements in my window, but is "click-invisible": clicks automatically fall through to the next-topmost element of the window under the mouse? This would seem a quick and easy way to theme the interface of the window. (It would remove some of the kludginess of my solution by relieving me of the burden of tying the "pass-through" view with a particular element for sending mouse events.)

Thanks ...

     
Forum Regular
Join Date: Oct 2000
Location: Portland, OR USA
Status: Offline
Reply With Quote
May 3, 2001, 06:07 PM
 
Couldn't you "tweak" the drawRect method by rolling your own that first called the superclass's drawRect and then draw your additions? In Java you can do this kind of thing with super.method().
     
Dedicated MacNNer
Join Date: Nov 2000
Status: Offline
Reply With Quote
May 3, 2001, 10:10 PM
 
> Couldn't you "tweak" the drawRect method by rolling your own that
> first called the superclass's drawRect and then draw your additions?
> In Java you can do this kind of thing with super.method().

Perhaps I've misinterpreted the comment from the NSView description:

drawRect

[...]

This method is intended to be completely overridden by each subclass
that performs drawing. Don't invoke super's implementation in your
subclass.

I guess that's probably specifically for direct subclasses of NSView, not subclasses of NSButton. (Looking back, I'm not sure I noticed that I'd passed from the NSButton level into the NSView level of the documentation hierarchy when I was originally hunting down drawing information.)

Thanks ...
     
Forum Regular
Join Date: Oct 2000
Location: Portland, OR USA
Status: Offline
Reply With Quote
May 4, 2001, 03:04 PM
 
I think that you're right that it only applies to NSView. It makes sense there, but not in subclasses like NSButton.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:54 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2