mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
Implemented encoding/decoding
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@7375 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e0fa3900b9
commit
d3f3e00f40
2 changed files with 66 additions and 0 deletions
|
@ -415,4 +415,33 @@
|
||||||
return (_documentView != nil) ? [_documentView becomeFirstResponder] : NO;
|
return (_documentView != nil) ? [_documentView becomeFirstResponder] : NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NSCoding protocol
|
||||||
|
*/
|
||||||
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
|
{
|
||||||
|
[super encodeWithCoder: aCoder];
|
||||||
|
|
||||||
|
[aCoder encodeObject: _backgroundColor];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
||||||
|
[aCoder encodeObject: _cursor];
|
||||||
|
[aCoder encodeObject: _documentView];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
|
{
|
||||||
|
NSView *document;
|
||||||
|
|
||||||
|
self = [super initWithCoder: aDecoder];
|
||||||
|
[self setAutoresizesSubviews: YES];
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_backgroundColor];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_copiesOnScroll];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_cursor];
|
||||||
|
|
||||||
|
document = [aDecoder decodeObject];
|
||||||
|
[self setDocumentView: document];
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -136,10 +136,47 @@ static NSColor *scrollBarColor = nil;
|
||||||
|
|
||||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||||
{
|
{
|
||||||
|
[super encodeWithCoder: aCoder];
|
||||||
|
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(unsigned int) at: &_arrowsPosition];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_isEnabled];
|
||||||
|
[aCoder encodeConditionalObject: _target];
|
||||||
|
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||||
|
/* We do not save float value, knob proportion. */
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||||
{
|
{
|
||||||
|
self = [super initWithCoder: aDecoder];
|
||||||
|
|
||||||
|
if (_frame.size.width > _frame.size.height)
|
||||||
|
{
|
||||||
|
_isHorizontal = YES;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_isHorizontal = NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_isHorizontal)
|
||||||
|
{
|
||||||
|
_floatValue = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_floatValue = 1.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
_hitPart = NSScrollerNoPart;
|
||||||
|
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(unsigned int) at: &_arrowsPosition];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_isEnabled];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(id) at: &_target];
|
||||||
|
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||||
|
|
||||||
|
[self drawParts];
|
||||||
|
[self checkSpaceForParts];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue