mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 01:50:48 +00:00
Implemented keyed and non-keyed coding for NSDrawer.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@23031 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2cd4aa162e
commit
a175d2a332
3 changed files with 62 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
2006-06-04 13:30 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSDrawer.h: Added ivar _contentSize to header.
|
||||||
|
* Source/NSDrawer.m: Implemented keyed and non-keyed encoding.
|
||||||
|
|
||||||
2006-06-04 12:28 Gregory John Casamento <greg_casamento@yahoo.com>
|
2006-06-04 12:28 Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Source/GSTrackingRect.m: Encode, if not a keyed archiver.
|
* Source/GSTrackingRect.m: Encode, if not a keyed archiver.
|
||||||
|
|
|
@ -53,6 +53,7 @@ enum {
|
||||||
NSRectEdge _currentEdge;
|
NSRectEdge _currentEdge;
|
||||||
NSSize _maxContentSize;
|
NSSize _maxContentSize;
|
||||||
NSSize _minContentSize;
|
NSSize _minContentSize;
|
||||||
|
NSSize _contentSize;
|
||||||
float _leadingOffset;
|
float _leadingOffset;
|
||||||
float _trailingOffset;
|
float _trailingOffset;
|
||||||
int _state;
|
int _state;
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Foundation/NSCoder.h>
|
#include <Foundation/NSCoder.h>
|
||||||
|
#include <Foundation/NSArchiver.h>
|
||||||
|
#include <Foundation/NSKeyedArchiver.h>
|
||||||
#include <Foundation/NSNotification.h>
|
#include <Foundation/NSNotification.h>
|
||||||
#include "AppKit/NSWindow.h"
|
#include "AppKit/NSWindow.h"
|
||||||
#include "AppKit/NSView.h"
|
#include "AppKit/NSView.h"
|
||||||
|
@ -291,12 +293,64 @@ static NSNotificationCenter *nc = nil;
|
||||||
*/
|
*/
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
//FIXME
|
[super encodeWithCoder: aCoder];
|
||||||
|
if([aCoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
[aCoder encodeSize: _contentSize forKey: @"NSContentSize"];
|
||||||
|
[aCoder encodeObject: _delegate forKey: @"NSDelegate"];
|
||||||
|
[aCoder encodeFloat: _leadingOffset forKey: @"NSLeadingOffset"];
|
||||||
|
[aCoder encodeSize: _maxContentSize forKey: @"NSMaxContentSize"];
|
||||||
|
[aCoder encodeSize: _minContentSize forKey: @"NSMinContentSize"];
|
||||||
|
[aCoder encodeObject: _parentWindow forKey: @"NSParentWindow"];
|
||||||
|
[aCoder encodeInt: _preferredEdge forKey: @"NSPreferredEdge"];
|
||||||
|
[aCoder encodeFloat: _trailingOffset forKey: @"NSTrailingOffset"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[aCoder encodeSize: _contentSize];
|
||||||
|
[aCoder encodeObject: _delegate];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_leadingOffset];
|
||||||
|
[aCoder encodeSize: _maxContentSize];
|
||||||
|
[aCoder encodeSize: _minContentSize];
|
||||||
|
[aCoder encodeObject: _parentWindow];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(unsigned) at: &_preferredEdge];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(float) at: &_trailingOffset];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
//FIXME
|
if((self = [super initWithCoder: aDecoder]) != nil)
|
||||||
|
{
|
||||||
|
if([aDecoder allowsKeyedCoding])
|
||||||
|
{
|
||||||
|
_contentSize = [aDecoder decodeSizeForKey: @"NSContentSize"];
|
||||||
|
ASSIGN(_delegate, [aDecoder decodeObjectForKey: @"NSDelegate"]);
|
||||||
|
_leadingOffset = [aDecoder decodeFloatForKey: @"NSLeadingOffset"];
|
||||||
|
_maxContentSize = [aDecoder decodeSizeForKey: @"NSMaxContentSize"];
|
||||||
|
_minContentSize = [aDecoder decodeSizeForKey: @"NSMinContentSize"];
|
||||||
|
ASSIGN(_parentWindow, [aDecoder decodeObjectForKey: @"NSParentWindow"]);
|
||||||
|
_preferredEdge = [aDecoder decodeIntForKey: @"NSPreferredEdge"];
|
||||||
|
_trailingOffset = [aDecoder decodeFloatForKey: @"NSTrailingOffset"];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int version = [aDecoder versionForClassName: @"NSDrawer"];
|
||||||
|
if(version == 0)
|
||||||
|
{
|
||||||
|
_contentSize = [aDecoder decodeSize];
|
||||||
|
ASSIGN(_delegate, [aDecoder decodeObject]);
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_leadingOffset];
|
||||||
|
_maxContentSize = [aDecoder decodeSize];
|
||||||
|
_minContentSize = [aDecoder decodeSize];
|
||||||
|
ASSIGN(_parentWindow, [aDecoder decodeObject]);
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned) at: &_preferredEdge];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(float) at: &_trailingOffset];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue