Extract cell border drawing into helper method.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24928 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-03-23 22:34:02 +00:00
parent e93c75500d
commit 0ccb895f2b
5 changed files with 45 additions and 66 deletions

View file

@ -920,49 +920,13 @@ typedef struct _GSButtonCellFlags
inFrame: frame];
}
- (void) drawWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
// Private helper method overridden in subclasses
- (void) _drawBorderAndBackgroundWithFrame: (NSRect)cellFrame inView: (NSView*)controlView
{
// Save last view drawn to
if (_control_view != controlView)
_control_view = controlView;
// transparent buttons never draw
if (_buttoncell_is_transparent)
return;
// do nothing if cell's frame rect is zero
if (NSIsEmptyRect(cellFrame))
return;
// draw the border if needed
if ((_cell.is_bordered)
&& (!_shows_border_only_while_mouse_inside || _mouse_inside))
{
[self drawBezelWithFrame: cellFrame inView: controlView];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];
// Draw first responder
if (_cell.shows_first_responder
&& [[controlView window] firstResponder] == controlView)
{
switch (_cell.focus_ring_type)
{
case NSFocusRingTypeDefault:
[[GSTheme theme] drawFocusFrame: [self drawingRectForBounds:
cellFrame]
view: controlView];
break;
case NSFocusRingTypeExterior:
[[GSTheme theme] drawFocusFrame: cellFrame
view: controlView];
break;
case NSFocusRingTypeNone:
default:
break;
}
[self drawBezelWithFrame: cellFrame inView: controlView];
}
}