Skip to content

Commit

Permalink
Update code in GSXib5KeyedUnarchiver.m to read alternative toolTip fo…
Browse files Browse the repository at this point in the history
…rmat (#193)

* Update code in GSXib5KeyedUnarchiver.m to read alternative toolTip format

* Update to make the code a bit tighter, per suggestion by @fredkiefer
  • Loading branch information
gcasa authored Aug 31, 2023
1 parent 629d065 commit 3f35da7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 10 deletions.
8 changes: 7 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
2023-08-30 Gregory John Casamento <[email protected]>

* Source/GSXib5KeyedUnarchive.m: Fix for issue#192. Added code to
-decodeObjectForXib:forClassName:withID: to decode toolTip using
alternative format described in the issue.

2023-08-13 Fred Kiefer <[email protected]>

* Source/NSSwitch.m (-drawRect:): Correct drawing as suggested by
Austin Clow ([email protected]).
Austin Clow ([email protected]).

2023-02-12 Gregory John Casamento <[email protected]>

Expand Down
36 changes: 27 additions & 9 deletions Source/GSXib5KeyedUnarchiver.m
Original file line number Diff line number Diff line change
Expand Up @@ -3169,6 +3169,31 @@ - (void) addOrderedObject: (GSXibElement*)element
}
}

- (void) addToolTip: (GSXibElement *)element forObject: (id)object
{
NSString *toolTipString = [element attributeForKey: @"toolTip"];

// Process tooltips...
if (toolTipString == nil)
{
GSXibElement *toolTipElement = [element elementForKey: @"toolTip"];

toolTipString = [toolTipElement value];
}

if (toolTipString != nil)
{
if ([object respondsToSelector: @selector(setToolTip:)])
{
[object setToolTip: toolTipString];
}
else if ([object respondsToSelector: @selector(setHeaderToolTip:)])
{
[object setHeaderToolTip: toolTipString];
}
}
}

- (id) decodeObjectForXib: (GSXibElement*)element
forClassName: (NSString*)classname
withID: (NSString*)objID
Expand All @@ -3177,15 +3202,8 @@ - (id) decodeObjectForXib: (GSXibElement*)element
id object = [super decodeObjectForXib: element forClassName: classname withID: objID];

[self addOrderedObject: element];

// Process tooltips...
if ([element attributeForKey: @"toolTip"])
{
if ([object respondsToSelector: @selector(setToolTip:)])
[object setToolTip: [element attributeForKey: @"toolTip"]];
else if ([object respondsToSelector: @selector(setHeaderToolTip:)])
[object setHeaderToolTip: [element attributeForKey: @"toolTip"]];
}
[self addToolTip: element forObject: object];

// Process IB runtime attributes for element...
// Ensure we don't process the placeholders...
if ([element elementForKey: @"userDefinedRuntimeAttributes"] &&
Expand Down

0 comments on commit 3f35da7

Please sign in to comment.