Moved control view stuff from NSCell, updated.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5483 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Nicola Pero 1999-12-13 16:10:51 +00:00
parent 73dfc93238
commit 7a968448a2

View file

@ -58,6 +58,7 @@ static Class controlClass;
_target = nil; _target = nil;
_action = NULL; _action = NULL;
_tag = 0; _tag = 0;
_control_view = nil;
return self; return self;
} }
@ -67,6 +68,7 @@ static Class controlClass;
_target = nil; _target = nil;
_action = NULL; _action = NULL;
_tag = 0; _tag = 0;
_control_view = nil;
return self; return self;
} }
@ -76,6 +78,7 @@ static Class controlClass;
_target = nil; _target = nil;
_action = NULL; _action = NULL;
_tag = 0; _tag = 0;
_control_view = nil;
return self; return self;
} }
@ -84,7 +87,7 @@ static Class controlClass;
*/ */
- (void) setAlignment: (NSTextAlignment)mode - (void) setAlignment: (NSTextAlignment)mode
{ {
_text_align = mode; _cell.text_align = mode;
if (_control_view) if (_control_view)
if ([_control_view isKindOfClass: controlClass]) if ([_control_view isKindOfClass: controlClass])
[(NSControl *)_control_view updateCell: self]; [(NSControl *)_control_view updateCell: self];
@ -225,10 +228,26 @@ static Class controlClass;
c->_tag = _tag; c->_tag = _tag;
c->_target = _target; c->_target = _target;
c->_action = _action; c->_action = _action;
c->_control_view = _control_view;
return c; return c;
} }
-(NSView *)controlView
{
return _control_view;
}
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
if (_control_view != controlView)
_control_view = controlView;
[super drawWithFrame: cellFrame
inView: controlView];
}
/* /*
* NSCoding protocol * NSCoding protocol
*/ */
@ -238,6 +257,7 @@ static Class controlClass;
[aCoder encodeValueOfObjCType: @encode(int) at: &_tag]; [aCoder encodeValueOfObjCType: @encode(int) at: &_tag];
[aCoder encodeConditionalObject: _target]; [aCoder encodeConditionalObject: _target];
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action]; [aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
[aCoder encodeConditionalObject: _control_view];
} }
- (id) initWithCoder: (NSCoder*)aDecoder - (id) initWithCoder: (NSCoder*)aDecoder
@ -246,6 +266,7 @@ static Class controlClass;
[aDecoder decodeValueOfObjCType: @encode(int) at: &_tag]; [aDecoder decodeValueOfObjCType: @encode(int) at: &_tag];
_target = [aDecoder decodeObject]; _target = [aDecoder decodeObject];
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action]; [aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
_control_view = [aDecoder decodeObject];
return self; return self;
} }