mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
Updated for ivar changings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5491 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
324e207d8e
commit
7dac780ead
4 changed files with 56 additions and 46 deletions
|
@ -67,7 +67,7 @@
|
|||
- (id) _init
|
||||
{
|
||||
_cell.is_enabled = YES;
|
||||
_is_transparent = NO;
|
||||
_buttoncell_is_transparent = NO;
|
||||
_cell.is_bordered = YES;
|
||||
_showAltStateMask = NSNoCellMask; // configure as a NSMomentaryPushButton
|
||||
_highlightsByMask = NSPushInCellMask | NSChangeGrayCellMask;
|
||||
|
@ -156,7 +156,7 @@
|
|||
|
||||
- (NSCellImagePosition) imagePosition
|
||||
{
|
||||
return _image_position;
|
||||
return _cell.image_position;
|
||||
}
|
||||
|
||||
- (void) setAlternateImage: (NSImage *)anImage
|
||||
|
@ -166,7 +166,7 @@
|
|||
|
||||
- (void) setImagePosition: (NSCellImagePosition)aPosition
|
||||
{
|
||||
_image_position = aPosition;
|
||||
_cell.image_position = aPosition;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -232,12 +232,12 @@
|
|||
//
|
||||
- (BOOL) isTransparent
|
||||
{
|
||||
return _is_transparent;
|
||||
return _buttoncell_is_transparent;
|
||||
}
|
||||
|
||||
- (void) setTransparent: (BOOL)flag
|
||||
{
|
||||
_is_transparent = flag;
|
||||
_buttoncell_is_transparent = flag;
|
||||
}
|
||||
|
||||
- (BOOL) isOpaque
|
||||
|
@ -246,7 +246,7 @@
|
|||
// but that's wrong in our case, since if there is no border,
|
||||
// we draw the interior of the cell to fill completely the bounds.
|
||||
// They are likely to draw differently.
|
||||
return !_is_transparent;
|
||||
return !_buttoncell_is_transparent;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -269,7 +269,7 @@
|
|||
|
||||
- (void) setButtonType: (NSButtonType)buttonType
|
||||
{
|
||||
_cell_type = buttonType;
|
||||
_cell.type = buttonType;
|
||||
|
||||
switch (buttonType)
|
||||
{
|
||||
|
@ -338,17 +338,17 @@
|
|||
|
||||
- (int) intValue
|
||||
{
|
||||
return _cell_state;
|
||||
return _cell.state;
|
||||
}
|
||||
|
||||
- (float) floatValue
|
||||
{
|
||||
return _cell_state;
|
||||
return _cell.state;
|
||||
}
|
||||
|
||||
- (double) doubleValue
|
||||
{
|
||||
return _cell_state;
|
||||
return _cell.state;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -358,7 +358,7 @@
|
|||
{
|
||||
if (_cell.is_enabled == NO)
|
||||
return [NSColor disabledControlTextColor];
|
||||
if ((_cell_state && (_showAltStateMask & NSChangeGrayCellMask))
|
||||
if ((_cell.state && (_showAltStateMask & NSChangeGrayCellMask))
|
||||
|| (_cell.is_highlighted && (_highlightsByMask & NSChangeGrayCellMask)))
|
||||
return [NSColor selectedControlTextColor];
|
||||
return [NSColor controlTextColor];
|
||||
|
@ -367,10 +367,11 @@
|
|||
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
||||
{
|
||||
// Save last view drawn to
|
||||
[self setControlView: controlView];
|
||||
if (_control_view != controlView)
|
||||
_control_view = controlView;
|
||||
|
||||
// transparent buttons never draw
|
||||
if (_is_transparent)
|
||||
if (_buttoncell_is_transparent)
|
||||
return;
|
||||
|
||||
// do nothing if cell's frame rect is zero
|
||||
|
@ -408,7 +409,7 @@
|
|||
BOOL flippedView = [controlView isFlipped];
|
||||
|
||||
// transparent buttons never draw
|
||||
if (_is_transparent)
|
||||
if (_buttoncell_is_transparent)
|
||||
return;
|
||||
|
||||
_control_view = controlView;
|
||||
|
@ -424,7 +425,7 @@
|
|||
}
|
||||
|
||||
// determine the background color
|
||||
if (_cell_state)
|
||||
if (_cell.state)
|
||||
{
|
||||
if (_showAltStateMask
|
||||
& (NSChangeGrayCellMask | NSChangeBackgroundCellMask))
|
||||
|
@ -461,7 +462,7 @@
|
|||
else
|
||||
mask = _showAltStateMask;
|
||||
if (mask & NSContentsCellMask)
|
||||
showAlternate = _cell_state;
|
||||
showAlternate = _cell.state;
|
||||
|
||||
if (showAlternate || _cell.is_highlighted)
|
||||
{
|
||||
|
@ -484,7 +485,7 @@
|
|||
[imageToDisplay setBackgroundColor: backgroundColor];
|
||||
}
|
||||
|
||||
switch (_image_position)
|
||||
switch (_cell.image_position)
|
||||
{
|
||||
case NSNoImage:
|
||||
imageToDisplay = nil;
|
||||
|
@ -607,7 +608,7 @@
|
|||
else
|
||||
mask = _showAltStateMask;
|
||||
if (mask & NSContentsCellMask)
|
||||
showAlternate = _cell_state;
|
||||
showAlternate = _cell.state;
|
||||
|
||||
if (showAlternate || _cell.is_highlighted)
|
||||
{
|
||||
|
@ -635,7 +636,7 @@
|
|||
else
|
||||
titleSize = NSZeroSize;
|
||||
|
||||
switch (_image_position)
|
||||
switch (_cell.image_position)
|
||||
{
|
||||
case NSNoImage:
|
||||
s = titleSize;
|
||||
|
@ -729,7 +730,7 @@
|
|||
if (_keyEquivalentFont)
|
||||
c->_keyEquivalentFont = [_keyEquivalentFont retain];
|
||||
c->_keyEquivalentModifierMask = _keyEquivalentModifierMask;
|
||||
c->_is_transparent = _is_transparent;
|
||||
c->_buttoncell_is_transparent = _buttoncell_is_transparent;
|
||||
c->_highlightsByMask = _highlightsByMask;
|
||||
c->_showAltStateMask = _showAltStateMask;
|
||||
|
||||
|
@ -741,6 +742,7 @@
|
|||
//
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
BOOL tmp;
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
NSDebugLog(@"NSButtonCell: start encoding\n");
|
||||
|
@ -748,12 +750,14 @@
|
|||
[aCoder encodeObject: _keyEquivalentFont];
|
||||
[aCoder encodeObject: _altContents];
|
||||
[aCoder encodeObject: _altImage];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_is_transparent];
|
||||
tmp = _buttoncell_is_transparent;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
NSDebugLog(@"NSButtonCell: finish encoding\n");
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
BOOL tmp;
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
NSDebugLog(@"NSButtonCell: start decoding\n");
|
||||
|
@ -761,7 +765,8 @@
|
|||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_keyEquivalentFont];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altContents];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_altImage];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_is_transparent];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
_buttoncell_is_transparent = tmp;
|
||||
NSDebugLog(@"NSButtonCell: finish decoding\n");
|
||||
|
||||
return self;
|
||||
|
|
|
@ -74,13 +74,13 @@ static NSColor *shadowCol;
|
|||
self = [super initTextCell: @""];
|
||||
_cell.is_bezeled = YES;
|
||||
_cell.is_bordered = NO;
|
||||
_text_align = NSLeftTextAlignment;
|
||||
_cell.text_align = NSLeftTextAlignment;
|
||||
_cell.is_editable = YES;
|
||||
_titleCell = [[NSCell alloc] initTextCell: aString];
|
||||
[_titleCell setBordered: NO];
|
||||
[_titleCell setBezeled: NO];
|
||||
[_titleCell setAlignment: NSRightTextAlignment];
|
||||
_autoTitleWidth = YES;
|
||||
_formcell_auto_title_width = YES;
|
||||
_titleWidth = [[self titleFont] widthOfString: aString];
|
||||
return self;
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ static NSColor *shadowCol;
|
|||
- (void)setTitle: (NSString*)aString
|
||||
{
|
||||
[_titleCell setStringValue: aString];
|
||||
if (_autoTitleWidth)
|
||||
if (_formcell_auto_title_width)
|
||||
_titleWidth = [[_titleCell font] widthOfString: aString];
|
||||
}
|
||||
|
||||
|
@ -117,12 +117,12 @@ static NSColor *shadowCol;
|
|||
{
|
||||
if (_titleWidth >= 0)
|
||||
{
|
||||
_autoTitleWidth = NO;
|
||||
_formcell_auto_title_width = NO;
|
||||
_titleWidth = width;
|
||||
}
|
||||
else
|
||||
{
|
||||
_autoTitleWidth = YES;
|
||||
_formcell_auto_title_width = YES;
|
||||
_titleWidth = [[_titleCell font] widthOfString: [_titleCell stringValue]];
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,8 @@ static NSColor *shadowCol;
|
|||
NSRect borderedFrame = cellFrame;
|
||||
|
||||
// Save last view drawn to
|
||||
[self setControlView: controlView];
|
||||
if (_control_view != controlView)
|
||||
_control_view = controlView;
|
||||
|
||||
// do nothing if cell's frame rect is zero
|
||||
if (NSIsEmptyRect(cellFrame))
|
||||
|
|
|
@ -42,12 +42,12 @@ static NSColor *clearCol = nil;
|
|||
{
|
||||
[super initTextCell: aString];
|
||||
|
||||
_text_align = NSCenterTextAlignment;
|
||||
_cell.text_align = NSCenterTextAlignment;
|
||||
ASSIGN (_text_color, [NSColor windowFrameTextColor]);
|
||||
[self setBackgroundColor: [NSColor controlShadowColor]];
|
||||
_cell.is_bordered = NO;
|
||||
_cell.is_bezeled = NO;
|
||||
_draws_background = YES;
|
||||
_textfieldcell_draws_background = YES;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ static NSColor *clearCol = nil;
|
|||
- (void) drawInteriorWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView*)controlView
|
||||
{
|
||||
switch (_cell_type)
|
||||
switch (_cell.type)
|
||||
{
|
||||
case NSTextCellType:
|
||||
[super drawInteriorWithFrame: cellFrame inView: controlView];
|
||||
|
|
|
@ -52,7 +52,7 @@ static NSColor *txtCol;
|
|||
}
|
||||
- (BOOL) _isOpaque
|
||||
{
|
||||
if (_draws_background == NO
|
||||
if (_textfieldcell_draws_background == NO
|
||||
|| _background_color == nil
|
||||
|| [_background_color alphaComponent] < 1.0)
|
||||
return NO;
|
||||
|
@ -88,12 +88,12 @@ static NSColor *txtCol;
|
|||
- (id) initTextCell: (NSString *)aString
|
||||
{
|
||||
[super initTextCell: aString];
|
||||
_text_align = NSLeftTextAlignment;
|
||||
_cell.text_align = NSLeftTextAlignment;
|
||||
|
||||
ASSIGN(_text_color, txtCol);
|
||||
ASSIGN(_background_color, bgCol);
|
||||
_draws_background = NO;
|
||||
_isOpaque = NO;
|
||||
_textfieldcell_draws_background = NO;
|
||||
_textfieldcell_is_opaque = NO;
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ static NSColor *txtCol;
|
|||
|
||||
[c setBackgroundColor: _background_color];
|
||||
[c setTextColor: _text_color];
|
||||
[c setDrawsBackground: _draws_background];
|
||||
[c setDrawsBackground: _textfieldcell_draws_background];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ static NSColor *txtCol;
|
|||
- (void) setBackgroundColor: (NSColor *)aColor
|
||||
{
|
||||
ASSIGN (_background_color, aColor);
|
||||
_isOpaque = [self _isOpaque];
|
||||
_textfieldcell_is_opaque = [self _isOpaque];
|
||||
}
|
||||
|
||||
- (NSColor *) backgroundColor
|
||||
|
@ -131,13 +131,13 @@ static NSColor *txtCol;
|
|||
|
||||
- (void) setDrawsBackground: (BOOL)flag
|
||||
{
|
||||
_draws_background = flag;
|
||||
_isOpaque = [self _isOpaque];
|
||||
_textfieldcell_draws_background = flag;
|
||||
_textfieldcell_is_opaque = [self _isOpaque];
|
||||
}
|
||||
|
||||
- (BOOL) drawsBackground
|
||||
{
|
||||
return _draws_background;
|
||||
return _textfieldcell_draws_background;
|
||||
}
|
||||
|
||||
- (void) setTextColor: (NSColor *)aColor
|
||||
|
@ -153,7 +153,7 @@ static NSColor *txtCol;
|
|||
- (NSText *) setUpFieldEditorAttributes: (NSText *)textObject
|
||||
{
|
||||
textObject = [super setUpFieldEditorAttributes: textObject];
|
||||
[textObject setDrawsBackground: _draws_background];
|
||||
[textObject setDrawsBackground: _textfieldcell_draws_background];
|
||||
[textObject setBackgroundColor: _background_color];
|
||||
[textObject setTextColor: _text_color];
|
||||
return textObject;
|
||||
|
@ -161,7 +161,7 @@ static NSColor *txtCol;
|
|||
|
||||
- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
|
||||
{
|
||||
if (_draws_background)
|
||||
if (_textfieldcell_draws_background)
|
||||
{
|
||||
[controlView lockFocus];
|
||||
[_background_color set];
|
||||
|
@ -173,7 +173,7 @@ static NSColor *txtCol;
|
|||
|
||||
- (BOOL) isOpaque
|
||||
{
|
||||
return _isOpaque;
|
||||
return _textfieldcell_is_opaque;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -181,21 +181,25 @@ static NSColor *txtCol;
|
|||
//
|
||||
- (void) encodeWithCoder: (NSCoder*)aCoder
|
||||
{
|
||||
BOOL tmp;
|
||||
[super encodeWithCoder: aCoder];
|
||||
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_background_color];
|
||||
[aCoder encodeValueOfObjCType: @encode(id) at: &_text_color];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
|
||||
tmp = _textfieldcell_draws_background;
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder*)aDecoder
|
||||
{
|
||||
BOOL tmp;
|
||||
[super initWithCoder: aDecoder];
|
||||
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_background_color];
|
||||
[aDecoder decodeValueOfObjCType: @encode(id) at: &_text_color];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &_draws_background];
|
||||
_isOpaque = [self _isOpaque];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &tmp];
|
||||
_textfieldcell_draws_background = tmp;
|
||||
_textfieldcell_is_opaque = [self _isOpaque];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue