mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 07:00:46 +00:00
Merge fixes and additional merges
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@38682 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9ad8451677
commit
ce265f56f8
8 changed files with 260 additions and 114 deletions
|
@ -319,21 +319,20 @@
|
|||
|
||||
- (void) drawFocusFrame: (NSRect) frame view: (NSView*) view
|
||||
{
|
||||
#if 0 //TESTPLANT-MAL
|
||||
NSFocusRingFrameRect(frame);
|
||||
#else
|
||||
GSDrawTiles *tiles = [self tilesNamed: @"NSFocusRing" state: GSThemeNormalState];
|
||||
|
||||
if (tiles == nil)
|
||||
{
|
||||
#if 0 //TESTPLANT-MAL-2015-06-20: Merged but use the old drawing method...
|
||||
NSFocusRingFrameRect(frame);
|
||||
#else
|
||||
NSDottedFrameRect(frame);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
[self fillRect: frame
|
||||
withTiles: tiles];
|
||||
[self fillRect: frame withTiles: tiles];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void) drawWindowBackground: (NSRect) frame view: (NSView*) view
|
||||
|
|
|
@ -683,11 +683,12 @@ typedef struct _GSButtonCellFlags
|
|||
returns NO</p>*/
|
||||
- (BOOL) isOpaque
|
||||
{
|
||||
#if 0
|
||||
// May not be opaque, due to themes
|
||||
return NO;
|
||||
|
||||
// return !_buttoncell_is_transparent && _cell.is_bordered &&
|
||||
// _bezel_style == 0;
|
||||
#else
|
||||
return !_buttoncell_is_transparent && _cell.is_bordered &&_bezel_style == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (NSBezelStyle) bezelStyle
|
||||
|
@ -972,6 +973,7 @@ typedef struct _GSButtonCellFlags
|
|||
buttonState = GSThemeDisabledState;
|
||||
}
|
||||
|
||||
#if 0 // Testplant-MAL-2015-06-20: Merged but causes button to show up depressed???
|
||||
/* If we are first responder, change to the corresponding
|
||||
first responder state. Note that GSThemeDisabledState
|
||||
doesn't have a first responder variant, currently. */
|
||||
|
@ -980,16 +982,18 @@ typedef struct _GSButtonCellFlags
|
|||
&& [self controlView] != nil)
|
||||
{
|
||||
if (buttonState == GSThemeSelectedState)
|
||||
buttonState = GSThemeSelectedFirstResponderState;
|
||||
buttonState = GSThemeSelectedFirstResponderState;
|
||||
else if (buttonState == GSThemeHighlightedState)
|
||||
buttonState = GSThemeHighlightedFirstResponderState;
|
||||
buttonState = GSThemeHighlightedFirstResponderState;
|
||||
else if (buttonState == GSThemeNormalState)
|
||||
buttonState = GSThemeFirstResponderState;
|
||||
buttonState = GSThemeFirstResponderState;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return buttonState;
|
||||
}
|
||||
|
||||
#if 1
|
||||
- (void) drawBezelWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
|
||||
{
|
||||
GSThemeControlState buttonState = [self themeControlState];
|
||||
|
@ -1000,8 +1004,55 @@ typedef struct _GSButtonCellFlags
|
|||
style: _bezel_style
|
||||
state: buttonState];
|
||||
}
|
||||
#else
|
||||
- (void) drawBezelWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
|
||||
{
|
||||
unsigned mask;
|
||||
GSThemeControlState buttonState = 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))
|
||||
{
|
||||
buttonState = GSThemeHighlightedState;
|
||||
}
|
||||
|
||||
/* Pushed in buttons contents are displaced to the bottom right 1px. */
|
||||
if (mask & NSPushInCellMask)
|
||||
{
|
||||
buttonState = GSThemeSelectedState;
|
||||
}
|
||||
|
||||
if (_cell.is_disabled && buttonState != GSThemeHighlightedState)
|
||||
{
|
||||
buttonState = GSThemeDisabledState;
|
||||
}
|
||||
|
||||
[[GSTheme theme] drawButton: cellFrame
|
||||
in: self
|
||||
view: controlView
|
||||
style: _bezel_style
|
||||
state: buttonState];
|
||||
}
|
||||
#endif
|
||||
|
||||
- (void) drawImage: (NSImage*)imageToDisplay
|
||||
- (void) drawImage: (NSImage*)imageToDisplay
|
||||
withFrame: (NSRect)cellFrame
|
||||
inView: (NSView*)controlView
|
||||
{
|
||||
|
|
|
@ -93,8 +93,8 @@
|
|||
pixelsWide <= 0 || pixelsHigh <= 0)
|
||||
{
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"NSCachedImageRep created with size %@ pixelsWide %d pixelsHigh %d",
|
||||
NSStringFromSize(aSize), pixelsWide, pixelsHigh];
|
||||
format: @"NSCachedImageRep created with size %@ pixelsWide %li pixelsHigh %li",
|
||||
NSStringFromSize(aSize), (long int) pixelsWide, (long int) pixelsHigh];
|
||||
}
|
||||
|
||||
// FIXME: Only create new window when separate is YES
|
||||
|
|
126
Source/NSCell.m
126
Source/NSCell.m
|
@ -1607,44 +1607,6 @@ static NSColor *dtxtCol;
|
|||
_cell.background_style = backgroundStyle;
|
||||
}
|
||||
|
||||
- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView
|
||||
{
|
||||
NSUInteger hitResult = NSCellHitNone;
|
||||
NSPoint point = [controlView convertPoint:[event locationInWindow] fromView:nil];
|
||||
|
||||
switch (_cell.type)
|
||||
{
|
||||
case NSImageCellType:
|
||||
{
|
||||
NSRect checkFrame = [self imageRectForBounds:cellFrame];
|
||||
if (NSPointInRect(point, checkFrame))
|
||||
hitResult |= NSCellHitContentArea;
|
||||
break;
|
||||
}
|
||||
|
||||
case NSTextCellType:
|
||||
{
|
||||
NSString *stringValue = [self stringValue];
|
||||
if (stringValue && [stringValue length])
|
||||
{
|
||||
// TODO: Needs to be the string rect NOT the title rect area...
|
||||
NSRect checkFrame = [self titleRectForBounds:cellFrame];
|
||||
if (NSPointInRect(point, checkFrame))
|
||||
hitResult |= NSCellHitContentArea;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NSNullCellType:
|
||||
default:
|
||||
hitResult = NSCellHitContentArea;
|
||||
// FIXME: If the cell not disabled, and it would track, OR in NSCellHitTrackableArea...
|
||||
break;
|
||||
}
|
||||
|
||||
return(hitResult);
|
||||
}
|
||||
|
||||
/**<p>Returns whether tracking starts. The NSCell implementation
|
||||
returns YES when the <var>startPoint</var> is into the control view
|
||||
retangle, NO otherwise. This method is call at the early stage of
|
||||
|
@ -1829,6 +1791,44 @@ static NSColor *dtxtCol;
|
|||
return NO; // Otherwise return NO
|
||||
}
|
||||
|
||||
- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect:(NSRect)cellFrame ofView:(NSView *)controlView
|
||||
{
|
||||
NSUInteger hitResult = NSCellHitNone;
|
||||
NSPoint point = [controlView convertPoint:[event locationInWindow] fromView:nil];
|
||||
|
||||
switch (_cell.type)
|
||||
{
|
||||
case NSImageCellType:
|
||||
{
|
||||
NSRect checkFrame = [self imageRectForBounds:cellFrame];
|
||||
if (NSPointInRect(point, checkFrame))
|
||||
hitResult |= NSCellHitContentArea;
|
||||
break;
|
||||
}
|
||||
|
||||
case NSTextCellType:
|
||||
{
|
||||
NSString *stringValue = [self stringValue];
|
||||
if (stringValue && [stringValue length])
|
||||
{
|
||||
// TODO: Needs to be the string rect NOT the title rect area...
|
||||
NSRect checkFrame = [self titleRectForBounds:cellFrame];
|
||||
if (NSPointInRect(point, checkFrame))
|
||||
hitResult |= NSCellHitContentArea;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NSNullCellType:
|
||||
default:
|
||||
hitResult = NSCellHitContentArea;
|
||||
// FIXME: If the cell not disabled, and it would track, OR in NSCellHitTrackableArea...
|
||||
break;
|
||||
}
|
||||
|
||||
return(hitResult);
|
||||
}
|
||||
|
||||
/** <p>TODO</p>
|
||||
*/
|
||||
- (void) resetCursorRect: (NSRect)cellFrame inView: (NSView*)controlView
|
||||
|
@ -1976,8 +1976,29 @@ static NSColor *dtxtCol;
|
|||
aType = NSBezelBorder;
|
||||
else
|
||||
aType = NSNoBorder;
|
||||
|
||||
|
||||
#if 1
|
||||
borderSize = [[GSTheme theme] sizeForBorderType: aType];
|
||||
#else //Testplant-MAL-2015-06-20: Button size testing
|
||||
borderSize = NSMakeSize(0, 0); // Regular...
|
||||
switch ([self controlSize]) {
|
||||
case NSRegularControlSize:
|
||||
borderSize = NSMakeSize(12, 9);
|
||||
break;
|
||||
|
||||
case NSSmallControlSize:
|
||||
borderSize = NSMakeSize(11, 8);
|
||||
break;
|
||||
|
||||
case NSMiniControlSize:
|
||||
borderSize = NSMakeSize(10, 6);
|
||||
break;
|
||||
|
||||
default:
|
||||
NSWarnMLog(@"invalid control size: %ld", [self controlSize]);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return NSInsetRect(theRect, borderSize.width, borderSize.height);
|
||||
}
|
||||
|
||||
|
@ -2145,6 +2166,11 @@ static NSColor *dtxtCol;
|
|||
if (_cell.is_highlighted != lit)
|
||||
{
|
||||
_cell.is_highlighted = lit;
|
||||
|
||||
// Disabling this because when combined with making
|
||||
// -[NSButtonCell isOpaque] return NO, it was causing scroller buttons
|
||||
// to stay stuck down. --Eric (2013-09-28)
|
||||
#if 0
|
||||
/*
|
||||
* NB: This has a visible effect only if subclasses override
|
||||
* drawWithFrame:inView: to draw something special when the
|
||||
|
@ -2165,6 +2191,7 @@ static NSColor *dtxtCol;
|
|||
*/
|
||||
[controlView displayRect: cellFrame];
|
||||
}
|
||||
#endif
|
||||
[self drawWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
}
|
||||
|
@ -2267,9 +2294,15 @@ static NSColor *dtxtCol;
|
|||
/* See comments in NSStringDrawing.m about the choice of maximum size. */
|
||||
ct = [(NSTextView*)textObject textContainer];
|
||||
if (wraps)
|
||||
maxSize = NSMakeSize(NSWidth(titleRect), 1e6);
|
||||
{
|
||||
maxSize = NSMakeSize(NSWidth(titleRect), 1e6);
|
||||
}
|
||||
else
|
||||
maxSize = titleRect.size;
|
||||
{
|
||||
// Testplant-MAL-2015-06-20: Korean/Chinese/etc characters not properly
|
||||
// horizontally centered if you set to infinity - should be at text size...
|
||||
maxSize = titleRect.size;
|
||||
}
|
||||
[ct setContainerSize: maxSize];
|
||||
[ct setWidthTracksTextView: wraps];
|
||||
[ct setHeightTracksTextView: NO];
|
||||
|
@ -2283,10 +2316,14 @@ static NSColor *dtxtCol;
|
|||
[[controlView window] makeFirstResponder: textObject];
|
||||
_cell.shows_first_responder = YES;
|
||||
_cell.in_editing = YES;
|
||||
|
||||
#if 1
|
||||
// Testplant-MAL-2015-06-20: merging removal causes focus ring issues...
|
||||
// FIXME: we need to draw the focus ring, this works but
|
||||
// there's something wrong about telling the view to come
|
||||
// back here and draw.
|
||||
[controlView setKeyboardFocusRingNeedsDisplayInRect:NSMakeRect (aRect.origin.x - 2.0, aRect.origin.y - 2.0, aRect.size.width + 4.0, aRect.size.height + 4.0)];
|
||||
#endif
|
||||
}
|
||||
|
||||
/**<p>Ends any text editing. This method sets the text object's delegate
|
||||
|
@ -2298,7 +2335,6 @@ static NSColor *dtxtCol;
|
|||
NSClipView *clipView;
|
||||
|
||||
_cell.in_editing = NO;
|
||||
_cell.shows_first_responder = NO;
|
||||
[textObject setString: @""];
|
||||
[textObject setDelegate: nil];
|
||||
|
||||
|
@ -2311,8 +2347,10 @@ static NSColor *dtxtCol;
|
|||
else
|
||||
[textObject removeFromSuperview];
|
||||
|
||||
#if 1 //Testplant-MAL-2015-06-20: Removed due to merge???
|
||||
// FIXME: This is brutal but clears the focus ring clean.
|
||||
[[self controlView] setNeedsDisplay:YES];
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2415,7 +2453,7 @@ static NSColor *dtxtCol;
|
|||
{
|
||||
unsigned long cFlags = 0;
|
||||
unsigned int cFlags2 = 0;
|
||||
id contents;
|
||||
id contents = _contents;
|
||||
|
||||
// encode contents
|
||||
if (_cell.type == NSTextCellType)
|
||||
|
@ -2867,7 +2905,9 @@ static NSColor *dtxtCol;
|
|||
- (NSDictionary*) _nonAutoreleasedTypingAttributes
|
||||
{
|
||||
NSDictionary *attr = nil;
|
||||
NSColor *color;
|
||||
|
||||
color = [self textColor];
|
||||
switch (_cell.background_style)
|
||||
{
|
||||
#if 0
|
||||
|
|
|
@ -501,11 +501,13 @@ static BOOL menuBarVisible = YES;
|
|||
}
|
||||
}
|
||||
|
||||
origin = NSMakePoint(0, [[_aWindow screen] visibleFrame].size.height
|
||||
- [_aWindow frame].size.height);
|
||||
if ((_aWindow != nil) && ([_aWindow screen] != nil))
|
||||
{
|
||||
origin = NSMakePoint(0, [[_aWindow screen] visibleFrame].size.height - [_aWindow frame].size.height);
|
||||
|
||||
[_aWindow setFrameOrigin: origin];
|
||||
[_bWindow setFrameOrigin: origin];
|
||||
[_aWindow setFrameOrigin: origin];
|
||||
[_bWindow setFrameOrigin: origin];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@ static NSString *alternateKeyString = @"+";
|
|||
static NSString *shiftKeyString = @"/";
|
||||
static NSString *commandKeyString = @"#";
|
||||
|
||||
@interface NSMenuItemCell (Private)
|
||||
- (GSThemeControlState) themeControlState;
|
||||
@end
|
||||
|
||||
@implementation NSMenuItemCell
|
||||
|
||||
+ (void) initialize
|
||||
|
@ -526,18 +530,33 @@ static NSString *commandKeyString = @"#";
|
|||
if (_needs_sizing)
|
||||
[self calcSize];
|
||||
|
||||
#if 0
|
||||
if (_mcell_belongs_to_popupbutton && _cell.image_position)
|
||||
{
|
||||
#if 0 //Main branch code...
|
||||
//Tesplant-MAL-2015-06-22 - should fix branch version below but need
|
||||
//to fix check mark being displayed on main pop up button rather than
|
||||
//just on the showing the check mark on the selected item in the
|
||||
//drop down list...
|
||||
// Special case: draw image on the extreme right
|
||||
cellFrame.origin.x += [_menuView imageAndTitleOffset];
|
||||
cellFrame.size.width -= [_menuView imageAndTitleOffset];
|
||||
#else //Testplant branch code - MAL-2015-06-20: ensure correct available width returned...
|
||||
// TODO: Need to find this out somehow...Testplant-MAL
|
||||
static const NSUInteger ButtonMargin = 5;
|
||||
|
||||
CGFloat inset = _imageWidth + ButtonMargin;
|
||||
|
||||
// Special case: image is drawn on the extreme right
|
||||
// First inset the title rect...Testplant-MAL
|
||||
cellFrame = NSInsetRect(cellFrame, ButtonMargin, 0);
|
||||
// Adjust for image on right side i.e. down arrow popup indicator...Testplant-MAL
|
||||
cellFrame.size.width -= _imageWidth + ButtonMargin;
|
||||
cellFrame.size.width -= _imageWidth;
|
||||
#endif
|
||||
return cellFrame;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
{
|
||||
/* This adjust will center us within the menubar. */
|
||||
|
@ -674,43 +693,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.
|
||||
//
|
||||
|
@ -734,7 +716,17 @@ static NSString *commandKeyString = @"#";
|
|||
- (void) drawKeyEquivalentWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
{
|
||||
NSImage *arrow = [NSImage imageNamed: @"NSMenuArrow"];
|
||||
NSImage *arrow = nil;
|
||||
if (_cell.is_highlighted)
|
||||
{
|
||||
arrow = [NSImage imageNamed: @"NSHighlightedMenuArrow"];
|
||||
}
|
||||
|
||||
if (arrow == nil)
|
||||
{
|
||||
arrow = [NSImage imageNamed: @"NSMenuArrow"];
|
||||
}
|
||||
|
||||
|
||||
cellFrame = [self keyEquivalentRectForBounds: cellFrame];
|
||||
|
||||
|
@ -786,7 +778,9 @@ static NSString *commandKeyString = @"#";
|
|||
{
|
||||
NSImage *imageToDisplay;
|
||||
|
||||
switch ([_menuItem state])
|
||||
// Testplant-MAL-2015-06-22: While merging found was [_menuItem state] but
|
||||
// I think it should be using [self state] for popups to show properly...
|
||||
switch ([self state])
|
||||
{
|
||||
case NSOnState:
|
||||
imageToDisplay = [_menuItem onStateImage];
|
||||
|
|
|
@ -132,29 +132,44 @@ static NSMapTable *viewInfo = 0;
|
|||
* Class methods.
|
||||
*/
|
||||
|
||||
static float menuBarHeight = 0.0;
|
||||
|
||||
+ (void) _themeWillDeactivate: (NSNotification*)n
|
||||
{
|
||||
/* Clear cached information from the old theme ... will get info from
|
||||
* the new theme as required.
|
||||
*/
|
||||
menuBarHeight = 0;
|
||||
}
|
||||
|
||||
+ (void) initialize
|
||||
{
|
||||
if (viewInfo == 0)
|
||||
{
|
||||
viewInfo = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
|
||||
NSNonOwnedPointerMapValueCallBacks, 20);
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self
|
||||
selector: @selector(_themeWillDeactivate:)
|
||||
name: GSThemeWillDeactivateNotification
|
||||
object: nil];
|
||||
}
|
||||
}
|
||||
|
||||
+ (float) menuBarHeight
|
||||
{
|
||||
static float height = 0.0;
|
||||
|
||||
if (height == 0.0)
|
||||
if (menuBarHeight == 0.0)
|
||||
{
|
||||
const CGFloat themeHeight = [[GSTheme theme] menuBarHeight];
|
||||
|
||||
NSFont *font = [NSFont menuBarFontOfSize: 0.0];
|
||||
|
||||
height = [font boundingRectForFont].size.height;
|
||||
if (height < 22)
|
||||
height = 22;
|
||||
menuBarHeight = [font boundingRectForFont].size.height;
|
||||
if (menuBarHeight < themeHeight)
|
||||
menuBarHeight = themeHeight;
|
||||
}
|
||||
|
||||
return height;
|
||||
return menuBarHeight;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -48,6 +48,10 @@
|
|||
* and so on. */
|
||||
static NSImage *_pbc_image[5];
|
||||
|
||||
@interface NSButtonCell (Private)
|
||||
- (GSThemeControlState) themeControlState;
|
||||
@end
|
||||
|
||||
@interface NSPopUpButtonCell (CocoaExtensions)
|
||||
- (void) _popUpItemAction: (id)sender;
|
||||
@end
|
||||
|
@ -326,6 +330,7 @@ static NSImage *_pbc_image[5];
|
|||
{
|
||||
id <NSMenuItem> selectedItem = [self selectedItem];
|
||||
|
||||
#if 0
|
||||
if (flag)
|
||||
{
|
||||
[selectedItem setState: NSOnState];
|
||||
|
@ -334,7 +339,8 @@ static NSImage *_pbc_image[5];
|
|||
{
|
||||
[selectedItem setState: NSOffState];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
_pbcFlags.altersStateOfSelectedItem = flag;
|
||||
}
|
||||
|
||||
|
@ -667,7 +673,7 @@ static NSImage *_pbc_image[5];
|
|||
|
||||
if (_selectedItem != nil)
|
||||
{
|
||||
if (_pbcFlags.altersStateOfSelectedItem && !_pbcFlags.pullsDown)
|
||||
if (_pbcFlags.altersStateOfSelectedItem)
|
||||
{
|
||||
[_selectedItem setState: NSOffState];
|
||||
}
|
||||
|
@ -684,7 +690,7 @@ static NSImage *_pbc_image[5];
|
|||
|
||||
if (_selectedItem != nil)
|
||||
{
|
||||
if (_pbcFlags.altersStateOfSelectedItem && !_pbcFlags.pullsDown)
|
||||
if (_pbcFlags.altersStateOfSelectedItem)
|
||||
{
|
||||
[_selectedItem setState: NSOnState];
|
||||
}
|
||||
|
@ -891,6 +897,29 @@ static NSImage *_pbc_image[5];
|
|||
return @"";
|
||||
}
|
||||
|
||||
- (NSInteger)state
|
||||
{
|
||||
return NSOffState;
|
||||
}
|
||||
|
||||
- (NSRect)titleRectForBounds:(NSRect)cellFrame
|
||||
{
|
||||
// Testplant branch code - MAL-2015-06-20: ensure correct available width returned...
|
||||
// Override base class for popup button rectangle...
|
||||
// TODO: Need to find this out somehow...Testplant-MAL
|
||||
static const NSUInteger ButtonMargin = 5;
|
||||
|
||||
CGFloat inset = _imageWidth + ButtonMargin;
|
||||
|
||||
// Special case: image is drawn on the extreme right
|
||||
// First inset the title rect...Testplant-MAL
|
||||
cellFrame = NSInsetRect(cellFrame, ButtonMargin, 0);
|
||||
// Adjust for image on right side i.e. down arrow popup indicator...Testplant-MAL
|
||||
cellFrame.size.width -= _imageWidth;
|
||||
|
||||
return cellFrame;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach popup
|
||||
*/
|
||||
|
@ -1054,6 +1083,22 @@ static NSImage *_pbc_image[5];
|
|||
[self attachPopUpWithFrame: frame inView: controlView];
|
||||
}
|
||||
|
||||
/*
|
||||
* Override the implementation in NSMenuItemCell to behave the same
|
||||
* as superclass NSButtonCell's implementation, since our direct
|
||||
* superclass NSMenuItemCell has special menu-specific drawing.
|
||||
*/
|
||||
- (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
{
|
||||
[[GSTheme theme] drawButton: cellFrame
|
||||
in: self
|
||||
view: controlView
|
||||
style: _bezel_style
|
||||
state: [self themeControlState]];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* This drawing uses the same code that is used to draw cells in the menu.
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue