Allow loading of images from the owners bundle

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24119 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2006-11-17 04:53:09 +00:00
parent 445af8595d
commit a4934bedfd
2 changed files with 17 additions and 0 deletions

View file

@ -756,6 +756,8 @@ void __dummy_GMAppKit_functionForLinking() {}
@implementation NSImage (GMArchiverMethods)
extern id _nibOwner;
- (void)encodeWithModelArchiver:(GMArchiver*)archiver
{
[archiver encodeString:[self name] withName:@"name"];
@ -770,7 +772,16 @@ void __dummy_GMAppKit_functionForLinking() {}
imageName = [unarchiver decodeStringWithName:@"name"];
if (imageName)
{
image = [NSImage imageNamed: imageName];
if (image == nil)
{
NSBundle *bundle = [NSBundle bundleForClass:[_nibOwner class]];
NSString *path = [bundle pathForImageResource:imageName];
image = [[NSImage alloc] initByReferencingFile:path];
}
}
if (image == nil)
image = [NSImage imageNamed:@"GNUstepMenuImage"];