Re: Counter field as in Mail.app
Re: Counter field as in Mail.app
- Subject: Re: Counter field as in Mail.app
- From: Jim Puls <email@hidden>
- Date: Fri, 25 Jan 2008 00:33:43 -0800
On Jan 25, 2008, at 12:12 AM, j o a r wrote:
How is the counter field (or what should I call it) implemented,
that is used in Mail.app to show how many unread mails you have in
Inbox?
I want to how the same field in an NSOutlineView in an application
I currently develops, but I have no idea where to look in the
documentation to find out how to do this.
Are you talking about the badge on the dock icon, or the counters in
the Mailboxes pane in the viewer window?
If you're talking about the per-mailbox unread counter I would guess
that's drawn by a custom cell subclass. Probably pretty easy to
implement - Just calculate the width of the string with the integer
counter, and then draw a wide enough background using NSBezierPath.
Also worth noting, since I've seen apps get this wrong:
- it's wide enough for a two-digit number even when there is only one
digit.
- there are three different colors to think about: active "blue",
active "graphite", and inactive.
- the font is Helvetica Bold, which is different from the font used
for the rest of the outline view.
If you'd like an API to do this drawing for you, by all means, file a
bug!
And if you were perchance talking about the dock icon, take a look at
the docs for NSDockTile.
-> jp
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden