FROM : Scott Anguish
DATE : Sat Nov 16 18:48:01 2002
On Saturday, November 16, 2002, at 05:02 PM, Jesse Grosjean wrote:
> Hi,
> I'm wondering if anyone can suggest the best way to implement a
> Mail.app (Jaguar version) type search field... It should be rounded,
> have a search icon at the beginning of the field, text, and a close
> button at the end of the field.
>
> I think I can do it by subclassing NSView and adding some NSImageView
> children and an NSTextField child with a blank background, but I'm not
> quite sure how to draw the rounded focus highlight. Also I'm
> suspecting their might be an easier way to go about it, any
> suggestions would be helpful.
>
this appears to be the way that Mail.app does it.. if you look in the
app wrapper you'll find the image components... it might actually be a
cell with cells within it...
drawing the focus is actually kinda neat. Check this...
http://cocoa.mamasam.com/COCOADEV/2002/10/2/48571.php
but, in a nutshell
if ([self showsFirstResponder]) {
// showsFirstResponder is set for us by the NSControl that is
drawing
us.
NSRect focusRingFrame = clockRect;
focusRingFrame.size.height -= 2.0;
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame,4,4)]
fill];
[NSGraphicsContext restoreGraphicsState];
}
which is called from
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
DATE : Sat Nov 16 18:48:01 2002
On Saturday, November 16, 2002, at 05:02 PM, Jesse Grosjean wrote:
> Hi,
> I'm wondering if anyone can suggest the best way to implement a
> Mail.app (Jaguar version) type search field... It should be rounded,
> have a search icon at the beginning of the field, text, and a close
> button at the end of the field.
>
> I think I can do it by subclassing NSView and adding some NSImageView
> children and an NSTextField child with a blank background, but I'm not
> quite sure how to draw the rounded focus highlight. Also I'm
> suspecting their might be an easier way to go about it, any
> suggestions would be helpful.
>
this appears to be the way that Mail.app does it.. if you look in the
app wrapper you'll find the image components... it might actually be a
cell with cells within it...
drawing the focus is actually kinda neat. Check this...
http://cocoa.mamasam.com/COCOADEV/2002/10/2/48571.php
but, in a nutshell
if ([self showsFirstResponder]) {
// showsFirstResponder is set for us by the NSControl that is
drawing
us.
NSRect focusRingFrame = clockRect;
focusRingFrame.size.height -= 2.0;
[NSGraphicsContext saveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame,4,4)]
fill];
[NSGraphicsContext restoreGraphicsState];
}
which is called from
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
| Related mails | Author | Date |
|---|---|---|
| Jesse Grosjean | Nov 16, 14:03 | |
| Scott Anguish | Nov 16, 18:48 | |
| Vince DeMarco | Nov 18, 13:36 |






Cocoa mail archive

