Use GSDrawingFunctions instead of Function.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19483 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2004-06-07 23:54:25 +00:00
parent daa0b750c0
commit f962706ef0
11 changed files with 60 additions and 111 deletions

View file

@ -1,3 +1,19 @@
2004-06-08 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSCell.m: (-drawWithFrame:inView:)
* Source/NSFormCell.m: (-drawWithFrame:inView:)
* Source/NSTableHeaderCell.m: (-drawWithFrame:inView:)
* Source/NSTableView.m: (-drawRect:)
* Source/NSColorWell.m: (-drawRect:)
* Source/NSProgressIndicator.m: (+initialize, -drawRect:)
* Source/NSScrollView.m: (-drawRect:)
* Source/NSTabView.m: (-drawRect:)
* Source/GSTitleView.m: (-drawRect:)
* Source/NSBrowser.m: (-drawRect:, [GSBrowserTitleCell drawWithFrame:inView:])
Use GSDrawingFunction methods instead of NS functions. Also
changed colour of progress indicatore. Patch by Nicholas Roard
<nicolas@roard.com>.
2004-06-07 Quentin Mathe <qmathe@club-internet.fr>
* Source/NSComboBoxCell.m: Added complete documentation.
* Source/NSComboBox.m: Minor documentation corrections.

View file

@ -37,6 +37,8 @@
#include <Foundation/NSDebug.h>
#include <Foundation/NSRunLoop.h>
#include "GNUstepGUI/GSDrawFunctions.h"
@implementation GSTitleView
// ============================================================================
@ -211,7 +213,7 @@
// Rectangle 2
// Draw the title box's button.
NSDrawButton(workRect, workRect);
[GSDrawFunctions drawButton: workRect :workRect];
// Overdraw white top and left lines with light gray lines for window title
workRect.origin.y += 1;

View file

@ -52,6 +52,7 @@
#include "AppKit/NSEvent.h"
#include "AppKit/NSWindow.h"
#include "AppKit/NSBezierPath.h"
#include "GNUstepGUI/GSDrawFunctions.h"
DEFINE_RINT_IF_MISSING
@ -192,7 +193,7 @@ static NSTextFieldCell *titleCell;
return;
}
NSDrawGrayBezel (cellFrame, NSZeroRect);
[GSDrawFunctions drawGrayBezel: cellFrame : NSZeroRect];
[self drawInteriorWithFrame: cellFrame inView: controlView];
}
@end
@ -2072,7 +2073,7 @@ static NSTextFieldCell *titleCell;
if ((NSIntersectsRect (scrollerBorderRect, rect) == YES) && _window)
{
NSDrawGrayBezel (scrollerBorderRect, rect);
[GSDrawFunctions drawGrayBezel: scrollerBorderRect : rect];
}
}
@ -2083,7 +2084,7 @@ static NSTextFieldCell *titleCell;
float hScrollerWidth = _hasHorizontalScroller ? scrollerWidth : 0;
// Columns borders
NSDrawGrayBezel (_bounds, rect);
[GSDrawFunctions drawGrayBezel: _bounds : rect];
[[NSColor blackColor] set];
visibleColumns = [self numberOfVisibleColumns];

View file

@ -60,6 +60,7 @@
#include "AppKit/NSTextContainer.h"
#include "AppKit/NSView.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
static Class colorClass;
static Class cellClass;
@ -1715,7 +1716,7 @@ static NSColor *shadowCol;
}
else if (_cell.is_bezeled)
{
NSDrawWhiteBezel(cellFrame, NSZeroRect);
[GSDrawFunctions drawWhiteBezel: cellFrame : NSZeroRect];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];

View file

@ -37,6 +37,7 @@
#include "AppKit/NSGraphics.h"
#include "AppKit/NSPasteboard.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include <Foundation/NSDebug.h>
#include <Foundation/NSNotification.h>
@ -163,7 +164,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
/*
* Draw border.
*/
NSDrawButton(aRect, clipRect);
[GSDrawFunctions drawButton: aRect : clipRect];
/*
* Fill in control color.
@ -200,7 +201,7 @@ static NSString *GSColorWellDidBecomeExclusiveNotification =
/*
* Draw inner frame.
*/
NSDrawGrayBezel(aRect, clipRect);
[GSDrawFunctions drawGrayBezel: aRect : clipRect];
aRect = NSInsetRect(aRect, 2.0, 2.0);
}

View file

@ -34,6 +34,7 @@
#include "AppKit/NSFont.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSTextFieldCell.h"
#include "GNUstepGUI/GSDrawFunctions.h"
static NSColor *shadowCol;
@ -322,7 +323,9 @@ static NSColor *shadowCol;
}
else if (_cell.is_bezeled)
{
NSDrawWhiteBezel(borderedFrame, NSZeroRect);
NSRect frame = [GSDrawFunctions drawWhiteBezel: borderedFrame : NSZeroRect];
[[NSColor textBackgroundColor] set];
NSRectFill (frame);
}
//

View file

@ -27,6 +27,7 @@
#include "AppKit/NSProgressIndicator.h"
#include "AppKit/NSGraphics.h"
#include "AppKit/NSWindow.h"
#include "GNUstepGUI/GSDrawFunctions.h"
@implementation NSProgressIndicator
@ -40,7 +41,8 @@ static NSImage *images[maxCount];
{
[self setVersion: 1];
// FIXME: Should come from defaults and should be reset when defaults change
fillColour = RETAIN([NSColor blueColor]);
// FIXME: Should probably get the color from the color extension list (see NSToolbar)
fillColour = RETAIN([NSColor controlShadowColor]);
// FIXME: Load the images and set maxCount
}
}
@ -227,11 +229,8 @@ static NSImage *images[maxCount];
// Draw the Bezel
if (_isBezeled)
{
NSSize borderSize = _sizeForBorderType (NSBezelBorder);
NSDrawGrayBezel(_bounds, rect);
// Calc the inside rect to be drawn
r = NSInsetRect(_bounds, borderSize.width, borderSize.height);
r = [GSDrawFunctions drawGrayBezel: _bounds :rect];
}
else
r = _bounds;

View file

@ -40,6 +40,7 @@
#include "AppKit/NSTableView.h"
#include "AppKit/NSWindow.h"
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSDrawFunctions.h"
@implementation NSScrollView
@ -917,11 +918,11 @@ static float scrollerWidth;
break;
case NSBezelBorder:
NSDrawGrayBezel(_bounds, rect);
[GSDrawFunctions drawGrayBezel: _bounds : rect];
break;
case NSGrooveBorder:
NSDrawGroove(_bounds, rect);
[GSDrawFunctions drawGroove: _bounds : rect];
break;
}

View file

@ -35,6 +35,7 @@
#include "AppKit/NSTabView.h"
#include "AppKit/NSTabViewItem.h"
#include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSDrawFunctions.h"
@implementation NSTabView
@ -346,7 +347,6 @@
- (void) drawRect: (NSRect)rect
{
NSGraphicsContext *ctxt = GSCurrentContext();
float borderThickness;
int howMany = [_items count];
int i;
NSRect previousRect;
@ -360,31 +360,26 @@
default:
case NSTopTabsBezelBorder:
aRect.size.height -= 16;
NSDrawButton(aRect, NSZeroRect);
borderThickness = 2;
[GSDrawFunctions drawButton: aRect : NSZeroRect];
break;
case NSBottomTabsBezelBorder:
aRect.size.height -= 16;
aRect.origin.y += 16;
NSDrawButton(aRect, rect);
[GSDrawFunctions drawButton: aRect : rect];
aRect.origin.y -= 16;
borderThickness = 2;
break;
case NSNoTabsBezelBorder:
NSDrawButton(aRect, rect);
borderThickness = 2;
[GSDrawFunctions drawButton: aRect : rect];
break;
case NSNoTabsLineBorder:
[[NSColor controlDarkShadowColor] set];
NSFrameRect(aRect);
borderThickness = 1;
break;
case NSNoTabsNoBorder:
borderThickness = 0;
break;
}

View file

