mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 06:51:44 +00:00
Move to GSTheme.
This commit is contained in:
parent
a27119c56d
commit
7dd732f9de
3 changed files with 65 additions and 30 deletions
|
@ -972,6 +972,14 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
|||
forState: (NSControlStateValue)state
|
||||
enabled: (BOOL)enabled;
|
||||
|
||||
// NSPathComponentCell
|
||||
|
||||
- (void) drawPathComponentCellWithFrame: (NSRect)f
|
||||
inView: (NSView *)v
|
||||
withURL: (NSURL *)u
|
||||
image: (NSImage *)i
|
||||
isLastComponent: (BOOL)last;
|
||||
|
||||
// NSSegmentedControl drawing methods
|
||||
|
||||
- (void) drawSegmentedControlSegment: (NSCell *)cell
|
||||
|
|
|
@ -59,7 +59,9 @@
|
|||
#import "AppKit/NSTabViewItem.h"
|
||||
#import "AppKit/PSOperators.h"
|
||||
#import "AppKit/NSSliderCell.h"
|
||||
|
||||
#import "AppKit/NSPathCell.h"
|
||||
#import "AppKit/NSPathControl.h"
|
||||
#import "AppKit/NSPathComponentCell.h"
|
||||
#import "GNUstepGUI/GSToolbarView.h"
|
||||
#import "GNUstepGUI/GSTitleView.h"
|
||||
|
||||
|
@ -949,6 +951,53 @@
|
|||
|
||||
}
|
||||
|
||||
// NSPathComponentCell
|
||||
|
||||
- (void) drawPathComponentCellWithFrame: (NSRect)f
|
||||
inView: (NSView *)v
|
||||
withURL: (NSURL *)u
|
||||
image: (NSImage *)i
|
||||
isLastComponent: (BOOL)lc
|
||||
{
|
||||
NSString *string = [[u path] lastPathComponent];
|
||||
NSRect textFrame = f;
|
||||
NSRect imgFrame = f;
|
||||
NSRect arrowFrame = f;
|
||||
NSImage *arrowImage = [NSImage imageNamed: @"NSMenuArrow"];
|
||||
NSPathControl *pc = (NSPathControl *)v;
|
||||
NSPathStyle s = [pc pathStyle];
|
||||
|
||||
if (s == NSPathStyleStandard || s == NSPathStyleNavigationBar)
|
||||
{
|
||||
// Modify positions...
|
||||
textFrame.origin.x += 25.0; // the width of the image plus a few pixels.
|
||||
textFrame.origin.y += 3.0; // center with the image...
|
||||
imgFrame.size.width = 20.0;
|
||||
imgFrame.size.height = 20.0;
|
||||
arrowFrame.origin.x += f.size.width - 20.0;
|
||||
arrowFrame.size.width = 8.0;
|
||||
arrowFrame.size.height = 8.0;
|
||||
arrowFrame.origin.y += 5.0;
|
||||
|
||||
// Draw the image...
|
||||
[i drawInRect: imgFrame];
|
||||
|
||||
// Draw the text...
|
||||
[[NSColor textColor] set];
|
||||
[string drawAtPoint: textFrame.origin
|
||||
withAttributes: nil];
|
||||
|
||||
// Draw the arrow...
|
||||
if (lc == NO)
|
||||
{
|
||||
[arrowImage drawInRect: arrowFrame];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// NSSegmentedControl drawing methods
|
||||
|
||||
- (void) drawSegmentedControlSegment: (NSCell *)cell
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#import "AppKit/NSImage.h"
|
||||
#import "AppKit/NSStringDrawing.h"
|
||||
|
||||
#import "GNUstepGUI/GSTheme.h"
|
||||
|
||||
@implementation NSPathComponentCell
|
||||
|
||||
- (NSImage *) image
|
||||
|
@ -54,37 +56,13 @@
|
|||
- (void) drawInteriorWithFrame: (NSRect)f
|
||||
inView: (NSView *)v
|
||||
{
|
||||
NSString *string = [[_url path] lastPathComponent];
|
||||
NSRect textFrame = f;
|
||||
NSRect imgFrame = f;
|
||||
NSRect arrowFrame = f;
|
||||
NSImage *arrowImage = [NSImage imageNamed: @"NSMenuArrow"];
|
||||
|
||||
[super drawInteriorWithFrame: f inView: v];
|
||||
|
||||
// Modify positions...
|
||||
textFrame.origin.x += 25.0; // the width of the image plus a few pixels.
|
||||
textFrame.origin.y += 3.0; // center with the image...
|
||||
imgFrame.size.width = 20.0;
|
||||
imgFrame.size.height = 20.0;
|
||||
arrowFrame.origin.x += f.size.width - 20.0;
|
||||
arrowFrame.size.width = 8.0;
|
||||
arrowFrame.size.height = 8.0;
|
||||
arrowFrame.origin.y += 5.0;
|
||||
|
||||
// Draw the image...
|
||||
[_image drawInRect: imgFrame];
|
||||
[[GSTheme theme] drawPathComponentCellWithFrame: f
|
||||
inView: v
|
||||
withURL: _url
|
||||
image: _image
|
||||
isLastComponent: _lastComponent];
|
||||
|
||||
// Draw the text...
|
||||
[[NSColor textColor] set];
|
||||
[string drawAtPoint: textFrame.origin
|
||||
withAttributes: nil];
|
||||
|
||||
// Draw the arrow...
|
||||
if (_lastComponent == NO)
|
||||
{
|
||||
[arrowImage drawInRect: arrowFrame];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue