mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-29 22:07:39 +00:00
Fill out implementation of NSFont, NSColor, and NSMenu.
Library now requires tiff and DPSclient libraries. Remove a number of functions which should be implemented in backend. Correct many method definitions that should use NSNotification. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@1762 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6991ce1d91
commit
2c37af52c9
37 changed files with 1354 additions and 749 deletions
|
@ -57,386 +57,3 @@ void NSLog(NSString *format, ...)
|
|||
void NSNullLog(NSString *format, ...)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
// Rectangle Drawing Functions
|
||||
//
|
||||
//
|
||||
// Optimize Drawing
|
||||
//
|
||||
void NSEraseRect(NSRect aRect)
|
||||
{}
|
||||
|
||||
void NSHighlightRect(NSRect aRect)
|
||||
{}
|
||||
|
||||
void NSRectClip(NSRect aRect)
|
||||
{}
|
||||
|
||||
void NSRectClipList(const NSRect *rects, int count)
|
||||
{}
|
||||
|
||||
void NS__RectFill(id self, NSRect aRect)
|
||||
{
|
||||
char out[80];
|
||||
sprintf(out, "DPS: rect: %f %f %f %f\n", aRect.origin.x,
|
||||
aRect.origin.y, aRect.size.width, aRect.size.height);
|
||||
NSDebugLog([NSString stringWithCString: out]);
|
||||
|
||||
PSrectfill(aRect.origin.x, aRect.origin.y,
|
||||
aRect.size.width, aRect.size.height);
|
||||
}
|
||||
|
||||
void NSRectFillList(const NSRect *rects, int count)
|
||||
{}
|
||||
|
||||
void NSRectFillListWithGrays(const NSRect *rects,
|
||||
const float *grays, int count)
|
||||
{}
|
||||
|
||||
//
|
||||
// Draw a Bordered Rectangle
|
||||
//
|
||||
void NSDrawButton(NSRect aRect, NSRect clipRect)
|
||||
{}
|
||||
|
||||
void NSDrawGrayBezel(NSRect aRect, NSRect clipRect)
|
||||
{}
|
||||
|
||||
void NSDrawGroove(NSRect aRect, NSRect clipRect)
|
||||
{}
|
||||
|
||||
NSRect NSDrawTiledRects(NSRect boundsRect, NSRect clipRect,
|
||||
const NSRectEdge *sides, const float *grays,
|
||||
int count)
|
||||
{
|
||||
return NSZeroRect;
|
||||
}
|
||||
|
||||
void NSDrawWhiteBezel(NSRect aRect, NSRect clipRect)
|
||||
{}
|
||||
|
||||
void NSFrameRect(NSRect aRect)
|
||||
{}
|
||||
|
||||
void NSFrameRectWithWidth(NSRect aRect, float frameWidth)
|
||||
{}
|
||||
|
||||
//
|
||||
// Color Functions
|
||||
//
|
||||
//
|
||||
// Get Information About Color Space and Window Depth
|
||||
//
|
||||
const NSWindowDepth *NSAvailableWindowDepths(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSWindowDepth NSBestDepth(NSString *colorSpace,
|
||||
int bitsPerSample, int bitsPerPixel,
|
||||
BOOL planar, BOOL *exactMatch)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NSBitsPerPixelFromDepth(NSWindowDepth depth)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NSBitsPerSampleFromDepth(NSWindowDepth depth)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NSString *NSColorSpaceFromDepth(NSWindowDepth depth)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
int NSNumberOfColorComponents(NSString *colorSpaceName)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL NSPlanarFromDepth(NSWindowDepth depth)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the Color at a Screen Position
|
||||
//
|
||||
NSColor *NSReadPixel(NSPoint location)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// Text Functions
|
||||
//
|
||||
//
|
||||
// Filter Characters Entered into a Text Object
|
||||
//
|
||||
unsigned short NSEditorFilter(unsigned short theChar,
|
||||
int flags, NSStringEncoding theEncoding)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned short NSFieldFilter(unsigned short theChar,
|
||||
int flags, NSStringEncoding theEncoding)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate or Draw a Line of Text (in Text Object)
|
||||
//
|
||||
int NSDrawALine(id self, NSLayInfo *layInfo)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NSScanALine(id self, NSLayInfo *layInfo)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Calculate Font Ascender, Descender, and Line Height (in Text Object)
|
||||
//
|
||||
void NSTextFontInfo(id fid,
|
||||
float *ascender, float *descender,
|
||||
float *lineHeight)
|
||||
{}
|
||||
|
||||
//
|
||||
// Access Text Object's Word Tables
|
||||
//
|
||||
NSData * NSDataWithWordTable(const unsigned char *smartLeft,
|
||||
const unsigned char *smartRight,
|
||||
const unsigned char *charClasses,
|
||||
const NSFSM *wrapBreaks,
|
||||
int wrapBreaksCount,
|
||||
const NSFSM *clickBreaks,
|
||||
int clickBreaksCount,
|
||||
BOOL charWrap)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
void NSReadWordTable(NSZone *zone,
|
||||
NSData *data,
|
||||
unsigned char **smartLeft,
|
||||
unsigned char **smartRight,
|
||||
unsigned char **charClasses,
|
||||
NSFSM **wrapBreaks,
|
||||
int *wrapBreaksCount,
|
||||
NSFSM **clickBreaks,
|
||||
int *clickBreaksCount,
|
||||
BOOL *charWrap)
|
||||
{}
|
||||
|
||||
//
|
||||
// Array Allocation Functions for Use by the NSText Class
|
||||
//
|
||||
NSTextChunk *NSChunkCopy(NSTextChunk *pc, NSTextChunk *dpc)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSTextChunk *NSChunkGrow(NSTextChunk *pc, int newUsed)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSTextChunk *NSChunkMalloc(int growBy, int initUsed)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSTextChunk *NSChunkRealloc(NSTextChunk *pc)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSTextChunk *NSChunkZoneCopy(NSTextChunk *pc,
|
||||
NSTextChunk *dpc,
|
||||
NSZone *zone)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSTextChunk *NSChunkZoneGrow(NSTextChunk *pc, int newUsed, NSZone *zone)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSTextChunk *NSChunkZoneMalloc(int growBy, int initUsed, NSZone *zone)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
NSTextChunk *NSChunkZoneRealloc(NSTextChunk *pc, NSZone *zone)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Imaging Functions
|
||||
//
|
||||
//
|
||||
// Copy an image
|
||||
//
|
||||
void NSCopyBitmapFromGState(int srcGstate, NSRect srcRect, NSRect destRect)
|
||||
{}
|
||||
|
||||
void NSCopyBits(int srcGstate, NSRect srcRect, NSPoint destPoint)
|
||||
{}
|
||||
|
||||
//
|
||||
// Render Bitmap Images
|
||||
//
|
||||
void NSDrawBitmap(NSRect rect,
|
||||
int pixelsWide,
|
||||
int pixelsHigh,
|
||||
int bitsPerSample,
|
||||
int samplesPerPixel,
|
||||
int bitsPerPixel,
|
||||
int bytesPerRow,
|
||||
BOOL isPlanar,
|
||||
BOOL hasAlpha,
|
||||
NSString *colorSpaceName,
|
||||
const unsigned char *const data[5])
|
||||
{}
|
||||
|
||||
//
|
||||
// Attention Panel Functions
|
||||
//
|
||||
//
|
||||
// Create an Attention Panel without Running It Yet
|
||||
//
|
||||
id NSGetAlertPanel(NSString *title,
|
||||
NSString *msg,
|
||||
NSString *defaultButton,
|
||||
NSString *alternateButton,
|
||||
NSString *otherButton, ...)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// Create and Run an Attention Panel
|
||||
//
|
||||
int NSRunAlertPanel(NSString *title,
|
||||
NSString *msg,
|
||||
NSString *defaultButton,
|
||||
NSString *alternateButton,
|
||||
NSString *otherButton, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int NSRunLocalizedAlertPanel(NSString *table,
|
||||
NSString *title,
|
||||
NSString *msg,
|
||||
NSString *defaultButton,
|
||||
NSString *alternateButton,
|
||||
NSString *otherButton, ...)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Release an Attention Panel
|
||||
//
|
||||
void NSReleaseAlertPanel(id panel)
|
||||
{}
|
||||
|
||||
//
|
||||
// Services Menu Functions
|
||||
//
|
||||
//
|
||||
// Determine Whether an Item Is Included in Services Menus
|
||||
//
|
||||
int NSSetShowsServicesMenuItem(NSString *item, BOOL showService)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL NSShowsServicesMenuItem(NSString *item)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
//
|
||||
// Programmatically Invoke a Service
|
||||
//
|
||||
BOOL NSPerformService(NSString *item, NSPasteboard *pboard)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
//
|
||||
// Force Services Menu to Update Based on New Services
|
||||
//
|
||||
void NSUpdateDynamicServices(void)
|
||||
{}
|
||||
|
||||
//
|
||||
// Other Application Kit Functions
|
||||
//
|
||||
//
|
||||
// Play the System Beep
|
||||
//
|
||||
void NSBeep(void)
|
||||
{
|
||||
#ifdef WIN32
|
||||
MessageBeep(MB_OK);
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
// Return File-related Pasteboard Types
|
||||
//
|
||||
NSString *NSCreateFileContentsPboardType(NSString *fileType)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *NSCreateFilenamePboardType(NSString *filename)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSString *NSGetFileType(NSString *pboardType)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSArray *NSGetFileTypes(NSArray *pboardTypes)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
|
||||
//
|
||||
// Draw a Distinctive Outline around Linked Data
|
||||
//
|
||||
void NSFrameLinkRect(NSRect aRect, BOOL isDestination)
|
||||
{}
|
||||
|
||||
float NSLinkFrameThickness(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Convert an Event Mask Type to a Mask
|
||||
//
|
||||
unsigned int NSEventMaskFromType(NSEventType type)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ includedir = $(prefix)/include
|
|||
|
||||
MAKEDEFINES =
|
||||
|
||||
CC = @CC@ -g -DHAVE_LIBTIFF
|
||||
CC = @CC@ -g
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CFLAGS = -c $(GCCFLAGS) -I../Headers $(CPPFLAGS)
|
||||
|
||||
|
|
|
@ -869,40 +869,40 @@ NSString *NSApplicationWillUpdateNotification;
|
|||
return result;
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:sender
|
||||
- (void)applicationDidBecomeActive:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationDidBecomeActive:)])
|
||||
[delegate applicationDidBecomeActive:sender];
|
||||
[delegate applicationDidBecomeActive:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:sender
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationDidFinishLaunching:)])
|
||||
[delegate applicationDidFinishLaunching:sender];
|
||||
[delegate applicationDidFinishLaunching:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationDidHide:sender
|
||||
- (void)applicationDidHide:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationDidHide:)])
|
||||
[delegate applicationDidHide:sender];
|
||||
[delegate applicationDidHide:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationDidResignActive:sender
|
||||
- (void)applicationDidResignActive:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationDidResignActive:)])
|
||||
[delegate applicationDidResignActive:sender];
|
||||
[delegate applicationDidResignActive:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationDidUnhide:sender
|
||||
- (void)applicationDidUnhide:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationDidUnhide:)])
|
||||
[delegate applicationDidUnhide:sender];
|
||||
[delegate applicationDidUnhide:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationDidUpdate:sender
|
||||
- (void)applicationDidUpdate:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationDidUpdate:)])
|
||||
[delegate applicationDidUpdate:sender];
|
||||
[delegate applicationDidUpdate:aNotification];
|
||||
}
|
||||
|
||||
- (BOOL)applicationOpenUntitledFile:(NSApplication *)app
|
||||
|
@ -925,40 +925,40 @@ NSString *NSApplicationWillUpdateNotification;
|
|||
return result;
|
||||
}
|
||||
|
||||
- (void)applicationWillBecomeActive:sender
|
||||
- (void)applicationWillBecomeActive:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationWillBecomeActive:)])
|
||||
[delegate applicationWillBecomeActive:sender];
|
||||
[delegate applicationWillBecomeActive:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationWillFinishLaunching:sender
|
||||
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationWillFinishLaunching:)])
|
||||
[delegate applicationWillFinishLaunching:sender];
|
||||
[delegate applicationWillFinishLaunching:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationWillHide:sender
|
||||
- (void)applicationWillHide:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationWillHide:)])
|
||||
[delegate applicationWillHide:sender];
|
||||
[delegate applicationWillHide:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:sender
|
||||
- (void)applicationWillResignActive:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationWillResignActive:)])
|
||||
[delegate applicationWillResignActive:sender];
|
||||
[delegate applicationWillResignActive:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationWillUnhide:sender
|
||||
- (void)applicationWillUnhide:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationWillUnhide:)])
|
||||
[delegate applicationWillUnhide:sender];
|
||||
[delegate applicationWillUnhide:aNotification];
|
||||
}
|
||||
|
||||
- (void)applicationWillUpdate:sender
|
||||
- (void)applicationWillUpdate:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(applicationWillUpdate:)])
|
||||
[delegate applicationWillUpdate:sender];
|
||||
[delegate applicationWillUpdate:aNotification];
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -202,11 +202,6 @@
|
|||
//
|
||||
- (void)drawRect:(NSRect)rect
|
||||
{
|
||||
NSColor *c = [NSColor redColor];
|
||||
|
||||
PSsetcolor(c);
|
||||
PSrectstroke(border_rect.origin.x, border_rect.origin.y,
|
||||
border_rect.size.width, border_rect.size.height);
|
||||
}
|
||||
|
||||
//
|
||||
|
|
463
Source/NSColor.m
463
Source/NSColor.m
|
@ -29,58 +29,32 @@
|
|||
*/
|
||||
|
||||
#include <gnustep/gui/NSColor.h>
|
||||
#include <gnustep/gui/NSColorPrivate.h>
|
||||
#include <gnustep/gui/NSView.h>
|
||||
|
||||
// Class variables
|
||||
BOOL gnustep_gui_ignores_alpha;
|
||||
|
||||
// Global strings
|
||||
NSString *NSCalibratedWhiteColorSpace;
|
||||
NSString *NSCalibratedBlackColorSpace;
|
||||
NSString *NSCalibratedRGBColorSpace;
|
||||
NSString *NSDeviceWhiteColorSpace;
|
||||
NSString *NSDeviceBlackColorSpace;
|
||||
NSString *NSDeviceRGBColorSpace;
|
||||
NSString *NSDeviceCMYKColorSpace;
|
||||
NSString *NSNamedColorSpace;
|
||||
NSString *NSCustomColorSpace;
|
||||
NSString *NSCalibratedWhiteColorSpace = @"NSCalibratedWhiteColorSpace";
|
||||
NSString *NSCalibratedBlackColorSpace = @"NSCalibratedBlackColorSpace";
|
||||
NSString *NSCalibratedRGBColorSpace = @"NSCalibratedRGBColorSpace";
|
||||
NSString *NSDeviceWhiteColorSpace = @"NSDeviceWhiteColorSpace";
|
||||
NSString *NSDeviceBlackColorSpace = @"NSDeviceBlackColorSpace";
|
||||
NSString *NSDeviceRGBColorSpace = @"NSDeviceRGBColorSpace";
|
||||
NSString *NSDeviceCMYKColorSpace = @"NSDeviceCMYKColorSpace";
|
||||
NSString *NSNamedColorSpace = @"NSNamedColorSpace";
|
||||
NSString *NSCustomColorSpace = @"NSCustomColorSpace";
|
||||
|
||||
// Global gray values
|
||||
const float NSBlack = 0;
|
||||
const float NSDarkGray = .502;
|
||||
const float NSDarkGray = .333;
|
||||
const float NSGray = 0.5;
|
||||
const float NSLightGray = .667;
|
||||
const float NSWhite = 1;
|
||||
const float NSLightGray = .753;
|
||||
|
||||
@implementation NSColor
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Internal methods
|
||||
//
|
||||
- (void)setRed:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
RGB_component.red = value;
|
||||
}
|
||||
|
||||
- (void)setGreen:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
RGB_component.green = value;
|
||||
}
|
||||
|
||||
- (void)setBlue:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
RGB_component.blue = value;
|
||||
}
|
||||
|
||||
- (void)setClear:(BOOL)flag
|
||||
{
|
||||
is_clear = flag;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Class methods
|
||||
//
|
||||
|
@ -88,8 +62,11 @@ const float NSLightGray = .753;
|
|||
{
|
||||
if (self == [NSColor class])
|
||||
{
|
||||
// Initial version
|
||||
[self setVersion:1];
|
||||
// Set the version number
|
||||
[self setVersion:2];
|
||||
|
||||
// ignore alpha by default
|
||||
gnustep_gui_ignores_alpha = YES;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +78,17 @@ const float NSLightGray = .753;
|
|||
brightness:(float)brightness
|
||||
alpha:(float)alpha
|
||||
{
|
||||
return nil;
|
||||
NSColor *c;
|
||||
|
||||
c = [[[NSColor alloc] init] autorelease];
|
||||
[c setColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
[c setActiveComponent: GNUSTEP_GUI_HSB_ACTIVE];
|
||||
[c setHue: hue];
|
||||
[c setSaturation: saturation];
|
||||
[c setBrightness: brightness];
|
||||
[c setAlpha: alpha];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
+ (NSColor *)colorWithCalibratedRed:(float)red
|
||||
|
@ -112,17 +99,28 @@ const float NSLightGray = .753;
|
|||
NSColor *c;
|
||||
|
||||
c = [[[NSColor alloc] init] autorelease];
|
||||
[c setRed:red];
|
||||
[c setGreen:green];
|
||||
[c setBlue:blue];
|
||||
[c setClear:NO];
|
||||
[c setColorSpaceName: NSCalibratedRGBColorSpace];
|
||||
[c setActiveComponent: GNUSTEP_GUI_RGB_ACTIVE];
|
||||
[c setRed: red];
|
||||
[c setGreen: green];
|
||||
[c setBlue: blue];
|
||||
[c setAlpha: alpha];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
+ (NSColor *)colorWithCalibratedWhite:(float)white
|
||||
alpha:(float)alpha
|
||||
{
|
||||
return nil;
|
||||
NSColor *c;
|
||||
|
||||
c = [[[NSColor alloc] init] autorelease];
|
||||
[c setColorSpaceName: NSCalibratedWhiteColorSpace];
|
||||
[c setActiveComponent: GNUSTEP_GUI_WHITE_ACTIVE];
|
||||
[c setWhite: white];
|
||||
[c setAlpha: alpha];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
+ (NSColor *)colorWithCatalogName:(NSString *)listName
|
||||
|
@ -137,7 +135,18 @@ const float NSLightGray = .753;
|
|||
black:(float)black
|
||||
alpha:(float)alpha
|
||||
{
|
||||
return nil;
|
||||
NSColor *c;
|
||||
|
||||
c = [[[NSColor alloc] init] autorelease];
|
||||
[c setColorSpaceName: NSDeviceCMYKColorSpace];
|
||||
[c setActiveComponent: GNUSTEP_GUI_CMYK_ACTIVE];
|
||||
[c setCyan: cyan];
|
||||
[c setMagenta: magenta];
|
||||
[c setYellow: yellow];
|
||||
[c setBlack: black];
|
||||
[c setAlpha: alpha];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
+ (NSColor *)colorWithDeviceHue:(float)hue
|
||||
|
@ -145,7 +154,17 @@ const float NSLightGray = .753;
|
|||
brightness:(float)brightness
|
||||
alpha:(float)alpha
|
||||
{
|
||||
return nil;
|
||||
NSColor *c;
|
||||
|
||||
c = [[[NSColor alloc] init] autorelease];
|
||||
[c setColorSpaceName: NSDeviceRGBColorSpace];
|
||||
[c setActiveComponent: GNUSTEP_GUI_HSB_ACTIVE];
|
||||
[c setHue: hue];
|
||||
[c setSaturation: saturation];
|
||||
[c setBrightness: brightness];
|
||||
[c setAlpha: alpha];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
+ (NSColor *)colorWithDeviceRed:(float)red
|
||||
|
@ -153,13 +172,31 @@ const float NSLightGray = .753;
|
|||
blue:(float)blue
|
||||
alpha:(float)alpha
|
||||
{
|
||||
return self;
|
||||
NSColor *c;
|
||||
|
||||
c = [[[NSColor alloc] init] autorelease];
|
||||
[c setColorSpaceName: NSDeviceRGBColorSpace];
|
||||
[c setActiveComponent: GNUSTEP_GUI_RGB_ACTIVE];
|
||||
[c setRed: red];
|
||||
[c setGreen: green];
|
||||
[c setBlue: blue];
|
||||
[c setAlpha: alpha];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
+ (NSColor *)colorWithDeviceWhite:(float)white
|
||||
alpha:(float)alpha
|
||||
{
|
||||
return nil;
|
||||
NSColor *c;
|
||||
|
||||
c = [[[NSColor alloc] init] autorelease];
|
||||
[c setColorSpaceName: NSDeviceWhiteColorSpace];
|
||||
[c setActiveComponent: GNUSTEP_GUI_WHITE_ACTIVE];
|
||||
[c setWhite: white];
|
||||
[c setAlpha: alpha];
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -167,10 +204,7 @@ const float NSLightGray = .753;
|
|||
//
|
||||
+ (NSColor *)blackColor
|
||||
{
|
||||
return [self colorWithCalibratedRed:0
|
||||
green:0
|
||||
blue:0
|
||||
alpha:1];
|
||||
return [self colorWithCalibratedWhite: NSBlack alpha: 1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)blueColor
|
||||
|
@ -178,7 +212,7 @@ const float NSLightGray = .753;
|
|||
return [self colorWithCalibratedRed:0
|
||||
green:0
|
||||
blue:1.0
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)brownColor
|
||||
|
@ -186,7 +220,7 @@ const float NSLightGray = .753;
|
|||
return [self colorWithCalibratedRed:0.6
|
||||
green:0.4
|
||||
blue:0.2
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)clearColor
|
||||
|
@ -195,33 +229,35 @@ const float NSLightGray = .753;
|
|||
c = [self colorWithCalibratedRed:0
|
||||
green:1.0
|
||||
blue:1.0
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
[c setClear:YES];
|
||||
return c;
|
||||
}
|
||||
|
||||
+ (NSColor *)cyanColor
|
||||
{
|
||||
// Why does OpenStep say RGB color space instead of CMYK?
|
||||
return [self colorWithCalibratedRed:0
|
||||
green:1.0
|
||||
blue:1.0
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
#if 0
|
||||
return [self colorWithCalibratedCyan: 1.0
|
||||
magenta:0
|
||||
yellow:0
|
||||
black:0
|
||||
alpha:1.0];
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (NSColor *)darkGrayColor
|
||||
{
|
||||
return [self colorWithCalibratedRed:0.502
|
||||
green:0.502
|
||||
blue:0.502
|
||||
alpha:1];
|
||||
return [self colorWithCalibratedWhite: NSDarkGray alpha: 1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)grayColor
|
||||
{
|
||||
return [self colorWithCalibratedRed:0.753
|
||||
green:0.753
|
||||
blue:0.753
|
||||
alpha:1];
|
||||
return [self colorWithCalibratedWhite: NSGray alpha: 1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)greenColor
|
||||
|
@ -229,23 +265,28 @@ const float NSLightGray = .753;
|
|||
return [self colorWithCalibratedRed:0
|
||||
green:1.0
|
||||
blue:0
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)lightGrayColor
|
||||
{
|
||||
return [self colorWithCalibratedRed:0.9
|
||||
green:0.9
|
||||
blue:0.9
|
||||
alpha:1];
|
||||
return [self colorWithCalibratedWhite: NSLightGray alpha: 1];
|
||||
}
|
||||
|
||||
+ (NSColor *)magentaColor
|
||||
{
|
||||
// Why does OpenStep say RGB color space instead of CMYK?
|
||||
return [self colorWithCalibratedRed:1.0
|
||||
green:0
|
||||
blue:1.0
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
#if 0
|
||||
return [self colorWithCalibratedCyan:0
|
||||
magenta:1.0
|
||||
yellow:0
|
||||
black:0
|
||||
alpha:1.0];
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (NSColor *)orangeColor;
|
||||
|
@ -253,7 +294,7 @@ const float NSLightGray = .753;
|
|||
return [self colorWithCalibratedRed:1.0
|
||||
green:0.5
|
||||
blue:0
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)purpleColor;
|
||||
|
@ -261,7 +302,7 @@ const float NSLightGray = .753;
|
|||
return [self colorWithCalibratedRed:0.5
|
||||
green:0
|
||||
blue:0.5
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)redColor;
|
||||
|
@ -269,23 +310,28 @@ const float NSLightGray = .753;
|
|||
return [self colorWithCalibratedRed:1.0
|
||||
green:0
|
||||
blue:0
|
||||
alpha:1];
|
||||
alpha:1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)whiteColor;
|
||||
{
|
||||
return [self colorWithCalibratedRed:1.0
|
||||
green:1.0
|
||||
blue:1.0
|
||||
alpha:1];
|
||||
return [self colorWithCalibratedWhite: NSWhite alpha: 1.0];
|
||||
}
|
||||
|
||||
+ (NSColor *)yellowColor
|
||||
{
|
||||
// Why does OpenStep say RGB color space instead of CMYK?
|
||||
return [self colorWithCalibratedRed:1.0
|
||||
green:1.0
|
||||
blue:0
|
||||
alpha:1.0];
|
||||
#if 0
|
||||
return [self colorWithCalibratedCyan:0
|
||||
magenta:0
|
||||
yellow:1.0
|
||||
black:0
|
||||
alpha:1];
|
||||
#endif
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -293,11 +339,13 @@ const float NSLightGray = .753;
|
|||
//
|
||||
+ (BOOL)ignoresAlpha
|
||||
{
|
||||
return YES;
|
||||
return gnustep_gui_ignores_alpha;
|
||||
}
|
||||
|
||||
+ (void)setIgnoresAlpha:(BOOL)flag
|
||||
{}
|
||||
{
|
||||
gnustep_gui_ignores_alpha = flag;
|
||||
}
|
||||
|
||||
//
|
||||
// Copying and Pasting
|
||||
|
@ -311,6 +359,16 @@ const float NSLightGray = .753;
|
|||
//
|
||||
// Instance methods
|
||||
//
|
||||
- init
|
||||
{
|
||||
[super init];
|
||||
|
||||
colorspace_name = @"";
|
||||
catalog_name = @"";
|
||||
color_name = @"";
|
||||
return self;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieving a Set of Components
|
||||
//
|
||||
|
@ -319,23 +377,65 @@ const float NSLightGray = .753;
|
|||
yellow:(float *)yellow
|
||||
black:(float *)black
|
||||
alpha:(float *)alpha
|
||||
{}
|
||||
{
|
||||
// Only set what is wanted
|
||||
// If not a CMYK color then you get bogus values
|
||||
if (cyan)
|
||||
*cyan = CMYK_component.cyan;
|
||||
if (magenta)
|
||||
*magenta = CMYK_component.magenta;
|
||||
if (yellow)
|
||||
*yellow = CMYK_component.yellow;
|
||||
if (black)
|
||||
*black = CMYK_component.black;
|
||||
if (alpha)
|
||||
*alpha = alpha_component;
|
||||
}
|
||||
|
||||
- (void)getHue:(float *)hue
|
||||
saturation:(float *)saturation
|
||||
brightness:(float *)brightness
|
||||
alpha:(float *)alpha
|
||||
{}
|
||||
{
|
||||
// Only set what is wanted
|
||||
// If not an HSB color then you get bogus values
|
||||
if (hue)
|
||||
*hue = HSB_component.hue;
|
||||
if (saturation)
|
||||
*saturation = HSB_component.saturation;
|
||||
if (brightness)
|
||||
*brightness = HSB_component.brightness;
|
||||
if (alpha)
|
||||
*alpha = alpha_component;
|
||||
}
|
||||
|
||||
- (void)getRed:(float *)red
|
||||
green:(float *)green
|
||||
blue:(float *)blue
|
||||
alpha:(float *)alpha
|
||||
{}
|
||||
{
|
||||
// Only set what is wanted
|
||||
// If not an RGB color then you get bogus values
|
||||
if (red)
|
||||
*red = RGB_component.red;
|
||||
if (green)
|
||||
*green = RGB_component.green;
|
||||
if (blue)
|
||||
*blue = RGB_component.blue;
|
||||
if (alpha)
|
||||
*alpha = alpha_component;
|
||||
}
|
||||
|
||||
- (void)getWhite:(float *)white
|
||||
alpha:(float *)alpha
|
||||
{}
|
||||
{
|
||||
// Only set what is wanted
|
||||
// If not a grayscale color then you get bogus values
|
||||
if (white)
|
||||
*white = white_component;
|
||||
if (alpha)
|
||||
*alpha = alpha_component;
|
||||
}
|
||||
|
||||
//
|
||||
// Retrieving Individual Components
|
||||
|
@ -347,7 +447,7 @@ const float NSLightGray = .753;
|
|||
|
||||
- (float)blackComponent
|
||||
{
|
||||
return 0;
|
||||
return CMYK_component.black;
|
||||
}
|
||||
|
||||
- (float)blueComponent
|
||||
|
@ -357,22 +457,22 @@ const float NSLightGray = .753;
|
|||
|
||||
- (float)brightnessComponent
|
||||
{
|
||||
return 0;
|
||||
return HSB_component.brightness;
|
||||
}
|
||||
|
||||
- (NSString *)catalogNameComponent
|
||||
{
|
||||
return nil;
|
||||
return catalog_name;
|
||||
}
|
||||
|
||||
- (NSString *)colorNameComponent
|
||||
{
|
||||
return nil;
|
||||
return color_name;
|
||||
}
|
||||
|
||||
- (float)cyanComponent
|
||||
{
|
||||
return 0;
|
||||
return CMYK_component.cyan;
|
||||
}
|
||||
|
||||
- (float)greenComponent
|
||||
|
@ -382,22 +482,24 @@ const float NSLightGray = .753;
|
|||
|
||||
- (float)hueComponent
|
||||
{
|
||||
return 0;
|
||||
return HSB_component.hue;
|
||||
}
|
||||
|
||||
- (NSString *)localizedCatalogNameComponent
|
||||
{
|
||||
return nil;
|
||||
// +++ how do we localize?
|
||||
return catalog_name;
|
||||
}
|
||||
|
||||
- (NSString *)localizedColorNameComponent
|
||||
{
|
||||
return nil;
|
||||
// +++ how do we localize?
|
||||
return color_name;
|
||||
}
|
||||
|
||||
- (float)magentaComponent
|
||||
{
|
||||
return 0;
|
||||
return CMYK_component.magenta;
|
||||
}
|
||||
|
||||
- (float)redComponent
|
||||
|
@ -407,17 +509,17 @@ const float NSLightGray = .753;
|
|||
|
||||
- (float)saturationComponent
|
||||
{
|
||||
return 0;
|
||||
return HSB_component.saturation;
|
||||
}
|
||||
|
||||
- (float)whiteComponent
|
||||
{
|
||||
return 0;
|
||||
return white_component;
|
||||
}
|
||||
|
||||
- (float)yellowComponent
|
||||
{
|
||||
return 0;
|
||||
return CMYK_component.yellow;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -425,7 +527,7 @@ const float NSLightGray = .753;
|
|||
//
|
||||
- (NSString *)colorSpaceName
|
||||
{
|
||||
return nil;
|
||||
return colorspace_name;
|
||||
}
|
||||
|
||||
- (NSColor *)colorUsingColorSpaceName:(NSString *)colorSpace
|
||||
|
@ -484,24 +586,181 @@ const float NSLightGray = .753;
|
|||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
// Version 1
|
||||
[aCoder encodeValueOfObjCType: "f" at: &RGB_component.red];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &RGB_component.green];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &RGB_component.blue];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &alpha_component];
|
||||
[aCoder encodeValueOfObjCType: @encode(BOOL) at: &is_clear];
|
||||
|
||||
// Version 2
|
||||
[aCoder encodeObject: colorspace_name];
|
||||
[aCoder encodeObject: catalog_name];
|
||||
[aCoder encodeObject: color_name];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &CMYK_component.cyan];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &CMYK_component.magenta];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &CMYK_component.yellow];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &CMYK_component.black];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &HSB_component.hue];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &HSB_component.saturation];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &HSB_component.brightness];
|
||||
[aCoder encodeValueOfObjCType: "f" at: &white_component];
|
||||
[aCoder encodeValueOfObjCType: "i" at: &active_component];
|
||||
}
|
||||
|
||||
- initWithCoder:aDecoder
|
||||
{
|
||||
NSString *s;
|
||||
[super initWithCoder:aDecoder];
|
||||
|
||||
// Version 1
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &RGB_component.red];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &RGB_component.green];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &RGB_component.blue];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &alpha_component];
|
||||
[aDecoder decodeValueOfObjCType: @encode(BOOL) at: &is_clear];
|
||||
|
||||
// Get our class name
|
||||
s = [NSString stringWithCString: object_get_class_name(self)];
|
||||
|
||||
// Version 2
|
||||
if ([aDecoder versionForClassName: s] > 1)
|
||||
{
|
||||
colorspace_name = [aDecoder decodeObject];
|
||||
catalog_name = [aDecoder decodeObject];
|
||||
color_name = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &CMYK_component.cyan];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &CMYK_component.magenta];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &CMYK_component.yellow];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &CMYK_component.black];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &HSB_component.hue];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &HSB_component.saturation];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &HSB_component.brightness];
|
||||
[aDecoder decodeValueOfObjCType: "f" at: &white_component];
|
||||
[aDecoder decodeValueOfObjCType: "i" at: &active_component];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
// Private methods
|
||||
//
|
||||
@implementation NSColor (GNUstepPrivate)
|
||||
|
||||
- (void)setColorSpaceName:(NSString *)str
|
||||
{
|
||||
colorspace_name = str;
|
||||
}
|
||||
|
||||
- (void)setCatalogName:(NSString *)str
|
||||
{
|
||||
catalog_name = str;
|
||||
}
|
||||
|
||||
- (void)setColorName:(NSString *)str
|
||||
{
|
||||
color_name = str;
|
||||
}
|
||||
|
||||
// RGB component values
|
||||
- (void)setRed:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
RGB_component.red = value;
|
||||
}
|
||||
|
||||
- (void)setGreen:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
RGB_component.green = value;
|
||||
}
|
||||
|
||||
- (void)setBlue:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
RGB_component.blue = value;
|
||||
}
|
||||
|
||||
// CMYK component values
|
||||
- (void)setCyan:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
CMYK_component.cyan = value;
|
||||
}
|
||||
|
||||
- (void)setMagenta:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
CMYK_component.magenta = value;
|
||||
}
|
||||
|
||||
- (void)setYellow:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
CMYK_component.yellow = value;
|
||||
}
|
||||
|
||||
- (void)setBlack:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
CMYK_component.black = value;
|
||||
}
|
||||
|
||||
// HSB component values
|
||||
- (void)setHue:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
HSB_component.hue = value;
|
||||
}
|
||||
|
||||
- (void)setSaturation:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
HSB_component.saturation = value;
|
||||
}
|
||||
|
||||
- (void)setBrightness:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
HSB_component.brightness = value;
|
||||
}
|
||||
|
||||
// Grayscale
|
||||
- (void)setWhite:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
white_component = value;
|
||||
}
|
||||
|
||||
- (void)setAlpha:(float)value
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
if (value > 1) value = 1;
|
||||
alpha_component = value;
|
||||
}
|
||||
|
||||
- (void)setActiveComponent:(int)value
|
||||
{
|
||||
active_component = value;
|
||||
}
|
||||
|
||||
- (void)setClear:(BOOL)flag
|
||||
{
|
||||
is_clear = flag;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -88,8 +88,8 @@ BOOL GNU_CONTEXT_SYNCHRONIZED;
|
|||
|
||||
return [self initWithMutableData: data
|
||||
forDebugging: NO
|
||||
languageEncoding: NULL
|
||||
nameEncoding: NULL
|
||||
languageEncoding: dps_ascii
|
||||
nameEncoding: dps_strings
|
||||
textProc: NULL
|
||||
errorProc: NULL];
|
||||
}
|
||||
|
|
181
Source/NSFont.m
181
Source/NSFont.m
|
@ -30,28 +30,30 @@
|
|||
|
||||
#include <gnustep/gui/NSFont.h>
|
||||
#include <gnustep/gui/NSFontManager.h>
|
||||
#include <gnustep/gui/NSFontPrivate.h>
|
||||
|
||||
NSFont *gnustep_gui_user_fixed_font;
|
||||
NSFont *gnustep_gui_user_font;
|
||||
NSString *gnustep_gui_system_family = @"";
|
||||
|
||||
// Global Strings
|
||||
NSString *NSAFMAscender;
|
||||
NSString *NSAFMCapHeight;
|
||||
NSString *NSAFMCharacterSet;
|
||||
NSString *NSAFMDescender;
|
||||
NSString *NSAFMEncodingScheme;
|
||||
NSString *NSAFMFamilyName;
|
||||
NSString *NSAFMFontName;
|
||||
NSString *NSAFMFormatVersion;
|
||||
NSString *NSAFMFullName;
|
||||
NSString *NSAFMItalicAngle;
|
||||
NSString *NSAFMMappingScheme;
|
||||
NSString *NSAFMNotice;
|
||||
NSString *NSAFMUnderlinePosition;
|
||||
NSString *NSAFMUnderlineThickness;
|
||||
NSString *NSAFMVersion;
|
||||
NSString *NSAFMWeight;
|
||||
NSString *NSAFMXHeight;
|
||||
NSString *NSAFMAscender = @"AFMAscender";
|
||||
NSString *NSAFMCapHeight = @"AFMCapHeight";
|
||||
NSString *NSAFMCharacterSet = @"AFMCharacterSet";
|
||||
NSString *NSAFMDescender = @"AFMDescender";
|
||||
NSString *NSAFMEncodingScheme = @"AFMEncodingScheme";
|
||||
NSString *NSAFMFamilyName = @"AFMFamilyName";
|
||||
NSString *NSAFMFontName = @"AFMFontName";
|
||||
NSString *NSAFMFormatVersion = @"AFMFormatVersion";
|
||||
NSString *NSAFMFullName = @"AFMFullName";
|
||||
NSString *NSAFMItalicAngle = @"AFMItalicAngle";
|
||||
NSString *NSAFMMappingScheme = @"AFMMappingScheme";
|
||||
NSString *NSAFMNotice = @"AFMNotice";
|
||||
NSString *NSAFMUnderlinePosition = @"AFMUnderlinePosition";
|
||||
NSString *NSAFMUnderlineThickness = @"AFMUnderlineThickness";
|
||||
NSString *NSAFMVersion = @"AFMVersion";
|
||||
NSString *NSAFMWeight = @"AFMWeight";
|
||||
NSString *NSAFMXHeight = @"AFMXHeight";
|
||||
|
||||
@implementation NSFont
|
||||
|
||||
|
@ -77,7 +79,7 @@ NSString *NSAFMXHeight;
|
|||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
||||
NSFont *f;
|
||||
|
||||
f = [fm fontWithFamily:@"Times New Roman" traits:NSBoldFontMask
|
||||
f = [fm fontWithFamily:gnustep_gui_system_family traits:NSBoldFontMask
|
||||
weight:0 size:fontSize];
|
||||
return f;
|
||||
}
|
||||
|
@ -94,7 +96,8 @@ NSString *NSAFMXHeight;
|
|||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
||||
NSFont *f;
|
||||
|
||||
f = [fm fontWithFamily:fontName traits:0 weight:0 size:fontSize];
|
||||
// +++ We need to extract the family name from the font name
|
||||
f = [fm fontWithFamily:fontName traits:0 weight:400 size:fontSize];
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -103,7 +106,8 @@ NSString *NSAFMXHeight;
|
|||
NSFontManager *fm = [NSFontManager sharedFontManager];
|
||||
NSFont *f;
|
||||
|
||||
f = [fm fontWithFamily:@"Times New Roman" traits:0 weight:0 size:fontSize];
|
||||
f = [fm fontWithFamily:gnustep_gui_system_family traits:0
|
||||
weight:400 size:fontSize];
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -138,6 +142,17 @@ NSString *NSAFMXHeight;
|
|||
//
|
||||
// Instance methods
|
||||
//
|
||||
- init
|
||||
{
|
||||
[super init];
|
||||
|
||||
family_name = @"";
|
||||
font_name = @"";
|
||||
type_face = @"";
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
|
@ -178,11 +193,6 @@ NSString *NSAFMXHeight;
|
|||
return family_name;
|
||||
}
|
||||
|
||||
- (void)setFamilyName:(NSString *)familyName
|
||||
{
|
||||
family_name = familyName;
|
||||
}
|
||||
|
||||
- (NSString *)fontName
|
||||
{
|
||||
return font_name;
|
||||
|
@ -203,43 +213,25 @@ NSString *NSAFMXHeight;
|
|||
return point_size;
|
||||
}
|
||||
|
||||
- (void)setPointSize:(float)value
|
||||
{
|
||||
point_size = value;
|
||||
}
|
||||
|
||||
- (NSFont *)printerFont
|
||||
{
|
||||
return nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSFont *)screenFont
|
||||
{
|
||||
return nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (float)widthOfString:(NSString *)string
|
||||
{
|
||||
/* bogus estimate */
|
||||
if (string)
|
||||
return (8.0 * (float)[string length]);
|
||||
else
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (float *)widths
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
- (NSFontTraitMask)traits
|
||||
{
|
||||
return font_traits;
|
||||
}
|
||||
|
||||
- (void)setTraits:(NSFontTraitMask)traits
|
||||
{
|
||||
font_traits = traits;
|
||||
}
|
||||
|
||||
//
|
||||
// Manipulating Glyphs
|
||||
|
@ -292,3 +284,100 @@ NSString *NSAFMXHeight;
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSFont (GNUstepPrivate)
|
||||
|
||||
- (void)setFamilyName:(NSString *)familyName
|
||||
{
|
||||
NSMutableString *s = [NSMutableString stringWithCString: ""];
|
||||
|
||||
// New family name so new font name
|
||||
// Format is family name, dash, typeface
|
||||
family_name = familyName;
|
||||
[s appendString: family_name];
|
||||
|
||||
if ([type_face compare: @""] != NSOrderedSame)
|
||||
{
|
||||
[s appendString: @"-"];
|
||||
[s appendString: type_face];
|
||||
}
|
||||
font_name = s;
|
||||
}
|
||||
|
||||
- (void)setFontName:(NSString *)fontName
|
||||
{
|
||||
font_name = fontName;
|
||||
}
|
||||
|
||||
- (void)setPointSize:(float)value
|
||||
{
|
||||
point_size = value;
|
||||
}
|
||||
|
||||
- (NSFontTraitMask)traits
|
||||
{
|
||||
return font_traits;
|
||||
}
|
||||
|
||||
- (void)setTraits:(NSFontTraitMask)traits
|
||||
{
|
||||
// Only if the traits have changed
|
||||
if (font_traits != traits)
|
||||
{
|
||||
// Figure out a new typeface
|
||||
NSMutableString *s = [NSMutableString stringWithCString: ""];
|
||||
|
||||
// Bold
|
||||
if (traits & NSBoldFontMask)
|
||||
[s appendString: @"Bold"];
|
||||
|
||||
// +++ How do we determine whether to use Italic or Oblique?
|
||||
if (traits & NSItalicFontMask)
|
||||
[s appendString: @"Italic"];
|
||||
|
||||
[self setTypeface: s];
|
||||
}
|
||||
font_traits = traits;
|
||||
}
|
||||
|
||||
- (int)weight
|
||||
{
|
||||
return font_weight;
|
||||
}
|
||||
|
||||
- (void)setWeight:(int)value
|
||||
{
|
||||
NSFontTraitMask t = font_traits;
|
||||
|
||||
font_weight = value;
|
||||
// Make the font bold or unbold based upon the weight
|
||||
if (font_weight <= 400)
|
||||
t = t ^ NSUnboldFontMask;
|
||||
else
|
||||
t = t ^ NSBoldFontMask;
|
||||
[self setTraits:t];
|
||||
}
|
||||
|
||||
- (NSString *)typeface
|
||||
{
|
||||
return type_face;
|
||||
}
|
||||
|
||||
- (void)setTypeface:(NSString *)str
|
||||
{
|
||||
NSMutableString *s = [NSMutableString stringWithCString: ""];
|
||||
|
||||
// New typeface so new font name
|
||||
// Format is family name, dash, typeface
|
||||
type_face = str;
|
||||
[s appendString: family_name];
|
||||
|
||||
if ([type_face compare: @""] != NSOrderedSame)
|
||||
{
|
||||
[s appendString: @"-"];
|
||||
[s appendString: type_face];
|
||||
}
|
||||
font_name = s;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include <gnustep/gui/NSFontManager.h>
|
||||
#include <gnustep/gui/NSApplication.h>
|
||||
#include <gnustep/gui/NSFontPrivate.h>
|
||||
|
||||
//
|
||||
// Class variables
|
||||
|
@ -133,6 +134,7 @@ id MB_THE_FONT_PANEL_FACTORY;
|
|||
- (NSFont *)convertFont:(NSFont *)fontObject
|
||||
toFace:(NSString *)typeface
|
||||
{
|
||||
// +++ How to do this conversion?
|
||||
return fontObject;
|
||||
}
|
||||
|
||||
|
@ -196,19 +198,41 @@ id MB_THE_FONT_PANEL_FACTORY;
|
|||
- (NSFont *)convertWeight:(BOOL)upFlag
|
||||
ofFont:(NSFont *)fontObject
|
||||
{
|
||||
return fontObject;
|
||||
int w = [fontObject weight];
|
||||
NSFont *f = [fontObject mutableCopy];
|
||||
|
||||
// Weight are sort of arbitrary, so we will use
|
||||
// 0 - light, 400 - normal, 700 - bold
|
||||
if (upFlag)
|
||||
{
|
||||
if (w == 0)
|
||||
w = 400;
|
||||
else if (w == 400)
|
||||
w = 700;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (w == 700)
|
||||
w = 400;
|
||||
else if (w == 400)
|
||||
w = 0;
|
||||
}
|
||||
|
||||
[f setWeight: w];
|
||||
return f;
|
||||
}
|
||||
|
||||
- (NSFont *)fontWithFamily:(NSString *)family
|
||||
traits:(NSFontTraitMask)traits
|
||||
weight:(int)weight
|
||||
size:(float)size
|
||||
weight:(int)weight
|
||||
size:(float)size
|
||||
{
|
||||
int i, j;
|
||||
BOOL found = NO;
|
||||
NSString *name;
|
||||
NSFont *f;
|
||||
|
||||
// Make sure it is a legitimate family name
|
||||
j = [family_list count];
|
||||
for (i = 0;i < j; ++i)
|
||||
{
|
||||
|
@ -220,12 +244,14 @@ weight:(int)weight
|
|||
}
|
||||
}
|
||||
|
||||
// Create the font
|
||||
if (found)
|
||||
{
|
||||
f = [[NSFont alloc] init];
|
||||
[f setFamilyName:family];
|
||||
[f setTraits:traits];
|
||||
[f setPointSize:size];
|
||||
[f setFamilyName: family];
|
||||
[f setTraits: traits];
|
||||
[f setWeight: weight];
|
||||
[f setPointSize: size];
|
||||
return f;
|
||||
}
|
||||
else
|
||||
|
@ -296,11 +322,12 @@ weight:(int)weight
|
|||
|
||||
- (NSFontTraitMask)traitsOfFont:(NSFont *)fontObject
|
||||
{
|
||||
return 0;
|
||||
return [fontObject traits];
|
||||
}
|
||||
|
||||
- (int)weightOfFont:(NSFont *)fontObject
|
||||
{
|
||||
return [fontObject weight];
|
||||
}
|
||||
|
||||
//
|
||||
|
|
|
@ -29,9 +29,12 @@
|
|||
*/
|
||||
|
||||
#include <gnustep/gui/NSMenu.h>
|
||||
#include <gnustep/gui/NSMenuPrivate.h>
|
||||
#include <Foundation/NSLock.h>
|
||||
#include <gnustep/base/NSCoder.h>
|
||||
|
||||
NSZone *gnustep_gui_nsmenu_zone = NULL;
|
||||
|
||||
@implementation NSMenu
|
||||
|
||||
//
|
||||
|
@ -51,11 +54,13 @@
|
|||
//
|
||||
+ (NSZone *)menuZone
|
||||
{
|
||||
return NULL;
|
||||
return gnustep_gui_nsmenu_zone;
|
||||
}
|
||||
|
||||
+ (void)setMenuZone:(NSZone *)zone
|
||||
{}
|
||||
{
|
||||
gnustep_gui_nsmenu_zone = zone;
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
|
@ -68,10 +73,19 @@
|
|||
return [self initWithTitle:@""];
|
||||
}
|
||||
|
||||
// Default initializer
|
||||
- (id)initWithTitle:(NSString *)aTitle
|
||||
{
|
||||
// Init our superclass but skip any of its backend implementation
|
||||
[super cleanInit];
|
||||
|
||||
window_title = aTitle;
|
||||
menu_items = [NSMutableArray array];
|
||||
super_menu = nil;
|
||||
autoenables_items = NO;
|
||||
menu_matrix = nil;
|
||||
is_torn_off = NO;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
@ -80,7 +94,7 @@
|
|||
//
|
||||
- (id)addItemWithTitle:(NSString *)aString
|
||||
action:(SEL)aSelector
|
||||
keyEquivalent:(NSString *)charCode
|
||||
keyEquivalent:(NSString *)charCode
|
||||
{
|
||||
NSMenuCell *m;
|
||||
unsigned int mi;
|
||||
|
@ -94,8 +108,8 @@ keyEquivalent:(NSString *)charCode
|
|||
|
||||
- (id)insertItemWithTitle:(NSString *)aString
|
||||
action:(SEL)aSelector
|
||||
keyEquivalent:(NSString *)charCode
|
||||
atIndex:(unsigned int)index
|
||||
keyEquivalent:(NSString *)charCode
|
||||
atIndex:(unsigned int)index
|
||||
{
|
||||
NSMenuCell *m;
|
||||
unsigned int mi;
|
||||
|
@ -114,11 +128,13 @@ keyEquivalent:(NSString *)charCode
|
|||
|
||||
- (NSMatrix *)itemMatrix
|
||||
{
|
||||
return nil;
|
||||
return menu_matrix;
|
||||
}
|
||||
|
||||
- (void)setItemMatrix:(NSMatrix *)aMatrix
|
||||
{}
|
||||
{
|
||||
menu_matrix = aMatrix;
|
||||
}
|
||||
|
||||
//
|
||||
// Finding Menu Items
|
||||
|
@ -128,6 +144,7 @@ keyEquivalent:(NSString *)charCode
|
|||
int i, j;
|
||||
NSMenuCell *m, *found;
|
||||
|
||||
// Recursively find the menu cell with the tag
|
||||
found = nil;
|
||||
j = [menu_items count];
|
||||
for (i = 0;i < j; ++i)
|
||||
|
@ -159,6 +176,9 @@ keyEquivalent:(NSString *)charCode
|
|||
// Set the menucell's submenu
|
||||
[m setSubmenu:aMenu];
|
||||
|
||||
// Tell the submenu we are its supermenu
|
||||
[aMenu setSupermenu: self];
|
||||
|
||||
// Return the menucell
|
||||
return m;
|
||||
}
|
||||
|
@ -174,17 +194,17 @@ keyEquivalent:(NSString *)charCode
|
|||
//
|
||||
- (NSMenu *)attachedMenu
|
||||
{
|
||||
return nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isAttached
|
||||
{
|
||||
return NO;
|
||||
return !is_torn_off;
|
||||
}
|
||||
|
||||
- (BOOL)isTornOff
|
||||
{
|
||||
return NO;
|
||||
return is_torn_off;
|
||||
}
|
||||
|
||||
- (NSPoint)locationForSubmenu:(NSMenu *)aSubmenu
|
||||
|
@ -197,7 +217,7 @@ keyEquivalent:(NSString *)charCode
|
|||
|
||||
- (NSMenu *)supermenu
|
||||
{
|
||||
return nil;
|
||||
return super_menu;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -205,11 +225,13 @@ keyEquivalent:(NSString *)charCode
|
|||
//
|
||||
- (BOOL)autoenablesItems
|
||||
{
|
||||
return NO;
|
||||
return autoenables_items;
|
||||
}
|
||||
|
||||
- (void)setAutoenablesItems:(BOOL)flag
|
||||
{}
|
||||
{
|
||||
autoenables_items = flag;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding protocol
|
||||
|
@ -231,3 +253,12 @@ keyEquivalent:(NSString *)charCode
|
|||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSMenu (GNUstepPrivate)
|
||||
|
||||
- (void)setSupermenu:(NSMenu *)obj
|
||||
{
|
||||
super_menu = obj;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -740,11 +740,6 @@ NSString *NSViewFocusChangedNotification;
|
|||
|
||||
- (void)drawRect:(NSRect)rect
|
||||
{
|
||||
NSColor *col;
|
||||
|
||||
col = [window backgroundColor];
|
||||
PSsetcolor(col);
|
||||
NSRectFill(rect);
|
||||
}
|
||||
|
||||
- (NSRect)visibleRect
|
||||
|
@ -930,8 +925,8 @@ NSString *NSViewFocusChangedNotification;
|
|||
|
||||
- (NSTrackingRectTag)addTrackingRect:(NSRect)aRect
|
||||
owner:(id)anObject
|
||||
userData:(void *)data
|
||||
assumeInside:(BOOL)flag
|
||||
userData:(void *)data
|
||||
assumeInside:(BOOL)flag
|
||||
{
|
||||
NSTrackingRectTag t;
|
||||
int i, j;
|
||||
|
@ -964,19 +959,19 @@ userData:(void *)data
|
|||
//
|
||||
- (BOOL)dragFile:(NSString *)filename
|
||||
fromRect:(NSRect)rect
|
||||
slideBack:(BOOL)slideFlag
|
||||
event:(NSEvent *)event
|
||||
slideBack:(BOOL)slideFlag
|
||||
event:(NSEvent *)event
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)dragImage:(NSImage *)anImage
|
||||
at:(NSPoint)viewLocation
|
||||
offset:(NSSize)initialOffset
|
||||
event:(NSEvent *)event
|
||||
pasteboard:(NSPasteboard *)pboard
|
||||
source:(id)sourceObject
|
||||
slideBack:(BOOL)slideFlag
|
||||
offset:(NSSize)initialOffset
|
||||
event:(NSEvent *)event
|
||||
pasteboard:(NSPasteboard *)pboard
|
||||
source:(id)sourceObject
|
||||
slideBack:(BOOL)slideFlag
|
||||
{}
|
||||
|
||||
- (void)registerForDraggedTypes:(NSArray *)newTypes
|
||||
|
@ -1008,14 +1003,14 @@ slideBack:(BOOL)slideFlag
|
|||
//
|
||||
- (void)adjustPageHeightNew:(float *)newBottom
|
||||
top:(float)oldTop
|
||||
bottom:(float)oldBottom
|
||||
limit:(float)bottomLimit
|
||||
bottom:(float)oldBottom
|
||||
limit:(float)bottomLimit
|
||||
{}
|
||||
|
||||
- (void)adjustPageWidthNew:(float *)newRight
|
||||
left:(float)oldLeft
|
||||
right:(float)oldRight
|
||||
limit:(float)rightLimit
|
||||
right:(float)oldRight
|
||||
limit:(float)rightLimit
|
||||
{}
|
||||
|
||||
- (float)heightAdjustLimit
|
||||
|
@ -1052,7 +1047,7 @@ right:(float)oldRight
|
|||
|
||||
- (void)beginPage:(int)ordinalNum
|
||||
label:(NSString *)aString
|
||||
bBox:(NSRect)pageRect
|
||||
bBox:(NSRect)pageRect
|
||||
fonts:(NSString *)fontNames
|
||||
{}
|
||||
|
||||
|
@ -1062,11 +1057,11 @@ bBox:(NSRect)pageRect
|
|||
|
||||
- (void)beginPrologueBBox:(NSRect)boundingBox
|
||||
creationDate:(NSString *)dateCreated
|
||||
createdBy:(NSString *)anApplication
|
||||
fonts:(NSString *)fontNames
|
||||
forWhom:(NSString *)user
|
||||
pages:(int)numPages
|
||||
title:(NSString *)aTitle
|
||||
createdBy:(NSString *)anApplication
|
||||
fonts:(NSString *)fontNames
|
||||
forWhom:(NSString *)user
|
||||
pages:(int)numPages
|
||||
title:(NSString *)aTitle
|
||||
{}
|
||||
|
||||
- (void)beginSetup
|
||||
|
|
|
@ -1166,88 +1166,88 @@ NSString *NSWindowWillMoveNotification;
|
|||
return nil;
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:sender
|
||||
- (void)windowDidBecomeKey:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidBecomeKey:)])
|
||||
return [delegate windowDidBecomeKey:sender];
|
||||
return [delegate windowDidBecomeKey:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeMain:sender
|
||||
- (void)windowDidBecomeMain:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidBecomeMain:)])
|
||||
return [delegate windowDidBecomeMain:sender];
|
||||
return [delegate windowDidBecomeMain:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidChangeScreen:sender
|
||||
- (void)windowDidChangeScreen:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidChangeScreen:)])
|
||||
return [delegate windowDidChangeScreen:sender];
|
||||
return [delegate windowDidChangeScreen:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidDeminiaturize:sender
|
||||
- (void)windowDidDeminiaturize:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidDeminiaturize:)])
|
||||
return [delegate windowDidDeminiaturize:sender];
|
||||
return [delegate windowDidDeminiaturize:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidExpose:sender
|
||||
- (void)windowDidExpose:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidExpose:)])
|
||||
return [delegate windowDidExpose:sender];
|
||||
return [delegate windowDidExpose:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidMiniaturize:sender
|
||||
- (void)windowDidMiniaturize:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidMiniaturize:)])
|
||||
return [delegate windowDidMiniaturize:sender];
|
||||
return [delegate windowDidMiniaturize:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidMove:sender
|
||||
- (void)windowDidMove:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidMove:)])
|
||||
return [delegate windowDidMove:sender];
|
||||
return [delegate windowDidMove:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidResignKey:sender
|
||||
- (void)windowDidResignKey:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidResignKey:)])
|
||||
return [delegate windowDidResignKey:sender];
|
||||
return [delegate windowDidResignKey:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidResignMain:sender
|
||||
- (void)windowDidResignMain:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidResignMain:)])
|
||||
return [delegate windowDidResignMain:sender];
|
||||
return [delegate windowDidResignMain:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidResize:sender
|
||||
- (void)windowDidResize:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidResize:)])
|
||||
return [delegate windowDidResize:sender];
|
||||
return [delegate windowDidResize:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowDidUpdate:sender
|
||||
- (void)windowDidUpdate:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowDidUpdate:)])
|
||||
return [delegate windowDidUpdate:sender];
|
||||
return [delegate windowDidUpdate:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowWillClose:sender
|
||||
- (void)windowWillClose:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowWillClose:)])
|
||||
return [delegate windowWillClose:sender];
|
||||
return [delegate windowWillClose:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowWillMiniaturize:sender
|
||||
- (void)windowWillMiniaturize:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowWillMiniaturize:)])
|
||||
return [delegate windowWillMiniaturize:sender];
|
||||
return [delegate windowWillMiniaturize:aNotification];
|
||||
}
|
||||
|
||||
- (void)windowWillMove:sender
|
||||
- (void)windowWillMove:(NSNotification *)aNotification
|
||||
{
|
||||
if ([delegate respondsTo:@selector(windowWillMove:)])
|
||||
return [delegate windowWillMove:sender];
|
||||
return [delegate windowWillMove:aNotification];
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1336,4 +1336,12 @@ NSString *NSWindowWillMoveNotification;
|
|||
// Do nothing, should be overridden by back-end
|
||||
}
|
||||
|
||||
// Allow subclasses to init without the backend class
|
||||
// attempting to create an actual window
|
||||
- cleanInit
|
||||
{
|
||||
[super init];
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -53,7 +53,6 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> /* for L_SET, etc definitions */
|
||||
#include <gnustep/base/objc-malloc.h>
|
||||
#include <AppKit/nsimage-tiff.h>
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue