mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 15:21:57 +00:00
* 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:
parent
6ff76480c7
commit
cc79a86cb6
4 changed files with 23 additions and 40 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2013-10-15 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* 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]
|
||||||
|
|
||||||
2013-10-15 Eric Wasylishen <ewasylishen@gmail.com>
|
2013-10-15 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* ColorPickers/GSColorSliderCell.m (-drawBarInside:flipped:):
|
* ColorPickers/GSColorSliderCell.m (-drawBarInside:flipped:):
|
||||||
|
|
|
@ -933,7 +933,7 @@ typedef struct _GSButtonCellFlags
|
||||||
ASSIGN(_backgroundColor, color);
|
ASSIGN(_backgroundColor, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) drawBezelWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
|
- (GSThemeControlState) themeControlState
|
||||||
{
|
{
|
||||||
unsigned mask;
|
unsigned mask;
|
||||||
GSThemeControlState buttonState = GSThemeNormalState;
|
GSThemeControlState buttonState = GSThemeNormalState;
|
||||||
|
@ -976,7 +976,8 @@ typedef struct _GSButtonCellFlags
|
||||||
first responder state. Note that GSThemeDisabledState
|
first responder state. Note that GSThemeDisabledState
|
||||||
doesn't have a first responder variant, currently. */
|
doesn't have a first responder variant, currently. */
|
||||||
if (_cell.shows_first_responder
|
if (_cell.shows_first_responder
|
||||||
&& [[controlView window] firstResponder] == controlView)
|
&& [[[self controlView] window] firstResponder] == [self controlView]
|
||||||
|
&& [self controlView] != nil)
|
||||||
{
|
{
|
||||||
if (buttonState == GSThemeSelectedState)
|
if (buttonState == GSThemeSelectedState)
|
||||||
buttonState = GSThemeSelectedFirstResponderState;
|
buttonState = GSThemeSelectedFirstResponderState;
|
||||||
|
@ -986,6 +987,13 @@ typedef struct _GSButtonCellFlags
|
||||||
buttonState = GSThemeFirstResponderState;
|
buttonState = GSThemeFirstResponderState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return buttonState;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) drawBezelWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
|
||||||
|
{
|
||||||
|
GSThemeControlState buttonState = [self themeControlState];
|
||||||
|
|
||||||
[[GSTheme theme] drawButton: cellFrame
|
[[GSTheme theme] drawButton: cellFrame
|
||||||
in: self
|
in: self
|
||||||
view: controlView
|
view: controlView
|
||||||
|
|
|
@ -54,6 +54,10 @@ static NSString *alternateKeyString = @"+";
|
||||||
static NSString *shiftKeyString = @"/";
|
static NSString *shiftKeyString = @"/";
|
||||||
static NSString *commandKeyString = @"#";
|
static NSString *commandKeyString = @"#";
|
||||||
|
|
||||||
|
@interface NSMenuItemCell (Private)
|
||||||
|
- (GSThemeControlState) themeControlState;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation NSMenuItemCell
|
@implementation NSMenuItemCell
|
||||||
|
|
||||||
+ (void) initialize
|
+ (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.
|
// Drawing.
|
||||||
//
|
//
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
* and so on. */
|
* and so on. */
|
||||||
static NSImage *_pbc_image[5];
|
static NSImage *_pbc_image[5];
|
||||||
|
|
||||||
@interface NSMenuItemCell (Private)
|
@interface NSButtonCell (Private)
|
||||||
- (GSThemeControlState) themeControlState;
|
- (GSThemeControlState) themeControlState;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue