• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Checkboxes and NSBox titles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Checkboxes and NSBox titles


  • Subject: Re: Checkboxes and NSBox titles
  • From: "John C. Randolph" <email@hidden>
  • Date: Tue, 12 Jun 2001 14:42:24 -0700

Let's see...

Back in the NeXTSTEP days, I hacked the Box class to replace its titleCell with a button cell.

@interface NSBox : NSView
{
/*All instance variables are private*/
id _titleCell;
id _contentView;
NSSize _offsets;
NSRect _borderRect;
NSRect _titleRect;
struct __bFlags {
NSBorderType borderType:2;
NSTitlePosition titlePosition:3;
unsigned int transparent:1;
unsigned int boxType:2;
unsigned int _RESERVED:24;
} _bFlags;
id _unused;
}

Yep, there it is: first ivar. So, using the magic of categories:

@interface NSBox (titleCellHack)

- (void) setTitleCell:(NSCell *) aCell

@end

@implementation NSBox (titleCellHack)

- (void) setTitleCell:(NSCell *) aCell
{
if (aCell && (_titleCell != aCell))
[_titleCell release];
[_aCell retain];
_titleCell = aCell;
}

@end

Doing this within IB is left as an exercise for the reader ;-)
IMNSHO, there *should* be a -setTitleCell: method in the public API for NSBox.

-jcr

On Tuesday, June 12, 2001, at 01:35 PM, Matt Judy wrote:

Hi,

Bill Cheeseman wrote:

The newest version of the Aqua HI Guidelines states that it is permissible
to use a checkbox or a pop-up menu as the title of an NSBox. But the current
version of Interface Builder doesn't provide a means to do so.

Heh, I have to confess that I cheated to do this in one of my apps... I simply filled in
the box title with spaces, then lined up the checkbox and its title in that space. Not
the best way to do it, but I asked the same question a while ago on a different list, and
got zero response.
--
Matt Judy
Senior Engineer + ATC + APP
/Apple/Applications/Internet/iTools

- (void)contactMatt { // Contact Information =======
if ([via phone]) dial = @" 408-974-3763 ";
else if ([via email]) send = @" mailto:email@hidden ";
else if ([via wwweb]) goto = @" http://macserv.apple.com ";
else appleMailStop = @" MS:82-RK ";
} // ===========================

// [ObjC retain];
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev


"This is not a book to be tossed aside lightly. Rather, it should be hurled with great force." -Dorothy Parker


  • Follow-Ups:
    • Re: Checkboxes and NSBox titles
      • From: Bill Cheeseman <email@hidden>
    • Re: Checkboxes and NSBox titles
      • From: John Hörnkvist <email@hidden>
References: 
 >Re: Checkboxes and NSBox titles (From: Matt Judy <email@hidden>)

  • Prev by Date: Re: Cocoa/EOF for non-enterprise apps Re: proof of cocoa superiority?
  • Next by Date: Re: Newbie question: Scaling images
  • Previous by thread: Re: Checkboxes and NSBox titles
  • Next by thread: Re: Checkboxes and NSBox titles
  • Index(es):
    • Date
    • Thread