mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 16:40:50 +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
6f96e84bc6
commit
48bf51f21c
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>
|
2009-11-09 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
* Source/NSControl.m,
|
* Source/NSControl.m,
|
||||||
|
|
|
@ -697,6 +697,7 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
||||||
withFrame: (NSRect) aRect
|
withFrame: (NSRect) aRect
|
||||||
position: (NSPoint) position;
|
position: (NSPoint) position;
|
||||||
|
|
||||||
|
|
||||||
// menu item cell drawing methods
|
// menu item cell drawing methods
|
||||||
- (NSColor *) backgroundColorForMenuItemCell: (NSMenuItemCell *)cell
|
- (NSColor *) backgroundColorForMenuItemCell: (NSMenuItemCell *)cell
|
||||||
state: (GSThemeControlState)state;
|
state: (GSThemeControlState)state;
|
||||||
|
@ -706,6 +707,12 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
||||||
state: (GSThemeControlState)state
|
state: (GSThemeControlState)state
|
||||||
isHorizontal: (BOOL)isHorizontal;
|
isHorizontal: (BOOL)isHorizontal;
|
||||||
|
|
||||||
|
|
||||||
|
// Table drawing methods
|
||||||
|
- (void) drawTableCornerView: (NSView*)cornerView
|
||||||
|
withClip: (NSRect)aRect;
|
||||||
|
|
||||||
|
|
||||||
- (float) titlebarHeight;
|
- (float) titlebarHeight;
|
||||||
|
|
||||||
- (float) resizebarHeight;
|
- (float) resizebarHeight;
|
||||||
|
|
|
@ -27,12 +27,22 @@
|
||||||
|
|
||||||
#ifndef _GNUstep_H_NSTableHeaderCell
|
#ifndef _GNUstep_H_NSTableHeaderCell
|
||||||
#define _GNUstep_H_NSTableHeaderCell
|
#define _GNUstep_H_NSTableHeaderCell
|
||||||
|
#include <GNUstepBase/GSVersionMacros.h>
|
||||||
|
|
||||||
#include <AppKit/NSTextFieldCell.h>
|
#import <AppKit/NSTextFieldCell.h>
|
||||||
|
|
||||||
@interface NSTableHeaderCell : NSTextFieldCell
|
@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
|
@end
|
||||||
|
|
||||||
#endif
|
#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
|
// Window decoration drawing methods
|
||||||
/* These include the black border. */
|
/* These include the black border. */
|
||||||
|
|
|
@ -24,19 +24,20 @@
|
||||||
Boston, MA 02110-1301, USA.
|
Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AppKit/NSTableHeaderCell.h"
|
#import "AppKit/NSColor.h"
|
||||||
#include "AppKit/NSColor.h"
|
#import "AppKit/NSFont.h"
|
||||||
#include "AppKit/NSFont.h"
|
#import "AppKit/NSImage.h"
|
||||||
|
#import "AppKit/NSTableHeaderCell.h"
|
||||||
#include "GNUstepGUI/GSTheme.h"
|
#include "GNUstepGUI/GSTheme.h"
|
||||||
|
|
||||||
@implementation NSTableHeaderCell
|
@implementation NSTableHeaderCell
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default appearance of NSTableHeaderCell
|
// Default appearance of NSTableHeaderCell
|
||||||
- (id) initTextCell: (NSString *)aString
|
- (id) initTextCell: (NSString *)aString
|
||||||
{
|
{
|
||||||
[super initTextCell: aString];
|
self = [super initTextCell: aString];
|
||||||
|
if (!self)
|
||||||
|
return nil;
|
||||||
|
|
||||||
[self setAlignment: NSCenterTextAlignment];
|
[self setAlignment: NSCenterTextAlignment];
|
||||||
[self setTextColor: [NSColor windowFrameTextColor]];
|
[self setTextColor: [NSColor windowFrameTextColor]];
|
||||||
|
@ -75,6 +76,36 @@
|
||||||
[self _drawBackgroundWithFrame: cellFrame inView: controlView];
|
[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
|
- (void) setHighlighted: (BOOL)flag
|
||||||
{
|
{
|
||||||
_cell.is_highlighted = flag;
|
_cell.is_highlighted = flag;
|
||||||
|
|
|
@ -1934,23 +1934,7 @@ static void computeNewSelection
|
||||||
|
|
||||||
- (void) drawRect: (NSRect)aRect
|
- (void) drawRect: (NSRect)aRect
|
||||||
{
|
{
|
||||||
NSRect divide;
|
[[GSTheme theme] drawTableCornerView: self withClip: aRect];
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -202,13 +202,13 @@
|
||||||
inView: (NSView*)controlView
|
inView: (NSView*)controlView
|
||||||
{
|
{
|
||||||
if (_textfieldcell_draws_background)
|
if (_textfieldcell_draws_background)
|
||||||
{
|
{
|
||||||
if ([self isEnabled])
|
if ([self isEnabled])
|
||||||
{
|
{
|
||||||
[_background_color set];
|
[_background_color set];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[[NSColor controlBackgroundColor] set];
|
[[NSColor controlBackgroundColor] set];
|
||||||
}
|
}
|
||||||
NSRectFill([self drawingRectForBounds: cellFrame]);
|
NSRectFill([self drawingRectForBounds: cellFrame]);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue