* Headers/Additions/GNUstepGUI/GSTheme.h:

* Source/GSTheme.m:
* Source/GSThemeDrawing.m:
* Source/NSPopUpButtonCell.m: Add a theme part GSPopUpButton
so NSPopUpButtonCell can be drawn with a different background
than NSMenuItemCell.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37183 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-10-02 23:56:16 +00:00
parent ea8ded398f
commit dfab5c6196
5 changed files with 65 additions and 0 deletions

View file

@ -1,3 +1,12 @@
2013-10-02 Eric Wasylishen <ewasylishen@gmail.com>
* Headers/Additions/GNUstepGUI/GSTheme.h:
* Source/GSTheme.m:
* Source/GSThemeDrawing.m:
* Source/NSPopUpButtonCell.m: Add a theme part GSPopUpButton
so NSPopUpButtonCell can be drawn with a different background
than NSMenuItemCell.
2013-10-02 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSMenuView.m: Read the menu item/menu bar/separator

View file

@ -238,6 +238,7 @@
@class NSColorWell;
@class NSImage;
@class NSMenuItemCell;
@class NSPopUpButtonCell;
@class NSMenuView;
@class NSProgressIndicator;
@class NSTableHeaderCell;
@ -286,6 +287,10 @@ APPKIT_EXPORT NSString *GSMenuHorizontalItem;
APPKIT_EXPORT NSString *GSMenuVerticalItem;
APPKIT_EXPORT NSString *GSMenuSeparatorItem;
/* NSPopUpButton parts */
APPKIT_EXPORT NSString *GSPopUpButton;
/*
* Progress Indicator part names.
*/
@ -979,6 +984,12 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
inView: (NSView *)controlView
state: (GSThemeControlState)state
isHorizontal: (BOOL)isHorizontal;
- (void) drawBorderAndBackgroundForPopUpButtonCell: (NSPopUpButtonCell *)cell
withFrame: (NSRect)cellFrame
inView: (NSView *)controlView
state: (GSThemeControlState)state;
/**
* <p>Draws the menu item title.</p>
*

View file

@ -95,6 +95,9 @@ NSString *GSMenuHorizontalItem = @"GSMenuHorizontalItem";
NSString *GSMenuVerticalItem = @"GSMenuVerticalItem";
NSString *GSMenuSeparatorItem = @"GSMenuSeparatorItem";
// NSPopUpButton part names
NSString *GSPopUpButton = @"GSPopUpButton";
// Progress indicator part names
NSString *GSProgressIndicatorBarDeterminate
= @"GSProgressIndicatorBarDeterminate";

View file

@ -44,6 +44,7 @@
#import "AppKit/NSMenuView.h"
#import "AppKit/NSMenuItemCell.h"
#import "AppKit/NSParagraphStyle.h"
#import "AppKit/NSPopUpButtonCell.h"
#import "AppKit/NSProgressIndicator.h"
#import "AppKit/NSScroller.h"
#import "AppKit/NSScrollView.h"
@ -1000,6 +1001,28 @@
}
}
- (void) drawBorderAndBackgroundForPopUpButtonCell: (NSPopUpButtonCell *)cell
withFrame: (NSRect)cellFrame
inView: (NSView *)controlView
state: (GSThemeControlState)state
{
GSDrawTiles *tiles = [self tilesNamed: GSPopUpButton state: state];
if (tiles == nil)
{
[self drawBorderAndBackgroundForMenuItemCell: cell
withFrame: cellFrame
inView: controlView
state: state
isHorizontal: NO];
}
else
{
[self fillRect: cellFrame
withTiles: tiles
background: [NSColor clearColor]];
}
}
- (NSColor *) menuSeparatorColor
{
NSColor *color = [self colorNamed: @"menuSeparatorColor"

View file

@ -48,6 +48,10 @@
* and so on. */
static NSImage *_pbc_image[5];
@interface NSMenuItemCell (Private)
- (GSThemeControlState) themeControlState;
@end
@interface NSPopUpButtonCell (CocoaExtensions)
- (void) _popUpItemAction: (id)sender;
@end
@ -1052,6 +1056,21 @@ static NSImage *_pbc_image[5];
[self attachPopUpWithFrame: frame inView: controlView];
}
/*
* Override the implementation in NSMenuItemCell to call a different
* GSTheme method, since typically menu items and buttons will be
* drawn differently (though not in the GNUstep default theme).
*/
- (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView
{
[[GSTheme theme] drawBorderAndBackgroundForPopUpButtonCell: self
withFrame: cellFrame
inView: controlView
state: [self themeControlState]];
}
/*
* This drawing uses the same code that is used to draw cells in the menu.
*/