mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +00:00
Tidyups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6264 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
68c0bf5784
commit
751ed9aca0
4 changed files with 279 additions and 246 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,9 @@
|
|||
Fri Mar 10 13:36:00 2000 Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
||||
|
||||
* Source/NSCell.m: fixed formatting to be consistent and conform
|
||||
to GNU standards.
|
||||
* Source/NSButtonCell.m: ditto.
|
||||
|
||||
2000-03-10 Pascal J. Bourguignon <pjb@imaginet.fr>
|
||||
|
||||
* Source/GSUtil.m
|
||||
|
@ -6,7 +12,6 @@
|
|||
now, only contains the GSUtil_sizeOfMultilineStringWithFont()
|
||||
function.
|
||||
|
||||
|
||||
* Source/NSCell.m
|
||||
* Source/NSButtonCell.m
|
||||
|
||||
|
@ -18,7 +23,6 @@
|
|||
drawInteriorWithFrame:inView:] to handle properly multiline
|
||||
strings.
|
||||
|
||||
|
||||
* Source/NSPanel.m
|
||||
|
||||
Added the following features to GSAlertPanel private subclass
|
||||
|
@ -47,14 +51,12 @@
|
|||
windows as high as the screen would be centered at y=0 instead of
|
||||
y=title bar height/2.
|
||||
|
||||
|
||||
* Testing/NSPanelTest
|
||||
|
||||
Also, I've added a NSPanelTest application in core/Testing, that
|
||||
will show how nice have become the Alert panels...
|
||||
|
||||
|
||||
|
||||
Fri Mar 10 12:42:44 2000 Nicola Pero <n.pero@mi.flashnet.it>
|
||||
|
||||
* Source/NSSplitView.m ([-mouseDown:]): Fixed bug.
|
||||
|
|
|
@ -53,18 +53,18 @@
|
|||
|
||||
@implementation NSButtonCell
|
||||
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
/*
|
||||
* Class methods
|
||||
*/
|
||||
+ (void) initialize
|
||||
{
|
||||
if (self == [NSButtonCell class])
|
||||
[self setVersion: 1];
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
- (id) _init
|
||||
{
|
||||
// Implicitly performed by allocation:
|
||||
|
@ -90,7 +90,7 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (id) initImageCell: (NSImage *)anImage
|
||||
- (id) initImageCell: (NSImage*)anImage
|
||||
{
|
||||
[super initImageCell: anImage];
|
||||
|
||||
|
@ -99,7 +99,7 @@
|
|||
return [self _init];
|
||||
}
|
||||
|
||||
- (id) initTextCell: (NSString *)aString
|
||||
- (id) initTextCell: (NSString*)aString
|
||||
{
|
||||
[super initTextCell: aString];
|
||||
|
||||
|
@ -116,30 +116,30 @@
|
|||
[super dealloc];
|
||||
}
|
||||
|
||||
//
|
||||
// Setting the Titles
|
||||
//
|
||||
- (NSString *) title
|
||||
/*
|
||||
* Setting the Titles
|
||||
*/
|
||||
- (NSString*) title
|
||||
{
|
||||
return [self stringValue];
|
||||
}
|
||||
|
||||
- (NSString *) alternateTitle
|
||||
- (NSString*) alternateTitle
|
||||
{
|
||||
return _altContents;
|
||||
}
|
||||
|
||||
- (void) setFont: (NSFont *)fontObject
|
||||
- (void) setFont: (NSFont*)fontObject
|
||||
{
|
||||
[super setFont: fontObject];
|
||||
}
|
||||
|
||||
- (void) setTitle: (NSString *)aString
|
||||
- (void) setTitle: (NSString*)aString
|
||||
{
|
||||
[self setStringValue: aString];
|
||||
}
|
||||
|
||||
- (void) setAlternateTitle: (NSString *)aString
|
||||
- (void) setAlternateTitle: (NSString*)aString
|
||||
{
|
||||
NSString* string = [aString copy];
|
||||
|
||||
|
@ -147,13 +147,13 @@
|
|||
[string release];
|
||||
if (_control_view)
|
||||
if ([_control_view isKindOfClass: [NSControl class]])
|
||||
[(NSControl *)_control_view updateCell: self];
|
||||
[(NSControl*)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
//
|
||||
// Setting the Images
|
||||
//
|
||||
- (NSImage *) alternateImage
|
||||
/*
|
||||
* Setting the Images
|
||||
*/
|
||||
- (NSImage*) alternateImage
|
||||
{
|
||||
return _altImage;
|
||||
}
|
||||
|
@ -163,7 +163,7 @@
|
|||
return _cell.image_position;
|
||||
}
|
||||
|
||||
- (void) setAlternateImage: (NSImage *)anImage
|
||||
- (void) setAlternateImage: (NSImage*)anImage
|
||||
{
|
||||
ASSIGN(_altImage, anImage);
|
||||
}
|
||||
|
@ -173,10 +173,10 @@
|
|||
_cell.image_position = aPosition;
|
||||
}
|
||||
|
||||
//
|
||||
// Setting the Repeat Interval
|
||||
//
|
||||
- (void) getPeriodicDelay: (float *)delay interval: (float *)interval
|
||||
/*
|
||||
* Setting the Repeat Interval
|
||||
*/
|
||||
- (void) getPeriodicDelay: (float*)delay interval: (float*)interval
|
||||
{
|
||||
*delay = _delayInterval;
|
||||
*interval = _repeatInterval;
|
||||
|
@ -188,9 +188,9 @@
|
|||
_repeatInterval = interval;
|
||||
}
|
||||
|
||||
//
|
||||
// Setting the Key Equivalent
|
||||
//
|
||||
/*
|
||||
* Setting the Key Equivalent
|
||||
*/
|
||||
- (NSString*) keyEquivalent
|
||||
{
|
||||
return _keyEquivalent;
|
||||
|
@ -230,9 +230,9 @@
|
|||
ASSIGN(_keyEquivalentFont, [NSFont fontWithName: fontName size: fontSize]);
|
||||
}
|
||||
|
||||
//
|
||||
// Modifying Graphic Attributes
|
||||
//
|
||||
/*
|
||||
* Modifying Graphic Attributes
|
||||
*/
|
||||
- (BOOL) isTransparent
|
||||
{
|
||||
return _buttoncell_is_transparent;
|
||||
|
@ -245,16 +245,18 @@
|
|||
|
||||
- (BOOL) isOpaque
|
||||
{
|
||||
// MacOS-X says we should return !transparent && [self isBordered],
|
||||
// but that's wrong in our case, since if there is no border,
|
||||
// we draw the interior of the cell to fill completely the bounds.
|
||||
// They are likely to draw differently.
|
||||
/*
|
||||
* MacOS-X says we should return !transparent && [self isBordered],
|
||||
* but that's wrong in our case, since if there is no border,
|
||||
* we draw the interior of the cell to fill completely the bounds.
|
||||
* They are likely to draw differently.
|
||||
*/
|
||||
return !_buttoncell_is_transparent;
|
||||
}
|
||||
|
||||
//
|
||||
// Modifying Graphic Attributes
|
||||
//
|
||||
/*
|
||||
* Modifying Graphic Attributes
|
||||
*/
|
||||
- (int) highlightsBy
|
||||
{
|
||||
return _highlightsByMask;
|
||||
|
@ -354,10 +356,10 @@
|
|||
return _cell.state;
|
||||
}
|
||||
|
||||
//
|
||||
// Displaying
|
||||
//
|
||||
- (NSColor *) textColor
|
||||
/*
|
||||
* Displaying
|
||||
*/
|
||||
- (NSColor*) textColor
|
||||
{
|
||||
if (_cell.is_disabled == YES)
|
||||
return [NSColor disabledControlTextColor];
|
||||
|
@ -490,10 +492,11 @@
|
|||
imageSize = [imageToDisplay size];
|
||||
}
|
||||
|
||||
if (titleToDisplay && (ipos == NSImageAbove || ipos == NSImageBelow)) {
|
||||
titleSize =GSUtil_sizeOfMultilineStringWithFont(titleToDisplay,
|
||||
_cell_font);
|
||||
}
|
||||
if (titleToDisplay && (ipos == NSImageAbove || ipos == NSImageBelow))
|
||||
{
|
||||
titleSize
|
||||
= GSUtil_sizeOfMultilineStringWithFont(titleToDisplay, _cell_font);
|
||||
}
|
||||
|
||||
if (flippedView == YES)
|
||||
{
|
||||
|
@ -524,11 +527,11 @@
|
|||
imageRect.size.width = imageSize.width;
|
||||
imageRect.size.height = cellFrame.size.height;
|
||||
if (_cell.is_bordered || _cell.is_bezeled)
|
||||
{
|
||||
imageRect.origin.x += 3;
|
||||
imageRect.size.height -= 2;
|
||||
imageRect.origin.y += 1;
|
||||
}
|
||||
{
|
||||
imageRect.origin.x += 3;
|
||||
imageRect.size.height -= 2;
|
||||
imageRect.origin.y += 1;
|
||||
}
|
||||
titleRect = imageRect;
|
||||
titleRect.origin.x += imageSize.width + xDist;
|
||||
titleRect.size.width = cellFrame.size.width - imageSize.width - xDist;
|
||||
|
@ -544,11 +547,11 @@
|
|||
imageRect.size.width = imageSize.width;
|
||||
imageRect.size.height = cellFrame.size.height;
|
||||
if (_cell.is_bordered || _cell.is_bezeled)
|
||||
{
|
||||
imageRect.origin.x -= 3;
|
||||
imageRect.size.height -= 2;
|
||||
imageRect.origin.y += 1;
|
||||
}
|
||||
{
|
||||
imageRect.origin.x -= 3;
|
||||
imageRect.size.height -= 2;
|
||||
imageRect.origin.y += 1;
|
||||
}
|
||||
titleRect.origin = cellFrame.origin;
|
||||
titleRect.size.width = cellFrame.size.width - imageSize.width - xDist;
|
||||
titleRect.size.height = cellFrame.size.height;
|
||||
|
@ -560,8 +563,11 @@
|
|||
break;
|
||||
|
||||
case NSImageAbove:
|
||||
/* In this case, imageRect is all the space we can allocate above the text.
|
||||
The drawing code below will then center the image in imageRect. */
|
||||
/*
|
||||
* In this case, imageRect is all the space we can allocate
|
||||
* above the text.
|
||||
* The drawing code below will then center the image in imageRect.
|
||||
*/
|
||||
titleRect.origin.x = cellFrame.origin.x;
|
||||
titleRect.origin.y = cellFrame.origin.y;
|
||||
titleRect.size.width = cellFrame.size.width;
|
||||
|
@ -587,8 +593,11 @@
|
|||
break;
|
||||
|
||||
case NSImageBelow:
|
||||
/* In this case, imageRect is all the space we can allocate below the text.
|
||||
The drawing code below will then center the image in imageRect. */
|
||||
/*
|
||||
* In this case, imageRect is all the space we can allocate
|
||||
* below the text.
|
||||
* The drawing code below will then center the image in imageRect.
|
||||
*/
|
||||
titleRect.origin.x = cellFrame.origin.x;
|
||||
titleRect.origin.y = cellFrame.origin.y + cellFrame.size.height;
|
||||
titleRect.origin.y -= titleSize.height;
|
||||
|
@ -655,9 +664,9 @@
|
|||
NSSize imageSize;
|
||||
NSSize titleSize;
|
||||
|
||||
//
|
||||
// The following code must be kept in sync with -drawInteriorWithFrame
|
||||
//
|
||||
/*
|
||||
* The following code must be kept in sync with -drawInteriorWithFrame
|
||||
*/
|
||||
|
||||
if (_cell.is_highlighted)
|
||||
mask = _highlightsByMask;
|
||||
|
@ -686,53 +695,56 @@
|
|||
else
|
||||
imageSize = NSZeroSize;
|
||||
|
||||
if(titleToDisplay!=nil){
|
||||
titleSize=GSUtil_sizeOfMultilineStringWithFont(titleToDisplay,
|
||||
_cell_font);
|
||||
}else{
|
||||
titleSize=NSZeroSize;
|
||||
}
|
||||
if (titleToDisplay != nil)
|
||||
{
|
||||
titleSize
|
||||
= GSUtil_sizeOfMultilineStringWithFont(titleToDisplay, _cell_font);
|
||||
}
|
||||
else
|
||||
{
|
||||
titleSize = NSZeroSize;
|
||||
}
|
||||
|
||||
switch (_cell.image_position)
|
||||
{
|
||||
case NSNoImage:
|
||||
s = titleSize;
|
||||
break;
|
||||
|
||||
case NSImageOnly:
|
||||
s = imageSize;
|
||||
break;
|
||||
|
||||
case NSImageLeft:
|
||||
case NSImageRight:
|
||||
s.width = imageSize.width + titleSize.width + xDist;
|
||||
if (imageSize.height > titleSize.height)
|
||||
s.height = imageSize.height;
|
||||
else
|
||||
s.height = titleSize.height;
|
||||
break;
|
||||
|
||||
case NSImageBelow:
|
||||
case NSImageAbove:
|
||||
if (imageSize.width > titleSize.width)
|
||||
s.width = imageSize.width;
|
||||
else
|
||||
s.width = titleSize.width;
|
||||
s.height = imageSize.height + titleSize.height; // + yDist ??
|
||||
break;
|
||||
|
||||
case NSImageOverlaps:
|
||||
if (imageSize.width > titleSize.width)
|
||||
s.width = imageSize.width;
|
||||
else
|
||||
s.width = titleSize.width;
|
||||
|
||||
if (imageSize.height > titleSize.height)
|
||||
s.height = imageSize.height;
|
||||
else
|
||||
s.height = titleSize.height;
|
||||
case NSNoImage:
|
||||
s = titleSize;
|
||||
break;
|
||||
|
||||
case NSImageOnly:
|
||||
s = imageSize;
|
||||
break;
|
||||
|
||||
case NSImageLeft:
|
||||
case NSImageRight:
|
||||
s.width = imageSize.width + titleSize.width + xDist;
|
||||
if (imageSize.height > titleSize.height)
|
||||
s.height = imageSize.height;
|
||||
else
|
||||
s.height = titleSize.height;
|
||||
break;
|
||||
|
||||
case NSImageBelow:
|
||||
case NSImageAbove:
|
||||
if (imageSize.width > titleSize.width)
|
||||
s.width = imageSize.width;
|
||||
else
|
||||
s.width = titleSize.width;
|
||||
s.height = imageSize.height + titleSize.height; // + yDist ??
|
||||
break;
|
||||
|
||||
case NSImageOverlaps:
|
||||
if (imageSize.width > titleSize.width)
|
||||
s.width = imageSize.width;
|
||||
else
|
||||
s.width = titleSize.width;
|
||||
|
||||
if (imageSize.height > titleSize.height)
|
||||
s.height = imageSize.height;
|
||||
else
|
||||
s.height = titleSize.height;
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
// Get border size
|
||||
|
@ -743,7 +755,7 @@
|
|||
borderSize = NSZeroSize;
|
||||
|
||||
if ((_cell.is_bordered || _cell.is_bezeled)
|
||||
&& (_cell.image_position != NSImageOnly))
|
||||
&& (_cell.image_position != NSImageOnly))
|
||||
{
|
||||
borderSize.height += 1;
|
||||
borderSize.width += 3;
|
||||
|
@ -760,9 +772,11 @@
|
|||
{
|
||||
if (_cell.is_bordered)
|
||||
{
|
||||
// Special case: Buttons have only three different paths for border.
|
||||
// One white path at the top left corner, one black path at the
|
||||
// bottom right and another in dark gray at the inner bottom right.
|
||||
/*
|
||||
* Special case: Buttons have only three different paths for border.
|
||||
* One white path at the top left corner, one black path at the
|
||||
* bottom right and another in dark gray at the inner bottom right.
|
||||
*/
|
||||
float yDelta = [_control_view isFlipped] ? 1. : 2.;
|
||||
return NSMakeRect (theRect.origin.x + 1.,
|
||||
theRect.origin.y + yDelta,
|
||||
|
@ -773,9 +787,9 @@
|
|||
return theRect;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCopying protocol
|
||||
//
|
||||
/*
|
||||
* NSCopying protocol
|
||||
*/
|
||||
- (id) copyWithZone: (NSZone*)zone
|
||||
{
|
||||
NSButtonCell *c = [super copyWithZone: zone];
|
||||
|
@ -794,9 +808,9 @@
|
|||
return c;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
BOOL tmp;
|
||||
|
|
224
Source/NSCell.m
224
Source/NSCell.m
|
@ -103,7 +103,7 @@ static NSColor *shadowCol;
|
|||
}
|
||||
}
|
||||
|
||||
+ (NSMenu *)defaultMenu
|
||||
+ (NSMenu*)defaultMenu
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
@ -192,11 +192,13 @@ static NSColor *shadowCol;
|
|||
// TODO
|
||||
return nil;
|
||||
}
|
||||
- (BOOL)hasValidObjectValue
|
||||
|
||||
- (BOOL) hasValidObjectValue
|
||||
{
|
||||
// TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (double) doubleValue
|
||||
{
|
||||
return [_contents doubleValue];
|
||||
|
@ -217,7 +219,7 @@ static NSColor *shadowCol;
|
|||
return _contents;
|
||||
}
|
||||
|
||||
- (void) setObjectValue:(id)object
|
||||
- (void) setObjectValue: (id)object
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
@ -243,7 +245,7 @@ static NSColor *shadowCol;
|
|||
ASSIGN(_contents, number_string);
|
||||
}
|
||||
|
||||
- (void) setStringValue: (NSString *)aString
|
||||
- (void) setStringValue: (NSString*)aString
|
||||
{
|
||||
NSString *string;
|
||||
|
||||
|
@ -284,14 +286,14 @@ static NSColor *shadowCol;
|
|||
_cell.type = aType;
|
||||
switch (_cell.type)
|
||||
{
|
||||
case NSTextCellType:
|
||||
ASSIGN(_cell_font, [fontClass userFontOfSize: 0]);
|
||||
ASSIGN(_contents, @"title");
|
||||
break;
|
||||
case NSImageCellType:
|
||||
TEST_RELEASE(_cell_image);
|
||||
_cell_image = nil;
|
||||
break;
|
||||
case NSTextCellType:
|
||||
ASSIGN(_cell_font, [fontClass userFontOfSize: 0]);
|
||||
ASSIGN(_contents, @"title");
|
||||
break;
|
||||
case NSImageCellType:
|
||||
TEST_RELEASE(_cell_image);
|
||||
_cell_image = nil;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -368,38 +370,39 @@ static NSColor *shadowCol;
|
|||
{
|
||||
return _cell.state;
|
||||
}
|
||||
- (BOOL)allowsMixedState
|
||||
|
||||
- (BOOL) allowsMixedState
|
||||
{
|
||||
return _cell.allows_mixed_state;
|
||||
}
|
||||
|
||||
- (void)setAllowsMixedState:(BOOL)flag
|
||||
- (void) setAllowsMixedState: (BOOL)flag
|
||||
{
|
||||
_cell.allows_mixed_state = flag;
|
||||
}
|
||||
|
||||
- (int)nextState
|
||||
- (int) nextState
|
||||
{
|
||||
switch (_cell.state)
|
||||
{
|
||||
case NSOnState:
|
||||
return NSOffState;
|
||||
case NSOffState:
|
||||
if (_cell.allows_mixed_state)
|
||||
{
|
||||
return NSMixedState;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NSOnState;
|
||||
}
|
||||
case NSMixedState:
|
||||
default:
|
||||
return NSOnState;
|
||||
case NSOnState:
|
||||
return NSOffState;
|
||||
case NSOffState:
|
||||
if (_cell.allows_mixed_state)
|
||||
{
|
||||
return NSMixedState;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NSOnState;
|
||||
}
|
||||
case NSMixedState:
|
||||
default:
|
||||
return NSOnState;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setNextState
|
||||
- (void) setNextState
|
||||
{
|
||||
[self setState: [self nextState]];
|
||||
}
|
||||
|
@ -447,7 +450,7 @@ static NSColor *shadowCol;
|
|||
_cell.is_editable = flag;
|
||||
}
|
||||
|
||||
- (void) setFont: (NSFont *)fontObject
|
||||
- (void) setFont: (NSFont*)fontObject
|
||||
{
|
||||
NSAssert(fontObject == nil || [fontObject isKindOfClass: fontClass],
|
||||
NSInvalidArgumentException);
|
||||
|
@ -484,34 +487,34 @@ static NSColor *shadowCol;
|
|||
return _cell.wraps;
|
||||
}
|
||||
|
||||
- (void)setAttributedStringValue:(NSAttributedString *)attribStr
|
||||
- (void) setAttributedStringValue: (NSAttributedString*)attribStr
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
- (NSAttributedString *)attributedStringValue
|
||||
- (NSAttributedString*) attributedStringValue
|
||||
{
|
||||
//TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)setAllowsEditingTextAttributes:(BOOL)flag
|
||||
- (void) setAllowsEditingTextAttributes: (BOOL)flag
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
- (BOOL)allowsEditingTextAttributes
|
||||
- (BOOL) allowsEditingTextAttributes
|
||||
{
|
||||
//TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)setImportsGraphics:(BOOL)flag
|
||||
- (void) setImportsGraphics: (BOOL)flag
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
- (BOOL)importsGraphics
|
||||
- (BOOL) importsGraphics
|
||||
{
|
||||
//TODO
|
||||
return NO;
|
||||
|
@ -628,12 +631,12 @@ static NSColor *shadowCol;
|
|||
_cell_float_right = rightDigits;
|
||||
}
|
||||
|
||||
- (void)setFormatter:(NSFormatter *)newFormatter
|
||||
- (void) setFormatter: (NSFormatter*)newFormatter
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
- (id)formatter
|
||||
- (id) formatter
|
||||
{
|
||||
//TODO
|
||||
return nil;
|
||||
|
@ -658,20 +661,20 @@ static NSColor *shadowCol;
|
|||
/*
|
||||
* Menu
|
||||
*/
|
||||
- (void)setMenu:(NSMenu *)aMenu
|
||||
- (void) setMenu: (NSMenu*)aMenu
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
- (NSMenu *)menu
|
||||
- (NSMenu*) menu
|
||||
{
|
||||
//TODO
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (NSMenu *)menuForEvent:(NSEvent *)anEvent
|
||||
inRect:(NSRect)cellFrame
|
||||
ofView:(NSView *)aView
|
||||
- (NSMenu*) menuForEvent: (NSEvent*)anEvent
|
||||
inRect: (NSRect)cellFrame
|
||||
ofView: (NSView*)aView
|
||||
{
|
||||
// TODO
|
||||
return [self menu];
|
||||
|
@ -700,44 +703,44 @@ static NSColor *shadowCol;
|
|||
return !_cell.is_disabled && ([self refusesFirstResponder] == NO);
|
||||
}
|
||||
|
||||
- (void)setShowsFirstResponder:(BOOL)flag
|
||||
- (void) setShowsFirstResponder: (BOOL)flag
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)showsFirstResponder
|
||||
- (BOOL) showsFirstResponder
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)setTitleWithMnemonic:(NSString *)aString
|
||||
- (void) setTitleWithMnemonic: (NSString*)aString
|
||||
{
|
||||
// Provided for compatibility only
|
||||
}
|
||||
|
||||
- (NSString *)mnemonic
|
||||
- (NSString*) mnemonic
|
||||
{
|
||||
// provided for compatibility only
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (void)setMnemonicLocation:(unsigned int)location
|
||||
- (void) setMnemonicLocation: (unsigned int)location
|
||||
{
|
||||
// Provided for compatibility only
|
||||
}
|
||||
|
||||
- (unsigned int)mnemonicLocation
|
||||
- (unsigned int) mnemonicLocation
|
||||
{
|
||||
// Provided for compatibiliy only
|
||||
return NSNotFound;
|
||||
}
|
||||
|
||||
- (BOOL)refusesFirstResponder
|
||||
- (BOOL) refusesFirstResponder
|
||||
{
|
||||
// Approximate compatibility behaviour
|
||||
return _cell.is_disabled;
|
||||
}
|
||||
|
||||
- (void)setRefusesFirstResponder:(BOOL)flag
|
||||
- (void) setRefusesFirstResponder: (BOOL)flag
|
||||
{
|
||||
// Approximate compatibility behaviour
|
||||
_cell.is_disabled = flag;
|
||||
|
@ -767,14 +770,14 @@ static NSColor *shadowCol;
|
|||
{
|
||||
NS_DURING
|
||||
{
|
||||
[(NSControl *)cv sendAction: action to: [self target]];
|
||||
[(NSControl*)cv sendAction: action to: [self target]];
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
}
|
||||
else // We have no control view. The best we can do is the following.
|
||||
{
|
||||
|
@ -791,7 +794,7 @@ static NSColor *shadowCol;
|
|||
[localException raise];
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -841,7 +844,7 @@ static NSColor *shadowCol;
|
|||
*/
|
||||
- (BOOL) continueTracking: (NSPoint)lastPoint
|
||||
at: (NSPoint)currentPoint
|
||||
inView: (NSView *)controlView
|
||||
inView: (NSView*)controlView
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
@ -852,13 +855,13 @@ static NSColor *shadowCol;
|
|||
return 0;
|
||||
}
|
||||
|
||||
- (void) getPeriodicDelay: (float *)delay interval: (float *)interval
|
||||
- (void) getPeriodicDelay: (float*)delay interval: (float*)interval
|
||||
{
|
||||
*delay = 0.1;
|
||||
*interval = 0.1;
|
||||
}
|
||||
|
||||
- (BOOL) startTrackingAt: (NSPoint)startPoint inView: (NSView *)controlView
|
||||
- (BOOL) startTrackingAt: (NSPoint)startPoint inView: (NSView*)controlView
|
||||
{
|
||||
// If the point is in the view then yes start tracking
|
||||
if ([controlView mouse: startPoint inRect: [controlView bounds]])
|
||||
|
@ -869,14 +872,14 @@ static NSColor *shadowCol;
|
|||
|
||||
- (void) stopTracking: (NSPoint)lastPoint
|
||||
at: (NSPoint)stopPoint
|
||||
inView: (NSView *)controlView
|
||||
inView: (NSView*)controlView
|
||||
mouseIsUp: (BOOL)flag
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) trackMouse: (NSEvent *)theEvent
|
||||
- (BOOL) trackMouse: (NSEvent*)theEvent
|
||||
inRect: (NSRect)cellFrame
|
||||
ofView: (NSView *)controlView
|
||||
ofView: (NSView*)controlView
|
||||
untilMouseUp: (BOOL)flag
|
||||
{
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
|
@ -1025,7 +1028,7 @@ static NSColor *shadowCol;
|
|||
/*
|
||||
* Managing the Cursor
|
||||
*/
|
||||
- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView *)controlView
|
||||
- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView*)controlView
|
||||
{
|
||||
if (_cell.type == NSTextCellType && _cell.is_disabled == NO
|
||||
&& (_cell.is_selectable == YES || _cell.is_editable == YES))
|
||||
|
@ -1064,8 +1067,6 @@ static NSColor *shadowCol;
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (NSSize) cellSize
|
||||
{
|
||||
NSSize borderSize, s;
|
||||
|
@ -1088,23 +1089,25 @@ static NSColor *shadowCol;
|
|||
// Get Content Size
|
||||
switch (_cell.type)
|
||||
{
|
||||
case NSTextCellType:
|
||||
s=GSUtil_sizeOfMultilineStringWithFont(_contents,_cell_font);
|
||||
case NSTextCellType:
|
||||
s = GSUtil_sizeOfMultilineStringWithFont(_contents, _cell_font);
|
||||
break;
|
||||
case NSImageCellType:
|
||||
if (_cell_image == nil)
|
||||
{
|
||||
s = NSZeroSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = [_cell_image size];
|
||||
}
|
||||
break;
|
||||
case NSNullCellType:
|
||||
// macosx instead returns a 'very big size' here; we return NSZeroSize
|
||||
s = NSZeroSize;
|
||||
break;
|
||||
|
||||
case NSImageCellType:
|
||||
if (_cell_image == nil)
|
||||
{
|
||||
s = NSZeroSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = [_cell_image size];
|
||||
}
|
||||
break;
|
||||
|
||||
case NSNullCellType:
|
||||
// macosx instead returns a 'very big size' here; we return NSZeroSize
|
||||
s = NSZeroSize;
|
||||
break;
|
||||
}
|
||||
|
||||
// Add in border size
|
||||
|
@ -1136,7 +1139,7 @@ static NSColor *shadowCol;
|
|||
else
|
||||
borderSize = NSZeroSize;
|
||||
|
||||
return NSInsetRect (theRect, borderSize.width, borderSize.height);
|
||||
return NSInsetRect(theRect, borderSize.width, borderSize.height);
|
||||
}
|
||||
|
||||
- (NSRect) imageRectForBounds: (NSRect)theRect
|
||||
|
@ -1183,7 +1186,7 @@ static NSColor *shadowCol;
|
|||
return txtCol;
|
||||
}
|
||||
|
||||
- (void) _drawText: (NSString *) title inFrame: (NSRect) cellFrame
|
||||
- (void) _drawText: (NSString*) title inFrame: (NSRect) cellFrame
|
||||
{
|
||||
NSColor *textColor;
|
||||
float titleWidth;
|
||||
|
@ -1266,10 +1269,10 @@ static NSColor *shadowCol;
|
|||
[title drawInRect: cellFrame withAttributes: dict];
|
||||
}
|
||||
|
||||
//
|
||||
// This drawing is minimal and with no background,
|
||||
// to make it easier for subclass to customize drawing.
|
||||
//
|
||||
/*
|
||||
* This drawing is minimal and with no background,
|
||||
* to make it easier for subclass to customize drawing.
|
||||
*/
|
||||
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
||||
{
|
||||
if (![controlView window])
|
||||
|
@ -1358,10 +1361,13 @@ static NSColor *shadowCol;
|
|||
if (_cell.is_highlighted != lit)
|
||||
{
|
||||
_cell.is_highlighted = lit;
|
||||
// NB: This has a visible effect only if subclasses override drawWithFrame:inView:
|
||||
// to draw something special when the cell is highlighted.
|
||||
// NSCell simply draws border+text/image and makes no highlighting,
|
||||
// for easier subclassing.
|
||||
/*
|
||||
* NB: This has a visible effect only if subclasses override
|
||||
* drawWithFrame:inView: to draw something special when the
|
||||
* cell is highlighted.
|
||||
* NSCell simply draws border+text/image and makes no highlighting,
|
||||
* for easier subclassing.
|
||||
*/
|
||||
[self drawWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
}
|
||||
|
@ -1370,13 +1376,13 @@ static NSColor *shadowCol;
|
|||
* Editing Text
|
||||
*/
|
||||
- (void) editWithFrame: (NSRect)aRect
|
||||
inView: (NSView *)controlView
|
||||
editor: (NSText *)textObject
|
||||
inView: (NSView*)controlView
|
||||
editor: (NSText*)textObject
|
||||
delegate: (id)anObject
|
||||
event: (NSEvent *)theEvent
|
||||
event: (NSEvent*)theEvent
|
||||
{
|
||||
if (!controlView || !textObject || !_cell_font ||
|
||||
(_cell.type != NSTextCellType))
|
||||
if (!controlView || !textObject || !_cell_font
|
||||
|| (_cell.type != NSTextCellType))
|
||||
return;
|
||||
|
||||
[textObject setFrame: [self titleRectForBounds: aRect]];
|
||||
|
@ -1397,14 +1403,14 @@ static NSColor *shadowCol;
|
|||
}
|
||||
|
||||
- (void) selectWithFrame: (NSRect)aRect
|
||||
inView: (NSView *)controlView
|
||||
editor: (NSText *)textObject
|
||||
inView: (NSView*)controlView
|
||||
editor: (NSText*)textObject
|
||||
delegate: (id)anObject
|
||||
start: (int)selStart
|
||||
length: (int)selLength
|
||||
{
|
||||
if (!controlView || !textObject || !_cell_font ||
|
||||
(_cell.type != NSTextCellType))
|
||||
if (!controlView || !textObject || !_cell_font
|
||||
|| (_cell.type != NSTextCellType))
|
||||
return;
|
||||
|
||||
[textObject setFrame: [self titleRectForBounds: aRect]];
|
||||
|
@ -1416,13 +1422,13 @@ static NSColor *shadowCol;
|
|||
[textObject display];
|
||||
}
|
||||
|
||||
- (BOOL)sendsActionOnEndEditing
|
||||
- (BOOL) sendsActionOnEndEditing
|
||||
{
|
||||
//TODO
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)setSendsActionOnEndEditing:(BOOL)flag
|
||||
- (void) setSendsActionOnEndEditing: (BOOL)flag
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
@ -1566,13 +1572,13 @@ _sizeForBorderType (NSBorderType aType)
|
|||
// Returns the size of a border
|
||||
switch (aType)
|
||||
{
|
||||
case NSLineBorder:
|
||||
return NSMakeSize(1, 1);
|
||||
case NSGrooveBorder:
|
||||
case NSBezelBorder:
|
||||
return NSMakeSize(2, 2);
|
||||
case NSNoBorder:
|
||||
default:
|
||||
return NSZeroSize;
|
||||
case NSLineBorder:
|
||||
return NSMakeSize(1, 1);
|
||||
case NSGrooveBorder:
|
||||
case NSBezelBorder:
|
||||
return NSMakeSize(2, 2);
|
||||
case NSNoBorder:
|
||||
default:
|
||||
return NSZeroSize;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,9 +42,9 @@
|
|||
|
||||
@implementation NSSplitView
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
- (id) initWithFrame: (NSRect)frameRect
|
||||
{
|
||||
if ((self = [super initWithFrame: frameRect]) != nil)
|
||||
|
@ -58,7 +58,8 @@
|
|||
}
|
||||
return self;
|
||||
}
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent *)theEvent
|
||||
|
||||
- (BOOL) acceptsFirstMouse: (NSEvent*)theEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
@ -115,7 +116,10 @@
|
|||
r = [prev frame];
|
||||
else
|
||||
{
|
||||
/* This happens if user pressed exactly on the top of the top subview */
|
||||
/*
|
||||
* This happens if user pressed exactly on the
|
||||
* top of the top subview
|
||||
*/
|
||||
goto RETURN_LABEL;
|
||||
}
|
||||
if (v)
|
||||
|
@ -138,7 +142,10 @@
|
|||
r = [prev frame];
|
||||
else
|
||||
{
|
||||
/* This happens if user pressed exactly on the left of the left subview */
|
||||
/*
|
||||
* This happens if user pressed exactly on the
|
||||
* left of the left subview
|
||||
*/
|
||||
goto RETURN_LABEL;
|
||||
}
|
||||
if (v)
|
||||
|
@ -413,14 +420,18 @@ RETURN_LABEL:
|
|||
|
||||
- (float) dividerThickness
|
||||
{
|
||||
// You need to override this method in subclasses to change the
|
||||
// dividerThickness (or, without need for subclassing, invoke
|
||||
// setDimpleImage:resetDividerThickness:YES below)
|
||||
/*
|
||||
* You need to override this method in subclasses to change the
|
||||
* dividerThickness (or, without need for subclassing, invoke
|
||||
* setDimpleImage:resetDividerThickness:YES below)
|
||||
*/
|
||||
return 6;
|
||||
}
|
||||
|
||||
// FIXME: Perhaps the following two should be removed and _dividerWidth
|
||||
// should be used also for dragging?
|
||||
/*
|
||||
* FIXME: Perhaps the following two should be removed and _dividerWidth
|
||||
* should be used also for dragging?
|
||||
*/
|
||||
- (float) draggedBarWidth //defaults to 8
|
||||
{
|
||||
return _draggedBarWidth;
|
||||
|
@ -430,7 +441,7 @@ RETURN_LABEL:
|
|||
{
|
||||
_draggedBarWidth = newWidth;
|
||||
}
|
||||
//
|
||||
|
||||
static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
||||
{
|
||||
NSPoint p;
|
||||
|
@ -471,7 +482,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
return _isVertical;
|
||||
}
|
||||
|
||||
- (void) setDimpleImage: (NSImage *)anImage resetDividerThickness: (BOOL)flag
|
||||
- (void) setDimpleImage: (NSImage*)anImage resetDividerThickness: (BOOL)flag
|
||||
{
|
||||
ASSIGN(_dimpleImage, anImage);
|
||||
|
||||
|
@ -589,9 +600,9 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
|
|||
ASSIGN(_backgroundColor, aColor);
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
//
|
||||
/*
|
||||
* NSCoding protocol
|
||||
*/
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
|
Loading…
Reference in a new issue