Update to handle GormNSPanel which overrides panel when in the app

This commit is contained in:
Gregory John Casamento 2023-09-20 12:54:41 -04:00
parent dc69034c54
commit 13507ab8d7

View file

@ -69,6 +69,25 @@ static NSDictionary *_valueMapping = nil;
static NSUInteger _count = INT_MAX; static NSUInteger _count = INT_MAX;
/*
NSString* XIBStringFromClass(Class cls)
{
NSString *className = NSStringFromClass(cls);
if (className != nil)
{
NSString *newClassName = [_mappedClassNames objectForKey: className];
if (newClassName != nil)
{
className = newClassName;
}
}
return className;
}
*/
@interface NSButtonCell (_Private_) @interface NSButtonCell (_Private_)
- (NSButtonType) buttonType; - (NSButtonType) buttonType;
@ -496,12 +515,12 @@ static NSUInteger _count = INT_MAX;
{ {
NSString *className = name; NSString *className = name;
NSLog(@"Name = %@", name); // NSLog(@"Name = %@", name);
if ([_mappedClassNames objectForKey: name]) if ([_mappedClassNames objectForKey: name])
{ {
className = [_mappedClassNames objectForKey: name]; className = [_mappedClassNames objectForKey: name];
NSLog(@"%@ => %@", name, className); // NSLog(@"%@ => %@", name, className);
} }
NSString *result = [className stringByReplacingOccurrencesOfString: @"NS" NSString *result = [className stringByReplacingOccurrencesOfString: @"NS"
@ -522,7 +541,7 @@ static NSUInteger _count = INT_MAX;
result = @"customObject"; result = @"customObject";
} }
NSLog(@"Result = %@", result); // NSLog(@"Result = %@", result);
return result; return result;
} }
@ -1732,6 +1751,12 @@ static NSUInteger _count = INT_MAX;
if ([obj isKindOfClass: [NSPanel class]]) if ([obj isKindOfClass: [NSPanel class]])
{ {
NSString *className = NSStringFromClass([obj class]); NSString *className = NSStringFromClass([obj class]);
if ([className isEqualToString: @"GormNSPanel"])
{
className = @"NSPanel";
}
NSXMLNode *attr = [NSXMLNode attributeWithName: @"customClass" stringValue: className]; NSXMLNode *attr = [NSXMLNode attributeWithName: @"customClass" stringValue: className];
[elem addAttribute: attr]; [elem addAttribute: attr];
} }