From ad03e246b89dd3d67e8f0c826fa01fff169039bf Mon Sep 17 00:00:00 2001 From: nico Date: Thu, 2 Mar 2000 02:52:45 +0000 Subject: [PATCH] Patched so that gmodels can be created from macosx nibs; changed image code to be more friendly with menus in gmodels from macosx nibs git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6150 72102866-910b-0410-8b05-ffd578937521 --- Model/GMAppKit.m | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/Model/GMAppKit.m b/Model/GMAppKit.m index 08afbfc5b..49e786080 100644 --- a/Model/GMAppKit.m +++ b/Model/GMAppKit.m @@ -47,7 +47,9 @@ void __dummy_GMAppKit_functionForLinking() {} for (i = 0; i < count; i++) { NSWindow* window = [windows1 objectAtIndex:i]; - if (![window isKindOfClass:[NSMenu class]]) + if (([window isKindOfClass:[NSMenu class]] == NO) + && ([NSStringFromClass ([window class]) + isEqualToString: @"NSMenuPanel"] == NO)) [windows2 addObject:window]; } [archiver encodeObject:windows2 withName:@"windows"]; @@ -702,10 +704,30 @@ void __dummy_GMAppKit_functionForLinking() {} + (id)createObjectForModelUnarchiver:(GMUnarchiver*)unarchiver { - id image = [NSImage imageNamed:[unarchiver decodeStringWithName:@"name"]]; + id image = nil; + NSString *imageName; + + imageName = [unarchiver decodeStringWithName:@"name"]; + + /* If the image is a standard system image with the MacOSX name, + convert the name to the GNUstep name */ +#ifdef GNU_GUI_LIBRARY + if ([imageName isEqualToString: @"NSMenuCheckmark"]) + imageName = @"common_2DCheckMark"; + else if ([imageName isEqualToString: @"NSMenuArrow"]) + imageName = @"common_3DArrowRight"; + /* else if ([imageName isEqualToString: @"NSMenuMixedState"]) + imageName = @"common_??";*/ + else if ([imageName isEqualToString: @"NSAppleMenuImage"]) + imageName = @"GNUstepMenuImage"; +#endif + + if (imageName) + image = [NSImage imageNamed: imageName]; + + if (image == nil) + image = [NSImage imageNamed:@"GNUstepMenuImage"]; - if (!image) - image = [NSImage imageNamed:@"NSRadioButton"]; return image; }