Figuring out the size of an NSTabViewItem subclass
Figuring out the size of an NSTabViewItem subclass
- Subject: Figuring out the size of an NSTabViewItem subclass
- From: Darrin Cardani <email@hidden>
- Date: Mon, 20 Jun 2005 12:48:07 -0500
I have a tab view item subclass which I want to have display an icon
next to the text. So it looks like I need to override [-NSTabViewItem
sizeofLabel:] and [-NSTabViewItem drawLabel:inRect:]. I'm trying to
make a general class that I can re-use and want to make it possible
to set the tab item's icon to an image that might be bigger than the
tab. In that case, during drawing it would scale the image down to
fit in the tab.
So the problem I'm having is that in my subclass's sizeOfLabel:
method, I don't have the height of the tab, so I don't know how far
to scale it down. My first thought was that since -sizeOfLabel: is
returning the height and width, it can't already know the height of
the tab. However, in testing it out, it doesn't appear that the
height of the tab ever changes, regardless of what -sizeOfLabel:
returns. In fact, if it returns a height of 32 pixels, for example,
the height of the label is remaining at 20 pixels, and the rest of
the icon is drawn outside of that. So it appears to be completely
ignoring the height returned by -sizeOfLabel: anyway.
So what's the best way to calculate the height of a tab item? Should
I just check the control size and assume that if it's, say,
NSRegularControlSize that it's 20 pixels high? I'd much rather be
able to query the object to get that information, but it seems like
that's what [-sizeOfLabel:] is supposed to do, even though that's
where I need the info!
Thanks,
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden