mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-14 14:40:56 +00:00
Add support for looking up button tiles based on bezel style
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29441 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d0e93fff89
commit
a3835dbe56
4 changed files with 74 additions and 2 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2010-01-29 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/GSTheme.m:
|
||||
* Source/GSThemeDrawing.m:
|
||||
* Source/GSThemePrivate.h: Add GSStringFromBezelStyle and
|
||||
GSStringFromSegmentStyle functions which return the string name of
|
||||
the style constant for buttons and segmented controls.
|
||||
In -[GSThemeDrawing drawButton:view:style:state], use
|
||||
GSStringFromBezelStyle to try to get tiles for the specified bezel
|
||||
style, falling back to the normal NSButton tiles if the fancy tiles
|
||||
aren't present.
|
||||
|
||||
2010-01-28 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Headers/AppKit/NSPanel.h: Added panel style constants
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#import "GNUstepBase/GSObjCRuntime.h"
|
||||
#import "GNUstepGUI/GSTheme.h"
|
||||
#import "AppKit/NSApplication.h"
|
||||
#import "AppKit/NSButtonCell.h"
|
||||
#import "AppKit/NSButton.h"
|
||||
#import "AppKit/NSColor.h"
|
||||
#import "AppKit/NSColorList.h"
|
||||
|
@ -50,6 +51,7 @@
|
|||
#import "AppKit/NSMenu.h"
|
||||
#import "AppKit/NSPanel.h"
|
||||
#import "AppKit/NSScrollView.h"
|
||||
#import "AppKit/NSSegmentedControl.h"
|
||||
#import "AppKit/NSTextContainer.h"
|
||||
#import "AppKit/NSTextField.h"
|
||||
#import "AppKit/NSTextView.h"
|
||||
|
@ -124,6 +126,49 @@ GSThemeFillStyleFromString(NSString *s)
|
|||
return GSThemeFillStyleNone;
|
||||
}
|
||||
|
||||
NSString *
|
||||
GSStringFromSegmentStyle(NSSegmentStyle segmentStyle)
|
||||
{
|
||||
switch (segmentStyle)
|
||||
{
|
||||
case NSSegmentStyleAutomatic: return @"NSSegmentStyleAutomatic";
|
||||
case NSSegmentStyleRounded: return @"NSSegmentStyleRounded";
|
||||
case NSSegmentStyleTexturedRounded: return @"NSSegmentStyleTexturedRounded";
|
||||
case NSSegmentStyleRoundRect: return @"NSSegmentStyleRoundRect";
|
||||
case NSSegmentStyleTexturedSquare: return @"NSSegmentStyleTexturedSquare";
|
||||
case NSSegmentStyleCapsule: return @"NSSegmentStyleCapsule";
|
||||
case NSSegmentStyleSmallSquare: return @"NSSegmentStyleSmallSquare";
|
||||
default: return nil;
|
||||
}
|
||||
}
|
||||
|
||||
NSString *
|
||||
GSStringFromBezelStyle(NSBezelStyle bezelStyle)
|
||||
{
|
||||
switch (bezelStyle)
|
||||
{
|
||||
case NSRoundedBezelStyle: return @"NSRoundedBezelStyle";
|
||||
case NSRegularSquareBezelStyle: return @"NSRegularSquareBezelStyle";
|
||||
case NSThickSquareBezelStyle: return @"NSThickSquareBezelStyle";
|
||||
case NSThickerSquareBezelStyle: return @"NSThickerSquareBezelStyle";
|
||||
case NSDisclosureBezelStyle: return @"NSDisclosureBezelStyle";
|
||||
case NSShadowlessSquareBezelStyle: return @"NSShadowlessSquareBezelStyle";
|
||||
case NSCircularBezelStyle: return @"NSCircularBezelStyle";
|
||||
case NSTexturedSquareBezelStyle: return @"NSTexturedSquareBezelStyle";
|
||||
case NSHelpButtonBezelStyle: return @"NSHelpButtonBezelStyle";
|
||||
case NSSmallSquareBezelStyle: return @"NSSmallSquareBezelStyle";
|
||||
case NSTexturedRoundedBezelStyle: return @"NSTexturedRoundedBezelStyle";
|
||||
case NSRoundRectBezelStyle: return @"NSRoundRectBezelStyle";
|
||||
case NSRecessedBezelStyle: return @"NSRecessedBezelStyle";
|
||||
case NSRoundedDisclosureBezelStyle: return @"NSRoundedDisclosureBezelStyle";
|
||||
case NSNeXTBezelStyle: return @"NSNeXTBezelStyle";
|
||||
case NSPushButtonBezelStyle: return @"NSPushButtonBezelStyle";
|
||||
case NSSmallIconButtonBezelStyle: return @"NSSmallIconButtonBezelStyle";
|
||||
case NSMediumIconButtonBezelStyle: return @"NSMediumIconButtonBezelStyle";
|
||||
case NSLargeIconButtonBezelStyle: return @"NSLargeIconButtonBezelStyle";
|
||||
default: return nil;
|
||||
}
|
||||
}
|
||||
|
||||
@interface NSImage (GSTheme)
|
||||
+ (NSImage*) _setImage: (NSImage*)image name: (NSString*)name;
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
if (name == nil)
|
||||
{
|
||||
name = @"NSButton";
|
||||
name = GSStringFromBezelStyle(style);
|
||||
}
|
||||
|
||||
color = [self colorNamed: name state: state];
|
||||
|
@ -83,6 +83,11 @@
|
|||
}
|
||||
|
||||
tiles = [self tilesNamed: name state: state];
|
||||
if (tiles == nil)
|
||||
{
|
||||
tiles = [self tilesNamed: @"NSButton" state: state];
|
||||
}
|
||||
|
||||
if (tiles == nil)
|
||||
{
|
||||
switch (style)
|
||||
|
@ -157,10 +162,15 @@
|
|||
|
||||
if (name == nil)
|
||||
{
|
||||
name = @"NSButton";
|
||||
name = GSStringFromBezelStyle(style);
|
||||
}
|
||||
|
||||
tiles = [self tilesNamed: name state: state];
|
||||
if (tiles == nil)
|
||||
{
|
||||
tiles = [self tilesNamed: @"NSButton" state: state];
|
||||
}
|
||||
|
||||
if (tiles == nil)
|
||||
{
|
||||
switch (style)
|
||||
|
|
|
@ -30,10 +30,15 @@
|
|||
|
||||
#import <Foundation/NSProxy.h>
|
||||
#import "AppKit/NSPanel.h"
|
||||
#import "AppKit/NSButtonCell.h"
|
||||
#import "AppKit/NSSegmentedControl.h"
|
||||
#import "GNUstepGUI/GSTheme.h"
|
||||
|
||||
@class NSImage, NSMatrix, NSScrollView, NSView;
|
||||
|
||||
NSString *GSStringFromSegmentStyle(NSSegmentStyle segmentStyle);
|
||||
NSString *GSStringFromBezelStyle(NSBezelStyle bezelStyle);
|
||||
|
||||
/** These are the nine types of tile used to draw a rectangular object.
|
||||
*/
|
||||
typedef enum {
|
||||
|
|
Loading…
Reference in a new issue