mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 02:20:49 +00:00
New methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@11735 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1a4b92fb34
commit
e25669d434
3 changed files with 69 additions and 12 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2001-12-12 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSCursor: New cache dictionary.
|
||||||
|
(-greenArrowCursor): New method.
|
||||||
|
(-initWithImage:foregroundColorHint:backgroundColorHint:hotSpot:):
|
||||||
|
Implement.
|
||||||
|
|
||||||
2001-12-09 Willem Rein Oudshoorn <woudshoo@xs4all.nl>
|
2001-12-09 Willem Rein Oudshoorn <woudshoo@xs4all.nl>
|
||||||
|
|
||||||
* Source/NSWindow.m (GSPerformVoidDragSelector): rewritten to not
|
* Source/NSWindow.m (GSPerformVoidDragSelector): rewritten to not
|
||||||
|
|
|
@ -93,6 +93,10 @@ backgroundColorHint:(NSColor *)bg
|
||||||
+ (NSCursor*) currentCursor;
|
+ (NSCursor*) currentCursor;
|
||||||
+ (NSCursor*) IBeamCursor;
|
+ (NSCursor*) IBeamCursor;
|
||||||
|
|
||||||
|
#ifndef NO_GNUSTEP
|
||||||
|
+ (NSCursor*) greenArrowCursor;
|
||||||
|
#endif
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
/* Cursor types */
|
/* Cursor types */
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <Foundation/NSArray.h>
|
#include <Foundation/NSArray.h>
|
||||||
|
#include <AppKit/NSColor.h>
|
||||||
#include <AppKit/NSCursor.h>
|
#include <AppKit/NSCursor.h>
|
||||||
|
#include <AppKit/NSGraphics.h>
|
||||||
#include <AppKit/NSImage.h>
|
#include <AppKit/NSImage.h>
|
||||||
#include <AppKit/NSBitmapImageRep.h>
|
#include <AppKit/NSBitmapImageRep.h>
|
||||||
#include <AppKit/NSGraphicsContext.h>
|
#include <AppKit/NSGraphicsContext.h>
|
||||||
|
@ -39,8 +41,7 @@ static NSCursor *gnustep_gui_current_cursor;
|
||||||
static BOOL gnustep_gui_hidden_until_move;
|
static BOOL gnustep_gui_hidden_until_move;
|
||||||
static Class NSCursor_class;
|
static Class NSCursor_class;
|
||||||
|
|
||||||
static NSCursor *arrowCursor = nil;
|
static NSMutableDictionary *cursorDict = nil;
|
||||||
static NSCursor *ibeamCursor = nil;
|
|
||||||
|
|
||||||
@implementation NSCursor
|
@implementation NSCursor
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ static NSCursor *ibeamCursor = nil;
|
||||||
NSCursor_class = self;
|
NSCursor_class = self;
|
||||||
gnustep_gui_cursor_stack = [[NSMutableArray alloc] initWithCapacity: 2];
|
gnustep_gui_cursor_stack = [[NSMutableArray alloc] initWithCapacity: 2];
|
||||||
gnustep_gui_hidden_until_move = YES;
|
gnustep_gui_hidden_until_move = YES;
|
||||||
|
cursorDict = RETAIN([NSMutableDictionary dictionary]);
|
||||||
[[self arrowCursor] push];
|
[[self arrowCursor] push];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,15 +146,19 @@ static NSCursor *ibeamCursor = nil;
|
||||||
*/
|
*/
|
||||||
+ (NSCursor*) arrowCursor
|
+ (NSCursor*) arrowCursor
|
||||||
{
|
{
|
||||||
if (arrowCursor == nil)
|
NSString *name = @"GSArrowCursor";
|
||||||
|
NSCursor *cursor = [cursorDict objectForKey: name];
|
||||||
|
if (cursor == nil)
|
||||||
{
|
{
|
||||||
void *c;
|
void *c;
|
||||||
|
|
||||||
arrowCursor = [[NSCursor_class alloc] initWithImage: nil];
|
cursor = [[NSCursor_class alloc] initWithImage: nil];
|
||||||
DPSstandardcursor(GSCurrentContext(), GSArrowCursor, &c);
|
DPSstandardcursor(GSCurrentContext(), GSArrowCursor, &c);
|
||||||
[arrowCursor _setCid: c];
|
[cursor _setCid: c];
|
||||||
|
[cursorDict setObject: cursor forKey: name];
|
||||||
|
RELEASE(cursor);
|
||||||
}
|
}
|
||||||
return arrowCursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSCursor*) currentCursor
|
+ (NSCursor*) currentCursor
|
||||||
|
@ -162,15 +168,37 @@ static NSCursor *ibeamCursor = nil;
|
||||||
|
|
||||||
+ (NSCursor*) IBeamCursor
|
+ (NSCursor*) IBeamCursor
|
||||||
{
|
{
|
||||||
if (ibeamCursor == nil)
|
NSString *name = @"GSIBeamCursor";
|
||||||
|
NSCursor *cursor = [cursorDict objectForKey: name];
|
||||||
|
if (cursor == nil)
|
||||||
{
|
{
|
||||||
void *c;
|
void *c;
|
||||||
|
|
||||||
ibeamCursor = [[NSCursor_class alloc] initWithImage: nil];
|
cursor = [[NSCursor_class alloc] initWithImage: nil];
|
||||||
DPSstandardcursor(GSCurrentContext(), GSIBeamCursor, &c);
|
DPSstandardcursor(GSCurrentContext(), GSIBeamCursor, &c);
|
||||||
[ibeamCursor _setCid: c];
|
[cursor _setCid: c];
|
||||||
|
[cursorDict setObject: cursor forKey: name];
|
||||||
|
RELEASE(cursor);
|
||||||
}
|
}
|
||||||
return ibeamCursor;
|
return cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSCursor*) greenArrowCursor
|
||||||
|
{
|
||||||
|
NSString *name = @"GSGreenArrowCursor";
|
||||||
|
NSCursor *cursor = [cursorDict objectForKey: name];
|
||||||
|
if (cursor == nil)
|
||||||
|
{
|
||||||
|
void *c;
|
||||||
|
|
||||||
|
cursor = [[NSCursor_class alloc] initWithImage: nil];
|
||||||
|
DPSstandardcursor(GSCurrentContext(), GSArrowCursor, &c);
|
||||||
|
DPSsetcursorcolor(GSCurrentContext (), 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, c);
|
||||||
|
[cursor _setCid: c];
|
||||||
|
[cursorDict setObject: cursor forKey: name];
|
||||||
|
RELEASE(cursor);
|
||||||
|
}
|
||||||
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -202,8 +230,26 @@ foregroundColorHint:(NSColor *)fg
|
||||||
backgroundColorHint:(NSColor *)bg
|
backgroundColorHint:(NSColor *)bg
|
||||||
hotSpot:(NSPoint)hotSpot
|
hotSpot:(NSPoint)hotSpot
|
||||||
{
|
{
|
||||||
// FIXME: fg and bg should be set
|
NSCursor *cursor = [self initWithImage: newImage hotSpot: hotSpot];
|
||||||
return [self initWithImage: newImage hotSpot: hotSpot];
|
if (fg || bg)
|
||||||
|
{
|
||||||
|
if (bg == nil)
|
||||||
|
bg = [NSColor whiteColor];
|
||||||
|
if (fg == nil)
|
||||||
|
fg = [NSColor blackColor];
|
||||||
|
bg = [bg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
|
||||||
|
fg = [fg colorUsingColorSpaceName: NSDeviceRGBColorSpace];
|
||||||
|
NSLog(@"fg color is %@", fg);
|
||||||
|
DPSsetcursorcolor(GSCurrentContext (),
|
||||||
|
[fg redComponent],
|
||||||
|
[fg greenComponent],
|
||||||
|
[fg blueComponent],
|
||||||
|
[bg redComponent],
|
||||||
|
[bg greenComponent],
|
||||||
|
[bg blueComponent],
|
||||||
|
_cid);
|
||||||
|
}
|
||||||
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue