* Source/NSButtonCell.m:

* Source/NSMenuItemCell.m: Make a shared -themeControlState in
NSButtonCell and eliminate duplicated code.
* Source/NSPopUpButtonCell.m: Add private declaration for
-[NSButtonCell themeControlState]


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37236 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-10-15 18:41:17 +00:00
parent 7e6fef4418
commit 74bd902874
4 changed files with 23 additions and 40 deletions

View file

@ -54,6 +54,10 @@ static NSString *alternateKeyString = @"+";
static NSString *shiftKeyString = @"/";
static NSString *commandKeyString = @"#";
@interface NSMenuItemCell (Private)
- (GSThemeControlState) themeControlState;
@end
@implementation NSMenuItemCell
+ (void) initialize
@ -666,43 +670,6 @@ static NSString *commandKeyString = @"#";
}
}
- (GSThemeControlState) themeControlState
{
unsigned mask;
GSThemeControlState state = GSThemeNormalState;
// set the mask
if (_cell.is_highlighted)
{
mask = _highlightsByMask;
if (_cell.state)
{
mask &= ~_showAltStateMask;
}
}
else if (_cell.state)
mask = _showAltStateMask;
else
mask = NSNoCellMask;
/* Determine the background color.
We draw when there is a border or when highlightsByMask
is NSChangeBackgroundCellMask or NSChangeGrayCellMask,
as required by our nextstep-like look and feel. */
if (mask & (NSChangeGrayCellMask | NSChangeBackgroundCellMask))
{
state = GSThemeHighlightedState;
}
/* Pushed in buttons contents are displaced to the bottom right 1px. */
if (mask & NSPushInCellMask)
{
state = GSThemeSelectedState;
}
return state;
}
//
// Drawing.
//