mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Adopted to changes in NSCell.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@8265 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d5b8faad6d
commit
c2f8b2e407
11 changed files with 118 additions and 185 deletions
|
@ -42,8 +42,6 @@ static Class controlClass;
|
|||
{
|
||||
if (self == [NSActionCell class])
|
||||
{
|
||||
NSDebugLog(@"Initialize NSActionCell class\n");
|
||||
|
||||
controlClass = [NSControl class];
|
||||
[self setVersion: 1];
|
||||
}
|
||||
|
@ -55,30 +53,39 @@ static Class controlClass;
|
|||
- (id) init
|
||||
{
|
||||
[super init];
|
||||
_target = nil;
|
||||
_action = NULL;
|
||||
_tag = 0;
|
||||
_control_view = nil;
|
||||
|
||||
// Implicitly set by allocation:
|
||||
//
|
||||
//_target = nil;
|
||||
//_action = NULL;
|
||||
//_tag = 0;
|
||||
//_control_view = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initImageCell: (NSImage*)anImage
|
||||
{
|
||||
[super initImageCell: anImage];
|
||||
_target = nil;
|
||||
_action = NULL;
|
||||
_tag = 0;
|
||||
_control_view = nil;
|
||||
|
||||
// Implicitly set by allocation:
|
||||
//
|
||||
//_target = nil;
|
||||
//_action = NULL;
|
||||
//_tag = 0;
|
||||
//_control_view = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initTextCell: (NSString*)aString
|
||||
{
|
||||
[super initTextCell: aString];
|
||||
_target = nil;
|
||||
_action = NULL;
|
||||
_tag = 0;
|
||||
_control_view = nil;
|
||||
|
||||
// Implicitly set by allocation:
|
||||
//
|
||||
//_target = nil;
|
||||
//_action = NULL;
|
||||
//_tag = 0;
|
||||
//_control_view = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -87,7 +94,7 @@ static Class controlClass;
|
|||
*/
|
||||
- (void) setAlignment: (NSTextAlignment)mode
|
||||
{
|
||||
_cell.text_align = mode;
|
||||
[super setAlignment: mode];
|
||||
if (_control_view)
|
||||
if ([_control_view isKindOfClass: controlClass])
|
||||
[(NSControl *)_control_view updateCell: self];
|
||||
|
@ -225,10 +232,11 @@ static Class controlClass;
|
|||
{
|
||||
NSActionCell *c = [super copyWithZone: zone];
|
||||
|
||||
c->_tag = _tag;
|
||||
c->_target = _target;
|
||||
c->_action = _action;
|
||||
c->_control_view = _control_view;
|
||||
// All done automatically
|
||||
//c->_tag = _tag;
|
||||
//c->_target = _target;
|
||||
//c->_action = _action;
|
||||
//c->_control_view = _control_view;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -104,12 +104,9 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
if (_columnScrollView)
|
||||
[_columnScrollView release];
|
||||
if (_columnMatrix)
|
||||
[_columnMatrix release];
|
||||
if (_columnTitle)
|
||||
[_columnTitle release];
|
||||
TEST_RELEASE(_columnScrollView);
|
||||
TEST_RELEASE(_columnMatrix);
|
||||
TEST_RELEASE(_columnTitle);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -158,9 +155,7 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
if (!aString)
|
||||
aString = @"";
|
||||
|
||||
[aString retain];
|
||||
[_columnTitle release];
|
||||
_columnTitle = aString;
|
||||
ASSIGN(_columnTitle, aString);
|
||||
}
|
||||
|
||||
- (NSString *)columnTitle
|
||||
|
@ -181,9 +176,9 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
[self setTextColor: [NSColor windowFrameTextColor]];
|
||||
[self setBackgroundColor: [NSColor controlShadowColor]];
|
||||
[self setFont: [NSFont titleBarFontOfSize: 0]];
|
||||
[self setAlignment: NSCenterTextAlignment];
|
||||
_cell.is_editable = NO;
|
||||
_cell.is_bezeled = YES;
|
||||
_cell.text_align = NSCenterTextAlignment;
|
||||
_textfieldcell_draws_background = YES;
|
||||
|
||||
return self;
|
||||
|
@ -254,7 +249,7 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
_browserCellClass = classId;
|
||||
|
||||
// set the prototype for the new class
|
||||
[self setCellPrototype: [[[_browserCellClass alloc] init] autorelease]];
|
||||
[self setCellPrototype: AUTORELEASE([[_browserCellClass alloc] init])];
|
||||
}
|
||||
|
||||
// -------------------
|
||||
|
@ -272,9 +267,7 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
|
||||
- (void)setCellPrototype: (NSCell *)aCell
|
||||
{
|
||||
[aCell retain];
|
||||
[_browserCellPrototype release];
|
||||
_browserCellPrototype = aCell;
|
||||
ASSIGN(_browserCellPrototype, aCell);
|
||||
}
|
||||
|
||||
// -------------------
|
||||
|
@ -689,9 +682,7 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
fprintf(stderr, "NSBrowser - (void)setPathSeparator\n");
|
||||
#endif
|
||||
|
||||
[aString retain];
|
||||
[_pathSeparator release];
|
||||
_pathSeparator = aString;
|
||||
ASSIGN(_pathSeparator, aString);
|
||||
}
|
||||
|
||||
|
||||
|
@ -716,19 +707,20 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
fprintf(stderr, "NSBrowser - (void)addColumn\n");
|
||||
#endif
|
||||
|
||||
bc = [[[NSBrowserColumn alloc] init] autorelease];
|
||||
bc = [[NSBrowserColumn alloc] init];
|
||||
|
||||
// Create a scrollview
|
||||
sc = [[[NSScrollView alloc]
|
||||
initWithFrame: rect]
|
||||
autorelease];
|
||||
sc = [[NSScrollView alloc]
|
||||
initWithFrame: rect];
|
||||
[sc setHasHorizontalScroller: NO];
|
||||
[sc setHasVerticalScroller: YES];
|
||||
[bc setColumnScrollView: sc];
|
||||
[self addSubview: sc];
|
||||
RELEASE(sc);
|
||||
|
||||
[_browserColumns addObject: bc];
|
||||
|
||||
RELEASE(bc);
|
||||
|
||||
[self tile];
|
||||
}
|
||||
|
||||
|
@ -2223,11 +2215,11 @@ static float scrollerWidth; // == [NSScroller scrollerWidth]
|
|||
fprintf(stderr, "NSBrowser - (void)dealloc\n");
|
||||
#endif
|
||||
|
||||
[_browserCellPrototype release];
|
||||
[_pathSeparator release];
|
||||
[_horizontalScroller release];
|
||||
[_browserColumns release];
|
||||
[_titleCell release];
|
||||
RELEASE(_browserCellPrototype);
|
||||
RELEASE(_pathSeparator);
|
||||
RELEASE(_horizontalScroller);
|
||||
RELEASE(_browserColumns);
|
||||
RELEASE(_titleCell);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
|
|
@ -47,8 +47,6 @@ static NSImage *_highlight_image;
|
|||
|
||||
static Class _colorClass;
|
||||
|
||||
static NSFont *_userDefaultFont;
|
||||
|
||||
// GNUstep user default to have NSBrowserCell in bold if non leaf
|
||||
static BOOL _gsFontifyCells = NO;
|
||||
static NSFont *_nonLeafFont;
|
||||
|
@ -67,7 +65,6 @@ static NSFont *_leafFont;
|
|||
ASSIGN(_branch_image, [NSImage imageNamed: @"common_3DArrowRight"]);
|
||||
ASSIGN(_highlight_image, [NSImage imageNamed: @"common_3DArrowRightH"]);
|
||||
|
||||
ASSIGN (_userDefaultFont, [NSFont userFontOfSize: 0]);
|
||||
/*
|
||||
* Cache classes to avoid overheads of poor compiler implementation.
|
||||
*/
|
||||
|
@ -102,67 +99,26 @@ static NSFont *_leafFont;
|
|||
*/
|
||||
- (id) initTextCell: (NSString *)aString
|
||||
{
|
||||
_cell.type = NSTextCellType;
|
||||
_cell_font = RETAIN(_userDefaultFont);
|
||||
_contents = RETAIN(aString);
|
||||
_cell.float_autorange = YES;
|
||||
_cell_float_right = 6;
|
||||
_action_mask = NSLeftMouseUpMask;
|
||||
|
||||
// Implicitly performed by allocation:
|
||||
//
|
||||
//_cell_image = nil;
|
||||
//_cell.image_position = NSNoImage;
|
||||
//_cell.state = 0;
|
||||
//_cell.is_disabled = NO;
|
||||
//_cell.is_highlighted = NO;
|
||||
//_cell.is_editable = NO;
|
||||
//_cell.is_bordered = NO;
|
||||
//_cell.is_bezeled = NO;
|
||||
//_cell.is_scrollable = NO;
|
||||
//_cell.is_selectable = NO;
|
||||
//_cell.is_continuous = NO;
|
||||
//_cell_float_left = 0;
|
||||
//_cell.text_align = NSLeftTextAlignment;
|
||||
[super initTextCell: aString];
|
||||
//_alternateImage = nil;
|
||||
//_browsercell_is_leaf = NO;
|
||||
//_browsercell_is_loaded = NO;
|
||||
|
||||
if (_gsFontifyCells)
|
||||
ASSIGN (_cell_font, _nonLeafFont);
|
||||
[self setFont: _nonLeafFont];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id) initImageCell: (NSImage *)anImage
|
||||
{
|
||||
_cell.type = NSImageCellType;
|
||||
_cell_image = RETAIN(anImage);
|
||||
_cell.image_position = NSImageOnly;
|
||||
_cell_font = RETAIN(_userDefaultFont);
|
||||
_action_mask = NSLeftMouseUpMask;
|
||||
|
||||
// Implicitly performed by allocation:
|
||||
//
|
||||
//_cell.is_disabled = NO;
|
||||
//_cell.state = 0;
|
||||
//_cell.is_highlighted = NO;
|
||||
//_cell.is_editable = NO;
|
||||
//_cell.is_bordered = NO;
|
||||
//_cell.is_bezeled = NO;
|
||||
//_cell.is_scrollable = NO;
|
||||
//_cell.is_selectable = NO;
|
||||
//_cell.is_continuous = NO;
|
||||
//_cell.float_autorange = NO;
|
||||
//_cell_float_left = 0;
|
||||
//_cell_float_right = 0;
|
||||
//_cell.text_align = NSLeftTextAlignment;
|
||||
[super initImageCell: anImage];
|
||||
//_alternateImage = nil;
|
||||
//_browsercell_is_leaf = NO;
|
||||
//_browsercell_is_loaded = NO;
|
||||
|
||||
if (_gsFontifyCells)
|
||||
ASSIGN (_cell_font, _nonLeafFont);
|
||||
[self setFont: _nonLeafFont];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -181,8 +137,8 @@ static NSFont *_leafFont;
|
|||
|
||||
if (_alternateImage)
|
||||
c->_alternateImage = RETAIN(_alternateImage);
|
||||
c->_browsercell_is_leaf = _browsercell_is_leaf;
|
||||
c->_browsercell_is_loaded = _browsercell_is_loaded;
|
||||
//c->_browsercell_is_leaf = _browsercell_is_leaf;
|
||||
//c->_browsercell_is_loaded = _browsercell_is_loaded;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -219,11 +175,11 @@ static NSFont *_leafFont;
|
|||
{
|
||||
if (_browsercell_is_leaf)
|
||||
{
|
||||
ASSIGN (_cell_font, _leafFont);
|
||||
[self setFont: _leafFont];
|
||||
}
|
||||
else
|
||||
{
|
||||
ASSIGN (_cell_font, _nonLeafFont);
|
||||
[self setFont: _nonLeafFont];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
//_buttoncell_is_transparent = NO;
|
||||
//_altContents = nil;
|
||||
|
||||
_cell.text_align = NSCenterTextAlignment;
|
||||
[self setAlignment: NSCenterTextAlignment];
|
||||
_cell.is_bordered = YES;
|
||||
_showAltStateMask = NSNoCellMask; // configure as a NSMomentaryPushButton
|
||||
_highlightsByMask = NSPushInCellMask | NSChangeGrayCellMask;
|
||||
|
@ -105,10 +105,10 @@
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[_altContents release];
|
||||
[_altImage release];
|
||||
[_keyEquivalent release];
|
||||
[_keyEquivalentFont release];
|
||||
RELEASE(_altContents);
|
||||
RELEASE(_altImage);
|
||||
RELEASE(_keyEquivalent);
|
||||
RELEASE(_keyEquivalentFont);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -116,7 +116,7 @@
|
|||
/*
|
||||
* Setting the Titles
|
||||
*/
|
||||
- (NSString*) title
|
||||
- (NSString*) title
|
||||
{
|
||||
return [self stringValue];
|
||||
}
|
||||
|
@ -138,10 +138,8 @@
|
|||
|
||||
- (void) setAlternateTitle: (NSString*)aString
|
||||
{
|
||||
NSString* string = [aString copy];
|
||||
ASSIGNCOPY(_altContents, aString);
|
||||
|
||||
ASSIGN(_altContents, string);
|
||||
[string release];
|
||||
if (_control_view)
|
||||
if ([_control_view isKindOfClass: [NSControl class]])
|
||||
[(NSControl*)_control_view updateCell: self];
|
||||
|
@ -271,7 +269,7 @@
|
|||
|
||||
- (void) setButtonType: (NSButtonType)buttonType
|
||||
{
|
||||
_cell.type = buttonType;
|
||||
// Don't store the button type anywhere
|
||||
|
||||
switch (buttonType)
|
||||
{
|
||||
|
@ -491,11 +489,7 @@
|
|||
|
||||
if (titleToDisplay && (ipos == NSImageAbove || ipos == NSImageBelow))
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_cell_font,
|
||||
NSFontAttributeName,
|
||||
nil];
|
||||
titleSize = [titleToDisplay sizeWithAttributes: dict];
|
||||
titleSize = [self _sizeText: titleToDisplay];
|
||||
}
|
||||
|
||||
if (flippedView == YES)
|
||||
|
@ -697,12 +691,7 @@
|
|||
|
||||
if (titleToDisplay != nil)
|
||||
{
|
||||
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
_cell_font,
|
||||
NSFontAttributeName,
|
||||
nil];
|
||||
titleSize = [titleToDisplay sizeWithAttributes: dict];
|
||||
|
||||
titleSize = [self _sizeText: titleToDisplay];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -800,14 +789,14 @@
|
|||
|
||||
c->_altContents = [_altContents copyWithZone: zone];
|
||||
if (_altImage)
|
||||
c->_altImage = [_altImage retain];
|
||||
c->_altImage = RETAIN(_altImage);
|
||||
c->_keyEquivalent = [_keyEquivalent copyWithZone: zone];
|
||||
if (_keyEquivalentFont)
|
||||
c->_keyEquivalentFont = [_keyEquivalentFont retain];
|
||||
c->_keyEquivalentModifierMask = _keyEquivalentModifierMask;
|
||||
c->_buttoncell_is_transparent = _buttoncell_is_transparent;
|
||||
c->_highlightsByMask = _highlightsByMask;
|
||||
c->_showAltStateMask = _showAltStateMask;
|
||||
c->_keyEquivalentFont = RETAIN(_keyEquivalentFont);
|
||||
//c->_keyEquivalentModifierMask = _keyEquivalentModifierMask;
|
||||
//c->_buttoncell_is_transparent = _buttoncell_is_transparent;
|
||||
//c->_highlightsByMask = _highlightsByMask;
|
||||
//c->_showAltStateMask = _showAltStateMask;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -39,29 +39,33 @@
|
|||
- (id)initTextCell:(NSString *)aString
|
||||
{
|
||||
self = [super initTextCell:aString];
|
||||
_delegate = nil;
|
||||
_dataSource = nil;
|
||||
_buttonCell = nil;
|
||||
_popUpList = [[NSMutableArray array] retain];
|
||||
_usesDataSource = NO;
|
||||
|
||||
// Implicitly set by allocation:
|
||||
//
|
||||
//_delegate = nil;
|
||||
//_dataSource = nil;
|
||||
//_buttonCell = nil;
|
||||
_popUpList = [[NSMutableArray alloc] init];
|
||||
//_usesDataSource = NO;
|
||||
_visibleItems = 10;
|
||||
_intercellSpacing = NSMakeSize(0.0,0.0);
|
||||
_intercellSpacing = NSZeroSize;
|
||||
_itemHeight = 14;
|
||||
|
||||
_popView = nil;
|
||||
_canPop = NO;
|
||||
//_popView = nil;
|
||||
//_canPop = NO;
|
||||
_popRect = NSZeroRect;
|
||||
_mUpEvent = nil;
|
||||
//_mUpEvent = nil;
|
||||
[self _createButtonCell];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_delegate release];
|
||||
[_dataSource release];
|
||||
[_buttonCell release];
|
||||
[_popUpList release];
|
||||
RELEASE(_delegate);
|
||||
RELEASE(_dataSource);
|
||||
RELEASE(_buttonCell);
|
||||
RELEASE(_popUpList);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,6 @@ static NSColor *shadowCol;
|
|||
{
|
||||
self = [super initTextCell: @""];
|
||||
_cell.is_bezeled = YES;
|
||||
_cell.text_align = NSLeftTextAlignment;
|
||||
_cell.is_editable = YES;
|
||||
_titleCell = [[NSCell alloc] initTextCell: aString];
|
||||
[_titleCell setAlignment: NSRightTextAlignment];
|
||||
|
@ -85,7 +84,7 @@ static NSColor *shadowCol;
|
|||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_titleCell release];
|
||||
RELEASE(_titleCell);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -367,10 +367,10 @@ scaleProportionally(NSSize imageSize, NSRect canvasRect)
|
|||
{
|
||||
NSImageCell *c = [super copyWithZone: zone];
|
||||
|
||||
c->_imageAlignment = _imageAlignment;
|
||||
c->_frameStyle = _frameStyle;
|
||||
c->_imageScaling = _imageScaling;
|
||||
c->_original_image_size = _original_image_size;
|
||||
//c->_imageAlignment = _imageAlignment;
|
||||
//c->_frameStyle = _frameStyle;
|
||||
//c->_imageScaling = _imageScaling;
|
||||
//c->_original_image_size = _original_image_size;
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -70,7 +70,8 @@ static NSImage *arrowImageH = nil;
|
|||
_highlightsByMask = NSChangeBackgroundCellMask;
|
||||
_showAltStateMask = NSNoCellMask;
|
||||
_cell.image_position = NSNoImage;
|
||||
_cell.text_align = NSLeftTextAlignment;
|
||||
[self setAlignment: NSLeftTextAlignment];
|
||||
[self setFont: [NSFont menuFontOfSize: 0]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -169,20 +170,14 @@ static NSImage *arrowImageH = nil;
|
|||
neededMenuItemHeight = componentSize.height;
|
||||
|
||||
// Title and Key Equivalent
|
||||
// FIXME: Calculate height (Lazaro).
|
||||
if (_cell_font)
|
||||
{
|
||||
mcell_titleWidth = [_cell_font widthOfString:[mcell_item title]];
|
||||
mcell_keyEquivalentWidth =
|
||||
[_cell_font widthOfString:[mcell_item keyEquivalent]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSFont *defFont = [NSFont menuFontOfSize: 0];
|
||||
|
||||
mcell_titleWidth = [defFont widthOfString:[mcell_item title]];
|
||||
mcell_keyEquivalentWidth = [defFont widthOfString:[mcell_item keyEquivalent]];
|
||||
}
|
||||
componentSize = [self _sizeText: [mcell_item title]];
|
||||
mcell_titleWidth = componentSize.width;
|
||||
if (componentSize.height > neededMenuItemHeight)
|
||||
neededMenuItemHeight = componentSize.height;
|
||||
componentSize = [self _sizeText: [mcell_item keyEquivalent]];
|
||||
mcell_keyEquivalentWidth = componentSize.width;
|
||||
if (componentSize.height > neededMenuItemHeight)
|
||||
neededMenuItemHeight = componentSize.height;
|
||||
|
||||
// Submenu Arrow
|
||||
if ([mcell_item hasSubmenu])
|
||||
|
@ -662,12 +657,12 @@ static NSImage *arrowImageH = nil;
|
|||
{
|
||||
NSMenuItemCell *c = [super copyWithZone: zone];
|
||||
|
||||
c->mcell_highlighted = mcell_highlighted;
|
||||
c->mcell_has_submenu = mcell_has_submenu;
|
||||
//c->mcell_highlighted = mcell_highlighted;
|
||||
//c->mcell_has_submenu = mcell_has_submenu;
|
||||
//c->mcell_needs_sizing = mcell_needs_sizing;
|
||||
if (mcell_item)
|
||||
c->mcell_item = [mcell_item copyWithZone: zone];
|
||||
c->mcell_menuView = mcell_menuView;
|
||||
c->mcell_needs_sizing = mcell_needs_sizing;
|
||||
c->mcell_menuView = RETAIN(mcell_menuView);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
|
@ -62,12 +62,6 @@ static NSImage *_pbc_image[2];
|
|||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
RELEASE(_menu);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (id) initTextCell: (NSString *)stringValue
|
||||
{
|
||||
return [self initTextCell: stringValue pullsDown: NO];
|
||||
|
@ -575,9 +569,9 @@ static NSImage *_pbc_image[2];
|
|||
{
|
||||
NSSize s;
|
||||
NSSize imageSize;
|
||||
NSSize titleSize;
|
||||
int i, count;
|
||||
NSString *title;
|
||||
float candidateWidth;
|
||||
|
||||
count = [_menu numberOfItems];
|
||||
|
||||
|
@ -585,19 +579,17 @@ static NSImage *_pbc_image[2];
|
|||
return NSZeroSize;
|
||||
|
||||
imageSize = [_pbc_image[_pbcFlags.pullsDown] size];
|
||||
s = NSZeroSize;
|
||||
|
||||
s.height = [_cell_font boundingRectForFont].size.height;
|
||||
if (imageSize.height > s.height)
|
||||
s.height = imageSize.height;
|
||||
s = NSMakeSize(0, imageSize.height);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
title = [[_menu itemAtIndex: i] title];
|
||||
candidateWidth = [_cell_font widthOfString: title];
|
||||
titleSize = [self _sizeText: title];
|
||||
|
||||
if (candidateWidth > s.width)
|
||||
s.width = candidateWidth;
|
||||
if (titleSize.width > s.width)
|
||||
s.width = titleSize.width;
|
||||
if (titleSize.height > s.height)
|
||||
s.height = titleSize.height;
|
||||
}
|
||||
|
||||
s.width += imageSize.width;
|
||||
|
|
|
@ -43,7 +43,7 @@ static NSColor *clearCol = nil;
|
|||
{
|
||||
[super initTextCell: aString];
|
||||
|
||||
_cell.text_align = NSCenterTextAlignment;
|
||||
[self setAlignment: NSCenterTextAlignment];
|
||||
ASSIGN (_text_color, [NSColor windowFrameTextColor]);
|
||||
[self setBackgroundColor: [NSColor controlShadowColor]];
|
||||
[self setFont: [NSFont titleBarFontOfSize: 0]];
|
||||
|
|
|
@ -88,7 +88,6 @@ static NSColor *txtCol;
|
|||
- (id) initTextCell: (NSString *)aString
|
||||
{
|
||||
[super initTextCell: aString];
|
||||
_cell.text_align = NSLeftTextAlignment;
|
||||
|
||||
ASSIGN(_text_color, txtCol);
|
||||
ASSIGN(_background_color, bgCol);
|
||||
|
@ -99,8 +98,8 @@ static NSColor *txtCol;
|
|||
|
||||
- (void) dealloc
|
||||
{
|
||||
[_background_color release];
|
||||
[_text_color release];
|
||||
RELEASE(_background_color);
|
||||
RELEASE(_text_color);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
@ -108,9 +107,8 @@ static NSColor *txtCol;
|
|||
{
|
||||
NSTextFieldCell *c = [super copyWithZone: zone];
|
||||
|
||||
[c setBackgroundColor: _background_color];
|
||||
[c setTextColor: _text_color];
|
||||
[c setDrawsBackground: _textfieldcell_draws_background];
|
||||
c->_background_color = [_background_color copyWithZone: zone];
|
||||
c->_text_color = [_text_color copyWithZone: zone];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue