mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +00:00
Move corner view drawing into GSTheme.
Add new 10.3 methods for NSTableHeaderCell. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28985 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3bfc5beceb
commit
17ef668924
7 changed files with 90 additions and 27 deletions
|
@ -1,3 +1,12 @@
|
|||
2009-11-09 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSTheme.h,
|
||||
* Source/GSThemeDrawing.m,
|
||||
* Source/NSTableView.m: Move corner view drawing into GSTheme.
|
||||
* Source/NSTextFieldCell.m: White space changes.
|
||||
* Headers/AppKit/NSTableHeaderCell.h,
|
||||
* Source/NSTableHeaderCell.m: Add new 10.3 methods.
|
||||
|
||||
2009-11-09 Fred Kiefer <FredKiefer@gmx.de>
|
||||
|
||||
* Source/NSControl.m,
|
||||
|
|
|
@ -697,6 +697,7 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
|||
withFrame: (NSRect) aRect
|
||||
position: (NSPoint) position;
|
||||
|
||||
|
||||
// menu item cell drawing methods
|
||||
- (NSColor *) backgroundColorForMenuItemCell: (NSMenuItemCell *)cell
|
||||
state: (GSThemeControlState)state;
|
||||
|
@ -706,6 +707,12 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
|||
state: (GSThemeControlState)state
|
||||
isHorizontal: (BOOL)isHorizontal;
|
||||
|
||||
|
||||
// Table drawing methods
|
||||
- (void) drawTableCornerView: (NSView*)cornerView
|
||||
withClip: (NSRect)aRect;
|
||||
|
||||
|
||||
- (float) titlebarHeight;
|
||||
|
||||
- (float) resizebarHeight;
|
||||
|
|
|
@ -27,12 +27,22 @@
|
|||
|
||||
#ifndef _GNUstep_H_NSTableHeaderCell
|
||||
#define _GNUstep_H_NSTableHeaderCell
|
||||
#include <GNUstepBase/GSVersionMacros.h>
|
||||
|
||||
#include <AppKit/NSTextFieldCell.h>
|
||||
#import <AppKit/NSTextFieldCell.h>
|
||||
|
||||
@interface NSTableHeaderCell : NSTextFieldCell
|
||||
{
|
||||
}
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST)
|
||||
- (void)drawSortIndicatorWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
ascending: (BOOL)ascending
|
||||
priority: (int)priority;
|
||||
- (NSRect)sortIndicatorRectForBounds: (NSRect)theRect;
|
||||
#endif
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
|
|
|
@ -728,6 +728,28 @@
|
|||
}
|
||||
}
|
||||
|
||||
// Table drawing methods
|
||||
- (void) drawTableCornerView: (NSView*)cornerView
|
||||
withClip: (NSRect)aRect
|
||||
{
|
||||
NSRect divide;
|
||||
NSRect rect;
|
||||
|
||||
if ([cornerView isFlipped])
|
||||
{
|
||||
NSDivideRect(aRect, ÷, &rect, 1.0, NSMaxYEdge);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDivideRect(aRect, ÷, &rect, 1.0, NSMinYEdge);
|
||||
}
|
||||
|
||||
[[NSColor blackColor] set];
|
||||
NSRectFill(divide);
|
||||
rect = [self drawDarkButton: rect withClip: aRect];
|
||||
[[NSColor controlShadowColor] set];
|
||||
NSRectFill(rect);
|
||||
}
|
||||
|
||||
// Window decoration drawing methods
|
||||
/* These include the black border. */
|
||||
|
|
|
@ -24,19 +24,20 @@
|
|||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "AppKit/NSTableHeaderCell.h"
|
||||
#include "AppKit/NSColor.h"
|
||||
#include "AppKit/NSFont.h"
|
||||
#import "AppKit/NSColor.h"
|
||||
#import "AppKit/NSFont.h"
|
||||
#import "AppKit/NSImage.h"
|
||||
#import "AppKit/NSTableHeaderCell.h"
|
||||
#include "GNUstepGUI/GSTheme.h"
|
||||
|
||||
@implementation NSTableHeaderCell
|
||||
{
|
||||
}
|
||||
|
||||
// Default appearance of NSTableHeaderCell
|
||||
- (id) initTextCell: (NSString *)aString
|
||||
{
|
||||
[super initTextCell: aString];
|
||||
self = [super initTextCell: aString];
|
||||
if (!self)
|
||||
return nil;
|
||||
|
||||
[self setAlignment: NSCenterTextAlignment];
|
||||
[self setTextColor: [NSColor windowFrameTextColor]];
|
||||
|
@ -75,6 +76,36 @@
|
|||
[self _drawBackgroundWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
|
||||
- (void) drawSortIndicatorWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
ascending: (BOOL)ascending
|
||||
priority: (int)priority
|
||||
{
|
||||
NSImage *img;
|
||||
|
||||
cellFrame = [self sortIndicatorRectForBounds: cellFrame];
|
||||
if (ascending)
|
||||
img = [NSImage imageNamed: @"NSAscendingSortIndicator"];
|
||||
else
|
||||
img = [NSImage imageNamed: @"NSDescendingSortIndicator"];
|
||||
|
||||
[img drawAtPoint: cellFrame.origin
|
||||
fromRect: NSZeroRect
|
||||
operation: NSCompositeSourceOver
|
||||
fraction: 1.0];
|
||||
}
|
||||
|
||||
- (NSRect) sortIndicatorRectForBounds: (NSRect)theRect
|
||||
{
|
||||
NSImage *img = [NSImage imageNamed: @"NSAscendingSortIndicator"];
|
||||
NSSize size = [img size];
|
||||
|
||||
theRect.origin.x = NSMaxX(theRect) - size.width;
|
||||
theRect.size = size;
|
||||
|
||||
return theRect;
|
||||
}
|
||||
|
||||
- (void) setHighlighted: (BOOL)flag
|
||||
{
|
||||
_cell.is_highlighted = flag;
|
||||
|
|
|
@ -1934,23 +1934,7 @@ static void computeNewSelection
|
|||
|
||||
- (void) drawRect: (NSRect)aRect
|
||||
{
|
||||
NSRect divide;
|
||||
NSRect rect;
|
||||
|
||||
if ([self isFlipped])
|
||||
{
|
||||
NSDivideRect(aRect, ÷, &rect, 1.0, NSMaxYEdge);
|
||||
}
|
||||
else
|
||||
{
|
||||
NSDivideRect(aRect, ÷, &rect, 1.0, NSMinYEdge);
|
||||
}
|
||||
|
||||
[[NSColor blackColor] set];
|
||||
NSRectFill(divide);
|
||||
rect = [[GSTheme theme] drawDarkButton: rect withClip: aRect];
|
||||
[[NSColor controlShadowColor] set];
|
||||
NSRectFill(rect);
|
||||
[[GSTheme theme] drawTableCornerView: self withClip: aRect];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -202,13 +202,13 @@
|
|||
inView: (NSView*)controlView
|
||||
{
|
||||
if (_textfieldcell_draws_background)
|
||||
{
|
||||
{
|
||||
if ([self isEnabled])
|
||||
{
|
||||
{
|
||||
[_background_color set];
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
[[NSColor controlBackgroundColor] set];
|
||||
}
|
||||
NSRectFill([self drawingRectForBounds: cellFrame]);
|
||||
|
|
Loading…
Reference in a new issue