mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-29 22:07:39 +00:00
Documentation and prevention of a leak in case of exception.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18302 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
821f7018a7
commit
0f64c6ffed
4 changed files with 118 additions and 10 deletions
|
@ -1,3 +1,11 @@
|
|||
2003-01-01 23:22 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSBundleAdditions.m: Moved the declaration of
|
||||
nibitems in loadNibFile:externalNameTable:withZone: so
|
||||
that it can be released if there is an exception.
|
||||
* Source/NSActionCell.m: Documentation.
|
||||
* Source/NSScreen.m: Documentation.
|
||||
|
||||
2003-12-31 01:07 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* KeyBindings/DefaultKeyBindings.dict: Uncomment the
|
||||
|
@ -27,7 +35,6 @@
|
|||
NSDrawLightBezel().
|
||||
* Source/NSTableHeaderView.m (-drawRect:) Use NSDrawTiledRects()
|
||||
instead of DPS operations.
|
||||
|
||||
|
||||
2003-12-30 00:48 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
|
|
|
@ -53,6 +53,10 @@ static Class controlClass;
|
|||
/*
|
||||
* Configuring an NSActionCell
|
||||
*/
|
||||
|
||||
/**
|
||||
* Sets the alignment of text within the receiver.
|
||||
*/
|
||||
- (void) setAlignment: (NSTextAlignment)mode
|
||||
{
|
||||
[super setAlignment: mode];
|
||||
|
@ -61,6 +65,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* If <code>YES</code> then the receiver is drawn with a bezeled border.
|
||||
*/
|
||||
- (void) setBezeled: (BOOL)flag
|
||||
{
|
||||
_cell.is_bezeled = flag;
|
||||
|
@ -71,6 +78,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* If <code>YES</code> then receiver is drawn with a border.
|
||||
*/
|
||||
- (void) setBordered: (BOOL)flag
|
||||
{
|
||||
_cell.is_bordered = flag;
|
||||
|
@ -81,6 +91,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* If <code>YES</code> then the receiver is capable of accepting input.
|
||||
*/
|
||||
- (void) setEnabled: (BOOL)flag
|
||||
{
|
||||
_cell.is_disabled = !flag;
|
||||
|
@ -101,6 +114,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the font to be used in the receiver.
|
||||
*/
|
||||
- (void) setFont: (NSFont*)fontObject
|
||||
{
|
||||
[super setFont: fontObject];
|
||||
|
@ -110,6 +126,9 @@ static Class controlClass;
|
|||
// TODO: This should also set the font of the text object, when selected
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the image to be displayed in the receiver.
|
||||
*/
|
||||
- (void) setImage: (NSImage*)image
|
||||
{
|
||||
[super setImage: image];
|
||||
|
@ -122,6 +141,9 @@ static Class controlClass;
|
|||
* Manipulating NSActionCell Values
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieve the value of the receiver as an NSString.
|
||||
*/
|
||||
- (NSString *)stringValue
|
||||
{
|
||||
if (_control_view)
|
||||
|
@ -130,6 +152,9 @@ static Class controlClass;
|
|||
return [super stringValue];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the value of the receiver as a double.
|
||||
*/
|
||||
- (double)doubleValue
|
||||
{
|
||||
if (_control_view)
|
||||
|
@ -138,6 +163,9 @@ static Class controlClass;
|
|||
return [super doubleValue];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the value of the receiver as a float.
|
||||
*/
|
||||
- (float)floatValue
|
||||
{
|
||||
if (_control_view)
|
||||
|
@ -146,6 +174,9 @@ static Class controlClass;
|
|||
return [super floatValue];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the value of the receiver as an int.
|
||||
*/
|
||||
- (int)intValue
|
||||
{
|
||||
if (_control_view)
|
||||
|
@ -154,6 +185,9 @@ static Class controlClass;
|
|||
return [super intValue];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the receiver from anObject.
|
||||
*/
|
||||
- (void) setObjectValue: (NSString*)anObject
|
||||
{
|
||||
[super setObjectValue: anObject];
|
||||
|
@ -162,6 +196,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the receiver from aString.
|
||||
*/
|
||||
- (void) setStringValue: (NSString*)aString
|
||||
{
|
||||
[super setStringValue: aString];
|
||||
|
@ -170,6 +207,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the receiver from aDouble.
|
||||
*/
|
||||
- (void) setDoubleValue: (double)aDouble
|
||||
{
|
||||
[super setDoubleValue: aDouble];
|
||||
|
@ -178,6 +218,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the receiver from aFloat.
|
||||
*/
|
||||
- (void) setFloatValue: (float)aFloat
|
||||
{
|
||||
[super setFloatValue: aFloat];
|
||||
|
@ -186,6 +229,9 @@ static Class controlClass;
|
|||
[(NSControl *)_control_view updateCell: self];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the receiver from anInt.
|
||||
*/
|
||||
- (void) setIntValue: (int)anInt
|
||||
{
|
||||
[super setIntValue: anInt];
|
||||
|
@ -197,40 +243,58 @@ static Class controlClass;
|
|||
/*
|
||||
* Target and Action
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieve the action from the receiver.
|
||||
*/
|
||||
- (SEL) action
|
||||
{
|
||||
return _action;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the action in the receiver as the selector aSelector.
|
||||
*/
|
||||
- (void) setAction: (SEL)aSelector
|
||||
{
|
||||
_action = aSelector;
|
||||
}
|
||||
|
||||
/* NSActionCell does not retain its target! */
|
||||
/**
|
||||
* Set the target in the receiver as anObject. NSActionCell does not retain its target!
|
||||
*/
|
||||
- (void) setTarget: (id)anObject
|
||||
{
|
||||
_target = anObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the target of the receiver.
|
||||
*/
|
||||
- (id) target
|
||||
{
|
||||
return _target;
|
||||
}
|
||||
|
||||
/*
|
||||
* Assigning a Tag
|
||||
/**
|
||||
* Assigning a Tag.
|
||||
*/
|
||||
- (void) setTag: (int)anInt
|
||||
{
|
||||
_tag = anInt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the tag.
|
||||
*/
|
||||
- (int) tag
|
||||
{
|
||||
return _tag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the control view of the receiver.
|
||||
*/
|
||||
-(NSView *)controlView
|
||||
{
|
||||
return _control_view;
|
||||
|
|
|
@ -286,6 +286,7 @@ Class gmodel_class(void)
|
|||
BOOL loaded = NO;
|
||||
NSUnarchiver *unarchiver = nil;
|
||||
NSString *ext = [fileName pathExtension];
|
||||
id nibitems = nil;
|
||||
|
||||
if ([ext isEqual: @"nib"])
|
||||
{
|
||||
|
@ -344,7 +345,8 @@ Class gmodel_class(void)
|
|||
if (unarchiver != nil)
|
||||
{
|
||||
id obj;
|
||||
id nibitems = [[_GSNibItemCollector alloc] init];
|
||||
|
||||
nibitems = [[_GSNibItemCollector alloc] init];
|
||||
NSDebugLog(@"Invoking unarchiver");
|
||||
[unarchiver setObjectZone: zone];
|
||||
obj = [unarchiver decodeObject];
|
||||
|
@ -363,8 +365,8 @@ Class gmodel_class(void)
|
|||
{
|
||||
NSLog(@"Nib '%@' without container object!", fileName);
|
||||
}
|
||||
RELEASE(nibitems);
|
||||
}
|
||||
RELEASE(nibitems);
|
||||
RELEASE(unarchiver);
|
||||
}
|
||||
}
|
||||
|
@ -373,6 +375,7 @@ Class gmodel_class(void)
|
|||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Exception occured while loading model: %@",[localException reason]);
|
||||
TEST_RELEASE(nibitems);
|
||||
TEST_RELEASE(unarchiver);
|
||||
}
|
||||
NS_ENDHANDLER
|
||||
|
|
|
@ -54,11 +54,18 @@
|
|||
|
||||
static NSMutableArray *screenArray = nil;
|
||||
|
||||
/**
|
||||
* Resets the cached list of screens.
|
||||
*/
|
||||
+ (void) resetScreens
|
||||
{
|
||||
screenArray = nil;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an NSArray containing NSScreen instances representing all of the
|
||||
* screen devices attached to the computer.
|
||||
*/
|
||||
+ (NSArray*) screens
|
||||
{
|
||||
int count = 0, index = 0;
|
||||
|
@ -95,11 +102,17 @@ static NSMutableArray *screenArray = nil;
|
|||
}
|
||||
|
||||
// Creating NSScreen Instances
|
||||
/**
|
||||
* Gets information about the main screen.
|
||||
*/
|
||||
+ (NSScreen*) mainScreen
|
||||
{
|
||||
return [[self screens] objectAtIndex: 0];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information about the screen with the highest depth (i.e. bits per pixel).
|
||||
*/
|
||||
+ (NSScreen*) deepestScreen
|
||||
{
|
||||
NSArray *screenArray = [self screens];
|
||||
|
@ -131,14 +144,18 @@ static NSMutableArray *screenArray = nil;
|
|||
* Instance methods
|
||||
*/
|
||||
|
||||
// NSScreen does not respond to the init method.
|
||||
/**
|
||||
* NSScreen does not respond to the init method.
|
||||
*/
|
||||
- (id) init
|
||||
{
|
||||
[self doesNotRecognizeSelector: _cmd];
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Get all of the infomation for a given screen.
|
||||
/**
|
||||
* Get all of the infomation for a given screen.
|
||||
*/
|
||||
- (id) _initWithScreenNumber: (int)screen
|
||||
{
|
||||
GSDisplayServer *srv;
|
||||
|
@ -187,19 +204,30 @@ static NSMutableArray *screenArray = nil;
|
|||
return NO;
|
||||
}
|
||||
|
||||
/*
|
||||
* Reading Screen Information
|
||||
/**
|
||||
* Returns the depth of the screen in bits.
|
||||
*/
|
||||
- (NSWindowDepth) depth
|
||||
{
|
||||
return _depth;
|
||||
}
|
||||
|
||||
/**
|
||||
* The full frame of the screen.
|
||||
*/
|
||||
- (NSRect) frame
|
||||
{
|
||||
return _frame;
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* This method generates a dictionary containing information
|
||||
* about the screen device. The resulting dictionary will have the following
|
||||
* entires: NSScreenNumber, NSDeviceSize, NSDeviceResolution, NSDeviceBitsPerSample,
|
||||
* NSDeviceColorSpaceName.
|
||||
* </p>
|
||||
*/
|
||||
- (NSDictionary*) deviceDescription
|
||||
{
|
||||
NSMutableDictionary *devDesc;
|
||||
|
@ -243,6 +271,9 @@ static NSMutableArray *screenArray = nil;
|
|||
}
|
||||
|
||||
// Mac OS X methods
|
||||
/**
|
||||
* Returns the window depths this screen will support.
|
||||
*/
|
||||
- (const NSWindowDepth*) supportedWindowDepths
|
||||
{
|
||||
// If the variable isn't initialized, get the info and
|
||||
|
@ -264,6 +295,9 @@ static NSMutableArray *screenArray = nil;
|
|||
return _supportedWindowDepths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the NSRect representing the visible area of the screen.
|
||||
*/
|
||||
- (NSRect) visibleFrame
|
||||
{
|
||||
NSRect visFrame = _frame;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue