mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 15:11:04 +00:00
* Source/NSButtonCell.m (-initWithCoder:):
Fix image scaling value extract from XIB. * Headers/Additions/GNUstepGUI/GSXibLoading.h * Source/GSXibLoading.m * Source/GSXibLoader.m Add IB defined runtime attribute processing for XIB Patch by Marcian Lytwyn <gna@advcsi.com>. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@38882 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
f922f3a5a5
commit
3920ffef1c
5 changed files with 122 additions and 36 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2015-08-13 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSButtonCell.m (-initWithCoder:):
|
||||
Fix image scaling value extract from XIB.
|
||||
* Headers/Additions/GNUstepGUI/GSXibLoading.h
|
||||
* Source/GSXibLoading.m
|
||||
* Source/GSXibLoader.m
|
||||
Add IB defined runtime attribute processing for XIB
|
||||
Patch by Marcian Lytwyn <gna@advcsi.com>.
|
||||
|
||||
2015-08-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSTextView.m: Rewrite
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
@class NSString, NSDictionary, NSArray, NSMutableDictionary, NSMutableArray;
|
||||
@class NSNibBindingConnector;
|
||||
@class GSXibElement;
|
||||
@class NSNibConnector;
|
||||
|
||||
// Hack: This allows the class name FirstResponder in NSCustomObject and
|
||||
// correctly returns nil as the corresponding object.
|
||||
|
@ -158,6 +159,39 @@
|
|||
- (NSEnumerator *) objectRecordEnumerator;
|
||||
@end
|
||||
|
||||
@interface IBUserDefinedRuntimeAttributesPlaceholder : NSObject <NSCoding>
|
||||
{
|
||||
NSArray *runtimeAttributes;
|
||||
NSString *name;
|
||||
}
|
||||
|
||||
- (void) setName: (NSString *)name;
|
||||
- (NSString *) name;
|
||||
|
||||
- (void) setRuntimeAttributes: (NSArray *)attributes;
|
||||
- (NSArray *) runtimeAttributes;
|
||||
|
||||
@end
|
||||
|
||||
@interface IBUserDefinedRuntimeAttribute : NSObject <NSCoding>
|
||||
{
|
||||
NSString *typeIdentifier;
|
||||
NSString *keyPath;
|
||||
id value;
|
||||
}
|
||||
|
||||
- (void) setTypeIdentifier: (NSString *)type;
|
||||
- (NSString *) typeIdentifier;
|
||||
|
||||
- (void) setKeyPath: (NSString *)keyPath;
|
||||
- (NSString *) keyPath;
|
||||
|
||||
- (void) setValue: (id)value;
|
||||
- (id) value;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface GSXibKeyedUnarchiver: NSKeyedUnarchiver
|
||||
{
|
||||
NSMutableDictionary *objects;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSKeyedArchiver.h>
|
||||
#import <Foundation/NSKeyValueCoding.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSXMLParser.h>
|
||||
|
@ -857,11 +858,29 @@
|
|||
value = [properties objectForKey: @"IBAttributePlaceholdersKey"];
|
||||
if (value != nil)
|
||||
{
|
||||
IBToolTipAttribute *tta = [(NSDictionary*)value objectForKey: @"ToolTip"];
|
||||
NSDictionary *infodict = (NSDictionary*)value;
|
||||
|
||||
if ([realObj respondsToSelector: @selector(setToolTip:)])
|
||||
// Process tooltips...
|
||||
IBToolTipAttribute *tooltip = [infodict objectForKey: @"ToolTip"];
|
||||
|
||||
if (tooltip && [realObj respondsToSelector: @selector(setToolTip:)])
|
||||
{
|
||||
[realObj setToolTip: [tta toolTip]];
|
||||
[realObj setToolTip: [tooltip toolTip]];
|
||||
}
|
||||
|
||||
// Process XIB runtime attributes...
|
||||
if ([infodict objectForKey:@"IBUserDefinedRuntimeAttributesPlaceholderName"])
|
||||
{
|
||||
IBUserDefinedRuntimeAttributesPlaceholder *placeholder =
|
||||
[infodict objectForKey:@"IBUserDefinedRuntimeAttributesPlaceholderName"];
|
||||
NSArray *attributes = [placeholder runtimeAttributes];
|
||||
NSEnumerator *objectIter = [attributes objectEnumerator];
|
||||
IBUserDefinedRuntimeAttribute *attribute;
|
||||
|
||||
while ((attribute = [objectIter nextObject]) != nil)
|
||||
{
|
||||
[realObj setValue: [attribute value] forKeyPath: [attribute keyPath]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,7 @@
|
|||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSKeyedArchiver.h>
|
||||
#import "GNUstepGUI/GSXibElement.h"
|
||||
|
||||
@interface IBUserDefinedRuntimeAttributesPlaceholder : NSObject <NSCoding>
|
||||
{
|
||||
NSString *typeIdentifier;
|
||||
NSString *keyPath;
|
||||
id value;
|
||||
}
|
||||
|
||||
- (void) setTypeIdentifier: (NSString *)type;
|
||||
- (NSString *) typeIdentifier;
|
||||
|
||||
- (void) setKeyPath: (NSString *)keyPath;
|
||||
- (NSString *) keyPath;
|
||||
|
||||
- (void) setValue: (id)value;
|
||||
- (id) value;
|
||||
|
||||
@end
|
||||
#import "GNUstepGUI/GSXibLoading.h"
|
||||
|
||||
@interface IBAccessibilityAttribute : NSObject <NSCoding>
|
||||
@end
|
||||
|
@ -29,18 +12,15 @@
|
|||
@interface IBLayoutConstant : NSObject <NSCoding>
|
||||
@end
|
||||
|
||||
@implementation IBUserDefinedRuntimeAttributesPlaceholder
|
||||
@implementation IBUserDefinedRuntimeAttribute
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: typeIdentifier
|
||||
forKey: @"typeIdentifier"];
|
||||
[coder encodeObject: keyPath
|
||||
forKey: @"keyPath"];
|
||||
[coder encodeObject: value
|
||||
forKey: @"value"];
|
||||
[coder encodeObject: typeIdentifier forKey: @"typeIdentifier"];
|
||||
[coder encodeObject: keyPath forKey: @"keyPath"];
|
||||
[coder encodeObject: value forKey: @"value"];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -87,6 +67,49 @@
|
|||
|
||||
@end
|
||||
|
||||
@implementation IBUserDefinedRuntimeAttributesPlaceholder
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[coder encodeObject: name forKey: @"IBUserDefinedRuntimeAttributesPlaceholderName"];
|
||||
[coder encodeObject: runtimeAttributes forKey: @"userDefinedRuntimeAttributes"];
|
||||
}
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)coder
|
||||
{
|
||||
if([coder allowsKeyedCoding])
|
||||
{
|
||||
[self setName: [coder decodeObjectForKey: @"IBUserDefinedRuntimeAttributesPlaceholderName"]];
|
||||
[self setRuntimeAttributes: [coder decodeObjectForKey: @"userDefinedRuntimeAttributes"]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setName: (NSString *)value
|
||||
{
|
||||
ASSIGN(name, value);
|
||||
}
|
||||
|
||||
- (NSString *) name
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
- (void) setRuntimeAttributes: (NSArray *)attrbutes
|
||||
{
|
||||
ASSIGN(runtimeAttributes, attrbutes);
|
||||
}
|
||||
|
||||
- (NSArray *) runtimeAttributes
|
||||
{
|
||||
return runtimeAttributes;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation IBAccessibilityAttribute
|
||||
|
||||
- (void) encodeWithCoder: (NSCoder *)coder
|
||||
|
|
|
@ -1877,7 +1877,7 @@ typedef struct _GSButtonCellFlags
|
|||
[self setKeyEquivalentModifierMask: ((bFlags2 >> 8) &
|
||||
NSDeviceIndependentModifierFlagsMask)];
|
||||
|
||||
switch (bFlags2 & (3 << 6))
|
||||
switch ((bFlags2 >> 6) & 3)
|
||||
{
|
||||
case 2:
|
||||
imageScale = NSImageScaleProportionallyDown;
|
||||
|
|
Loading…
Reference in a new issue