mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Merge branch 'master' into NSStoryboard_branch2
This commit is contained in:
commit
ecd01a8e62
5 changed files with 82 additions and 37 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2020-07-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/GSXib5KeyedUnarchiver.m (alternateName:): Be more careful
|
||||
when chopping of part of the name.
|
||||
|
||||
2020-07-03 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/AppKit/NSNib.h,
|
||||
* Source/NSNib.m: Add missing MacOSX methods.
|
||||
* Source/GSXibLoader.m: Remove semicolon. Add debug logs.
|
||||
|
||||
2020-06-15 Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Headers/AppKit/AppKit.h
|
||||
|
|
|
@ -60,17 +60,23 @@ APPKIT_EXPORT NSString *NSNibTopLevelObjects;
|
|||
APPKIT_EXPORT NSString *NSNibOwner;
|
||||
#endif
|
||||
|
||||
typedef NSString *NSNibName;
|
||||
|
||||
@interface NSNib : NSObject <NSCoding>
|
||||
{
|
||||
NSData *_nibData;
|
||||
id _loader;
|
||||
NSURL *_url;
|
||||
NSBundle *_bundle;
|
||||
}
|
||||
|
||||
// reading the data...
|
||||
- (id)initWithContentsOfURL: (NSURL *)nibFileURL;
|
||||
- (id)initWithNibNamed: (NSString *)nibNamed bundle: (NSBundle *)bundle;
|
||||
- (instancetype)initWithNibNamed: (NSNibName)nibNamed bundle: (NSBundle *)bundle;
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
|
||||
- (instancetype)initWithNibData: (NSData *)nibData
|
||||
bundle: (NSBundle *)bundle;
|
||||
#endif
|
||||
|
||||
// instantiating the nib.
|
||||
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable;
|
||||
|
@ -79,7 +85,10 @@ APPKIT_EXPORT NSString *NSNibOwner;
|
|||
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
||||
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable withZone: (NSZone *)zone;
|
||||
#endif
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST)
|
||||
- (BOOL)instantiateWithOwner: (id)owner
|
||||
topLevelObjects: (NSArray **)topLevelObjects;
|
||||
#endif
|
||||
@end
|
||||
|
||||
#endif /* _GNUstep_H_NSNib */
|
||||
|
|
|
@ -95,6 +95,9 @@
|
|||
return;
|
||||
}
|
||||
|
||||
NSDebugLLog(@"XIB", @"First object %@", [rootObjects objectAtIndex: 0]);
|
||||
NSDebugLLog(@"XIB", @"Second object %@", [rootObjects objectAtIndex: 1]);
|
||||
NSDebugLLog(@"XIB", @"Third object %@", [rootObjects objectAtIndex: 2]);
|
||||
// Use the owner as first root object
|
||||
[(NSCustomObject*)[rootObjects objectAtIndex: 0] setRealObject: owner];
|
||||
|
||||
|
@ -142,7 +145,7 @@
|
|||
|
||||
- (BOOL) loadModelData: (NSData *)data
|
||||
externalNameTable: (NSDictionary *)context
|
||||
withZone: (NSZone *)zone;
|
||||
withZone: (NSZone *)zone
|
||||
{
|
||||
BOOL loaded = NO;
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/** <title>NSNib</title>
|
||||
|
||||
|
||||
<abstract>
|
||||
This class serves as a container for a nib file. It's possible
|
||||
to load a nib file from a URL or from a bundle. Using this
|
||||
class the nib file can now be "preloaded" and instantiated
|
||||
multiple times when/if needed. Also, since it's possible to
|
||||
initialize this class using a NSURL it's possible to load
|
||||
nib files from remote locations.
|
||||
This class serves as a container for a nib file. It's possible
|
||||
to load a nib file from a URL or from a bundle. Using this
|
||||
class the nib file can now be "preloaded" and instantiated
|
||||
multiple times when/if needed. Also, since it's possible to
|
||||
initialize this class using a NSURL it's possible to load
|
||||
nib files from remote locations.
|
||||
<br/>
|
||||
This class uses: NSNibOwner and NSNibTopLevelObjects to allow
|
||||
the caller to specify the owner of the nib during instantiation
|
||||
|
@ -18,7 +18,7 @@
|
|||
|
||||
Author: Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
Date: 2004
|
||||
|
||||
|
||||
This file is part of the GNUstep GUI Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
|
@ -33,10 +33,10 @@
|
|||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; see the file COPYING.LIB.
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
If not, see <http://www.gnu.org/licenses/> or write to the
|
||||
Free Software Foundation, 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
#import "config.h"
|
||||
#import <Foundation/NSArray.h>
|
||||
|
@ -80,12 +80,12 @@
|
|||
* any type of resource capable of being pointed to by the NSURL object.
|
||||
* A file in the local file system or a file on an ftp site.
|
||||
*/
|
||||
- (id)initWithContentsOfURL: (NSURL *)nibFileURL
|
||||
- (id) initWithContentsOfURL: (NSURL *)nibFileURL
|
||||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
ASSIGN(_url, nibFileURL);
|
||||
|
||||
// Currently we need this short cut for GModel files.
|
||||
// Remove this when the hack there is cleaned up.
|
||||
if ([nibFileURL isFileURL])
|
||||
{
|
||||
[self _readNibData: [nibFileURL path]];
|
||||
|
@ -94,10 +94,10 @@
|
|||
{
|
||||
NS_DURING
|
||||
{
|
||||
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType:
|
||||
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType:
|
||||
[[nibFileURL path] pathExtension]]);
|
||||
// load the nib data into memory...
|
||||
_nibData = [NSData dataWithContentsOfURL: nibFileURL];
|
||||
ASSIGN(_nibData, [NSData dataWithContentsOfURL: nibFileURL]);
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
|
@ -111,10 +111,11 @@
|
|||
|
||||
/**
|
||||
* Load the nib indicated by <code>nibNamed</code>. If the <code>bundle</code>
|
||||
* argument is <code>nil</code>, then the main bundle is used to resolve
|
||||
* argument is <code>nil</code>, then the main bundle is used to resolve
|
||||
* the path, otherwise the bundle which is supplied will be used.
|
||||
*/
|
||||
- (id)initWithNibNamed: (NSString *)nibNamed bundle: (NSBundle *)bundle
|
||||
- (instancetype) initWithNibNamed: (NSNibName)nibNamed
|
||||
bundle: (NSBundle *)bundle
|
||||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
|
@ -142,15 +143,28 @@
|
|||
return self;
|
||||
}
|
||||
|
||||
- (instancetype) initWithNibData: (NSData *)nibData
|
||||
bundle: (NSBundle *)bundle
|
||||
{
|
||||
if ((self = [super init]) != nil)
|
||||
{
|
||||
ASSIGN(_bundle, bundle);
|
||||
ASSIGN(_nibData, nibData);
|
||||
// FIXME: Hardcode the most likely loader
|
||||
ASSIGN(_loader, [GSModelLoaderFactory modelLoaderForFileType: @"nib"]);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a GNUstep specific method. This method is used when the caller
|
||||
* wants the objects instantiated in the nib to be stored in the given
|
||||
* This is a GNUstep specific method. This method is used when the caller
|
||||
* wants the objects instantiated in the nib to be stored in the given
|
||||
* <code>zone</code>.
|
||||
*/
|
||||
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
|
||||
withZone: (NSZone *)zone
|
||||
- (BOOL) instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
|
||||
withZone: (NSZone *)zone
|
||||
{
|
||||
return [_loader loadModelData: _nibData
|
||||
return [_loader loadModelData: _nibData
|
||||
externalNameTable: externalNameTable
|
||||
withZone: zone];
|
||||
}
|
||||
|
@ -158,22 +172,23 @@
|
|||
/**
|
||||
* This method instantiates the nib file. The externalNameTable dictionary
|
||||
* accepts the NSNibOwner and NSNibTopLevelObjects entries described earlier.
|
||||
* It is recommended, for subclasses whose purpose is to change the behaviour
|
||||
* It is recommended, for subclasses whose purpose is to change the behaviour
|
||||
* of nib loading, to override this method.
|
||||
*/
|
||||
- (BOOL)instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
|
||||
- (BOOL) instantiateNibWithExternalNameTable: (NSDictionary *)externalNameTable
|
||||
{
|
||||
return [self instantiateNibWithExternalNameTable: externalNameTable
|
||||
withZone: NSDefaultMallocZone()];
|
||||
}
|
||||
|
||||
/**
|
||||
* This method instantiates the nib file. It utilizes the
|
||||
* instantiateNibWithExternalNameTable: method to, in a convenient way,
|
||||
* This method instantiates the nib file. It utilizes the
|
||||
* instantiateNibWithExternalNameTable: method to, in a convenient way,
|
||||
* allow the user to specify both keys accepted by the
|
||||
* nib loading process.
|
||||
*/
|
||||
- (BOOL)instantiateNibWithOwner: (id)owner topLevelObjects: (NSArray **)topLevelObjects
|
||||
- (BOOL) instantiateNibWithOwner: (id)owner
|
||||
topLevelObjects: (NSArray **)topLevelObjects
|
||||
{
|
||||
NSMutableDictionary *externalNameTable = [NSMutableDictionary dictionary];
|
||||
|
||||
|
@ -186,7 +201,13 @@
|
|||
[externalNameTable setObject: *topLevelObjects forKey: NSNibTopLevelObjects];
|
||||
}
|
||||
|
||||
return [self instantiateNibWithExternalNameTable: externalNameTable];
|
||||
return [self instantiateNibWithExternalNameTable: externalNameTable];
|
||||
}
|
||||
|
||||
- (BOOL) instantiateWithOwner: (id)owner
|
||||
topLevelObjects: (NSArray **)topLevelObjects
|
||||
{
|
||||
return [self instantiateNibWithOwner: owner topLevelObjects: topLevelObjects];
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)coder
|
||||
|
@ -221,8 +242,8 @@
|
|||
if ([coder allowsKeyedCoding])
|
||||
{
|
||||
// TODO_NIB: Need to verify this key...
|
||||
[coder encodeObject: _nibData
|
||||
forKey: @"NSData"];
|
||||
[coder encodeObject: _nibData
|
||||
forKey: @"NSData"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -236,7 +257,6 @@
|
|||
RELEASE(_nibData);
|
||||
RELEASE(_loader);
|
||||
TEST_RELEASE(_bundle);
|
||||
TEST_RELEASE(_url);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
|
|
@ -563,6 +563,8 @@
|
|||
if ([aDecoder containsValueForKey: @"NSTabViewItems"])
|
||||
{
|
||||
ASSIGN(_items, [aDecoder decodeObjectForKey: @"NSTabViewItems"]);
|
||||
[_items makeObjectsPerformSelector: @selector(_setTabView:) withObject: self];
|
||||
|
||||
}
|
||||
if ([aDecoder containsValueForKey: @"NSSelectedTabViewItem"])
|
||||
{
|
||||
|
@ -570,7 +572,7 @@
|
|||
// and sets it to [self contentRect].
|
||||
//
|
||||
// This is desirable because the subview frame will be different
|
||||
// depending on whether the arcive is from Cocoa or GNUstep,
|
||||
// depending on whether the archive is from Cocoa or GNUstep,
|
||||
// and which GNUstep theme was active at save time.
|
||||
//
|
||||
// However, it does mean that the tab view contents should be
|
||||
|
|
Loading…
Reference in a new issue