@ -29,6 +29,7 @@
#include "AppKit/NSGraphics.h"
#include "AppKit/NSImage.h"
#include "AppKit/DPSOperators.h"
#include "GNUstepGUI/GSDrawFunctions.h"
// Cache the colors
static NSColor *bgCol;
@ -55,66 +56,22 @@ static NSColor *clearCol = nil;
- (void) drawWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView
{
NSRect interiorFrame = NSMakeRect (cellFrame.origin.x-1, cellFrame.origin.y-1,
cellFrame.size.width+2, cellFrame.size.height+2);
if (NSIsEmptyRect (cellFrame) || ![controlView window])
return;
if (_cell.is_highlighted == YES)
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
NSMinXEdge, NSMaxYEdge};
NSRectEdge down_sides[] = {NSMaxXEdge, NSMaxYEdge,
NSMinXEdge, NSMinYEdge};
float grays[] = {NSBlack, NSBlack,
NSWhite, NSWhite};
NSRect rect;
NSGraphicsContext *ctxt;
ctxt = GSCurrentContext();
if (GSWViewIsFlipped(ctxt) == YES)
{
rect = NSDrawTiledRects(cellFrame, NSZeroRect,
down_sides, grays, 4);
}
else
{
rect = NSDrawTiledRects(cellFrame, NSZeroRect,
up_sides, grays, 4);
}
DPSsetgray(ctxt, NSLightGray);
DPSrectfill(ctxt, NSMinX(rect), NSMinY(rect),
NSWidth(rect), NSHeight(rect));
[GSDrawFunctions drawButton: cellFrame :cellFrame];
}
else
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
NSMinXEdge, NSMaxYEdge};
NSRectEdge down_sides[] = {NSMaxXEdge, NSMaxYEdge,
NSMinXEdge, NSMinYEdge};
float grays[] = {NSBlack, NSBlack,
NSLightGray, NSLightGray};
NSRect rect;
NSGraphicsContext *ctxt;
ctxt = GSCurrentContext();
if (GSWViewIsFlipped(ctxt) == YES)
{
rect = NSDrawTiledRects(cellFrame, NSZeroRect,
down_sides, grays, 4);
}
else
{
rect = NSDrawTiledRects(cellFrame, NSZeroRect,
up_sides, grays, 4);
}
DPSsetgray(ctxt, NSDarkGray);
DPSrectfill(ctxt, NSMinX(rect), NSMinY(rect),
NSWidth(rect), NSHeight(rect));
[GSDrawFunctions drawDarkButton: cellFrame :cellFrame];
}
[self drawInteriorWithFrame: cellFrame inView: controlView];
[self drawInteriorWithFrame: interiorFrame inView: controlView];
}
- (NSColor *)textColor

View file

@ -57,6 +57,7 @@
#include "AppKit/NSPasteboard.h"
#include "AppKit/NSDragging.h"
#include "AppKit/NSCustomImageRep.h"
#include "GNUstepGUI/GSDrawFunctions.h"
#include <math.h>
static NSNotificationCenter *nc = nil;
@ -1904,44 +1905,16 @@ _isCellEditable (id delegate, NSArray *tableColumns,
- (void) drawRect: (NSRect)aRect
{
NSRectEdge up_sides[] = {NSMaxXEdge, NSMinYEdge,
NSMinXEdge, NSMaxYEdge,
NSMinYEdge};
NSRectEdge down_sides[] = {NSMaxXEdge, NSMaxYEdge,
NSMinXEdge, NSMinYEdge,
NSMaxYEdge};
float grays[] = {NSBlack, NSBlack,
NSLightGray, NSLightGray,
NSBlack};
NSRect rect;
NSGraphicsContext *ctxt = GSCurrentContext();
NSRect divide = NSMakeRect (aRect.origin.x, aRect.origin.y, aRect.size.width, 1);
NSRect rect = aRect;
rect.origin.y += 1;
rect.size.height -= 1;
if (GSWViewIsFlipped(ctxt) == YES)
{
rect = NSDrawTiledRects(_bounds, aRect,
down_sides, grays, 5);
}
else
{
rect = NSDrawTiledRects(_bounds, aRect,
up_sides, grays, 5);
}
DPSsetgray(ctxt, NSDarkGray);
DPSrectfill(ctxt, NSMinX(rect), NSMinY(rect),
NSWidth(rect), NSHeight(rect));
/*
NSRect rect = _bounds;
NSDrawButton (rect, aRect);
[[NSColor blackColor] set];
NSRectFill (divide);
rect = [GSDrawFunctions drawDarkButton: rect :aRect];
[[NSColor controlShadowColor] set];
rect.size.width -= 4;
rect.size.height -= 4;
rect.origin.x += 2;
rect.origin.y += 2;
NSRectFill (rect);*/
NSRectFill (rect);
}
@end