mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 15:21:57 +00:00
* 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:
parent
3b57b63430
commit
93eeb1101c
5 changed files with 65 additions and 0 deletions
|
@ -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>
|
2013-10-02 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Source/NSMenuView.m: Read the menu item/menu bar/separator
|
* Source/NSMenuView.m: Read the menu item/menu bar/separator
|
||||||
|
|
|
@ -238,6 +238,7 @@
|
||||||
@class NSColorWell;
|
@class NSColorWell;
|
||||||
@class NSImage;
|
@class NSImage;
|
||||||
@class NSMenuItemCell;
|
@class NSMenuItemCell;
|
||||||
|
@class NSPopUpButtonCell;
|
||||||
@class NSMenuView;
|
@class NSMenuView;
|
||||||
@class NSProgressIndicator;
|
@class NSProgressIndicator;
|
||||||
@class NSTableHeaderCell;
|
@class NSTableHeaderCell;
|
||||||
|
@ -286,6 +287,10 @@ APPKIT_EXPORT NSString *GSMenuHorizontalItem;
|
||||||
APPKIT_EXPORT NSString *GSMenuVerticalItem;
|
APPKIT_EXPORT NSString *GSMenuVerticalItem;
|
||||||
APPKIT_EXPORT NSString *GSMenuSeparatorItem;
|
APPKIT_EXPORT NSString *GSMenuSeparatorItem;
|
||||||
|
|
||||||
|
/* NSPopUpButton parts */
|
||||||
|
|
||||||
|
APPKIT_EXPORT NSString *GSPopUpButton;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Progress Indicator part names.
|
* Progress Indicator part names.
|
||||||
*/
|
*/
|
||||||
|
@ -979,6 +984,12 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
||||||
inView: (NSView *)controlView
|
inView: (NSView *)controlView
|
||||||
state: (GSThemeControlState)state
|
state: (GSThemeControlState)state
|
||||||
isHorizontal: (BOOL)isHorizontal;
|
isHorizontal: (BOOL)isHorizontal;
|
||||||
|
|
||||||
|
- (void) drawBorderAndBackgroundForPopUpButtonCell: (NSPopUpButtonCell *)cell
|
||||||
|
withFrame: (NSRect)cellFrame
|
||||||
|
inView: (NSView *)controlView
|
||||||
|
state: (GSThemeControlState)state;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Draws the menu item title.</p>
|
* <p>Draws the menu item title.</p>
|
||||||
*
|
*
|
||||||
|
|
|
@ -95,6 +95,9 @@ NSString *GSMenuHorizontalItem = @"GSMenuHorizontalItem";
|
||||||
NSString *GSMenuVerticalItem = @"GSMenuVerticalItem";
|
NSString *GSMenuVerticalItem = @"GSMenuVerticalItem";
|
||||||
NSString *GSMenuSeparatorItem = @"GSMenuSeparatorItem";
|
NSString *GSMenuSeparatorItem = @"GSMenuSeparatorItem";
|
||||||
|
|
||||||
|
// NSPopUpButton part names
|
||||||
|
NSString *GSPopUpButton = @"GSPopUpButton";
|
||||||
|
|
||||||
// Progress indicator part names
|
// Progress indicator part names
|
||||||
NSString *GSProgressIndicatorBarDeterminate
|
NSString *GSProgressIndicatorBarDeterminate
|
||||||
= @"GSProgressIndicatorBarDeterminate";
|
= @"GSProgressIndicatorBarDeterminate";
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#import "AppKit/NSMenuView.h"
|
#import "AppKit/NSMenuView.h"
|
||||||
#import "AppKit/NSMenuItemCell.h"
|
#import "AppKit/NSMenuItemCell.h"
|
||||||
#import "AppKit/NSParagraphStyle.h"
|
#import "AppKit/NSParagraphStyle.h"
|
||||||
|
#import "AppKit/NSPopUpButtonCell.h"
|
||||||
#import "AppKit/NSProgressIndicator.h"
|
#import "AppKit/NSProgressIndicator.h"
|
||||||
#import "AppKit/NSScroller.h"
|
#import "AppKit/NSScroller.h"
|
||||||
#import "AppKit/NSScrollView.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 *) menuSeparatorColor
|
||||||
{
|
{
|
||||||
NSColor *color = [self colorNamed: @"menuSeparatorColor"
|
NSColor *color = [self colorNamed: @"menuSeparatorColor"
|
||||||
|
|
|
@ -48,6 +48,10 @@
|
||||||
* and so on. */
|
* and so on. */
|
||||||
static NSImage *_pbc_image[5];
|
static NSImage *_pbc_image[5];
|
||||||
|
|
||||||
|
@interface NSMenuItemCell (Private)
|
||||||
|
- (GSThemeControlState) themeControlState;
|
||||||
|
@end
|
||||||
|
|
||||||
@interface NSPopUpButtonCell (CocoaExtensions)
|
@interface NSPopUpButtonCell (CocoaExtensions)
|
||||||
- (void) _popUpItemAction: (id)sender;
|
- (void) _popUpItemAction: (id)sender;
|
||||||
@end
|
@end
|
||||||
|
@ -1052,6 +1056,21 @@ static NSImage *_pbc_image[5];
|
||||||
[self attachPopUpWithFrame: frame inView: controlView];
|
[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.
|
* This drawing uses the same code that is used to draw cells in the menu.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue