mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:40:47 +00:00
New backend access methods
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@6489 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b9de76dad5
commit
bb703d65b9
8 changed files with 90 additions and 28 deletions
16
ChangeLog
16
ChangeLog
|
@ -1,3 +1,19 @@
|
||||||
|
2000-04-20 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
|
* Headers/gnustep/gui/GSMethodTable.h: Added methods to get
|
||||||
|
current server device (X display) and current window device (X window).
|
||||||
|
* Headers/gnustep/gui/DPSOperators.h: Likewise
|
||||||
|
* Headers/gnustep/gui/NSGraphicsContext.h: Likewise
|
||||||
|
* Headers/gnustep/gui/PSOperators.h: Likewise
|
||||||
|
* Source/NSGraphicsContext.m: Likewise
|
||||||
|
* Source/NSBrowser.m (-setDelegate:):
|
||||||
|
browser:willDisplayCell:atRow:column: is only requiired for a
|
||||||
|
passive browser delegate.
|
||||||
|
|
||||||
|
* Source/NSFont.m (-fontInfo): New private method.
|
||||||
|
* Source/NSFontManager.m (-traitsOfFont): Use it.
|
||||||
|
(-weightOfFont): Likewise.
|
||||||
|
|
||||||
2000-04-18 Adam Fedor <fedor@gnu.org>
|
2000-04-18 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Hooks for using backend libraries to read images.
|
* Hooks for using backend libraries to read images.
|
||||||
|
|
|
@ -955,6 +955,14 @@ static inline void
|
||||||
DPSsetinputstate(GSCTXT *ctxt, int window, int state)
|
DPSsetinputstate(GSCTXT *ctxt, int window, int state)
|
||||||
__attribute__((unused));
|
__attribute__((unused));
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
DPScurrentserverdevice(GSCTXT *ctxt, void **serverptr)
|
||||||
|
__attribute__((unused));
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
DPScurrentwindowdevice(GSCTXT *ctxt, int win, void **windowptr)
|
||||||
|
__attribute__((unused));
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
/* Color operations */
|
/* Color operations */
|
||||||
/* ----------------------------------------------------------------------- */
|
/* ----------------------------------------------------------------------- */
|
||||||
|
@ -2550,4 +2558,18 @@ DPSsetinputstate(GSCTXT *ctxt, int window, int state)
|
||||||
(ctxt, @selector(DPSsetinputstate::), window, state);
|
(ctxt, @selector(DPSsetinputstate::), window, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
DPScurrentserverdevice(GSCTXT *ctxt, void **serverptr)
|
||||||
|
{
|
||||||
|
(ctxt->methods->DPScurrentserverdevice_)
|
||||||
|
(ctxt, @selector(DPScurrentserverdevice:), serverptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
DPScurrentwindowdevice(GSCTXT *ctxt, int win, void **windowptr)
|
||||||
|
{
|
||||||
|
(ctxt->methods->DPScurrentwindowdevice__)
|
||||||
|
(ctxt, @selector(DPScurrentwindowdevice::), win, windowptr);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -517,6 +517,11 @@ typedef struct {
|
||||||
void (*DPSsetinputstate__)
|
void (*DPSsetinputstate__)
|
||||||
(NSGraphicsContext*, SEL, int, int);
|
(NSGraphicsContext*, SEL, int, int);
|
||||||
|
|
||||||
|
void (*DPScurrentserverdevice_)
|
||||||
|
(NSGraphicsContext*, SEL, void **);
|
||||||
|
void (*DPScurrentwindowdevice__)
|
||||||
|
(NSGraphicsContext*, SEL, int, void **);
|
||||||
|
|
||||||
} gsMethodTable;
|
} gsMethodTable;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -434,6 +434,10 @@ NSGraphicsContext *GSCurrentContext();
|
||||||
- (void) DPSPostEvent: (NSEvent*)anEvent atStart: (BOOL)flag;
|
- (void) DPSPostEvent: (NSEvent*)anEvent atStart: (BOOL)flag;
|
||||||
- (void) DPSmouselocation: (float*)x : (float*)y;
|
- (void) DPSmouselocation: (float*)x : (float*)y;
|
||||||
- (void) DPSsetinputstate: (int)window : (int)state;
|
- (void) DPSsetinputstate: (int)window : (int)state;
|
||||||
|
|
||||||
|
- (void) DPScurrentserverdevice: (void **)serverptr;
|
||||||
|
- (void) DPScurrentwindowdevice: (int)win : (void **)windowptr;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif /* _NSGraphicsContext_h_INCLUDE */
|
#endif /* _NSGraphicsContext_h_INCLUDE */
|
||||||
|
|
|
@ -475,8 +475,10 @@
|
||||||
return aCell;
|
return aCell;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[_browserDelegate browser: self willDisplayCell: aCell
|
if (_passiveDelegate || [_browserDelegate respondsToSelector:
|
||||||
atRow: row column: column];
|
@selector(browser:willDisplayCell:atRow:column:)])
|
||||||
|
[_browserDelegate browser: self willDisplayCell: aCell
|
||||||
|
atRow: row column: column];
|
||||||
[aCell setLoaded: YES];
|
[aCell setLoaded: YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1827,7 +1829,7 @@
|
||||||
// Sets the NSBrowser's delegate to anObject.
|
// Sets the NSBrowser's delegate to anObject.
|
||||||
// Raises NSBrowserIllegalDelegateException if the delegate specified
|
// Raises NSBrowserIllegalDelegateException if the delegate specified
|
||||||
// by anObject doesn't respond to browser:willDisplayCell:atRow:column:
|
// by anObject doesn't respond to browser:willDisplayCell:atRow:column:
|
||||||
// and either of the methods browser:numberOfRowsInColumn:
|
// (if passive) and either of the methods browser:numberOfRowsInColumn:
|
||||||
// or browser:createRowsForColumn:inMatrix:.
|
// or browser:createRowsForColumn:inMatrix:.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -1840,12 +1842,6 @@
|
||||||
fprintf(stderr, "NSBrowser - (void)setDelegate\n");
|
fprintf(stderr, "NSBrowser - (void)setDelegate\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (![anObject respondsToSelector:
|
|
||||||
@selector(browser:willDisplayCell:atRow:column:)])
|
|
||||||
[NSException raise: NSBrowserIllegalDelegateException
|
|
||||||
format: @"Delegate does not respond to %s\n",
|
|
||||||
"browser: willDisplayCell: atRow: column: "];
|
|
||||||
|
|
||||||
if ([anObject respondsToSelector:
|
if ([anObject respondsToSelector:
|
||||||
@selector(browser:numberOfRowsInColumn:)])
|
@selector(browser:numberOfRowsInColumn:)])
|
||||||
{
|
{
|
||||||
|
@ -1866,6 +1862,12 @@
|
||||||
flag = YES;
|
flag = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_passiveDelegate && ![anObject respondsToSelector:
|
||||||
|
@selector(browser:willDisplayCell:atRow:column:)])
|
||||||
|
[NSException raise: NSBrowserIllegalDelegateException
|
||||||
|
format: @"(Passive) Delegate does not respond to %s\n",
|
||||||
|
"browser: willDisplayCell: atRow: column: "];
|
||||||
|
|
||||||
if (!flag)
|
if (!flag)
|
||||||
[NSException raise: NSBrowserIllegalDelegateException
|
[NSException raise: NSBrowserIllegalDelegateException
|
||||||
format: @"Delegate does not respond to %s or %s\n",
|
format: @"Delegate does not respond to %s or %s\n",
|
||||||
|
@ -1878,9 +1880,7 @@
|
||||||
"browser: numberOfRowsInColumn: ",
|
"browser: numberOfRowsInColumn: ",
|
||||||
"browser: createRowsForColumn: inMatrix: "];
|
"browser: createRowsForColumn: inMatrix: "];
|
||||||
|
|
||||||
[anObject retain];
|
ASSIGN(_browserDelegate, anObject);
|
||||||
[_browserDelegate release];
|
|
||||||
_browserDelegate = anObject;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,14 @@ void setNSFont(NSString* key, NSFont* font)
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Private method for NSFontManager
|
||||||
|
//
|
||||||
|
- (GSFontInfo *) fontInfo
|
||||||
|
{
|
||||||
|
return fontInfo;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// NSCopying Protocol
|
// NSCopying Protocol
|
||||||
//
|
//
|
||||||
|
|
|
@ -49,6 +49,10 @@ static NSFontPanel *fontPanel = nil;
|
||||||
static Class fontManagerClass = Nil;
|
static Class fontManagerClass = Nil;
|
||||||
static Class fontPanelClass = Nil;
|
static Class fontPanelClass = Nil;
|
||||||
|
|
||||||
|
@interface NSFont (Private)
|
||||||
|
- (GSFontInfo *) fontInfo;
|
||||||
|
@end
|
||||||
|
|
||||||
@implementation NSFontManager
|
@implementation NSFontManager
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -61,7 +65,7 @@ static Class fontPanelClass = Nil;
|
||||||
NSDebugLog(@"Initialize NSFontManager class\n");
|
NSDebugLog(@"Initialize NSFontManager class\n");
|
||||||
|
|
||||||
// Initial version
|
// Initial version
|
||||||
[self setVersion: 1];
|
[self setVersion: 1];
|
||||||
|
|
||||||
// Set the factories
|
// Set the factories
|
||||||
[self setFontManagerFactory: [NSFontManager class]];
|
[self setFontManagerFactory: [NSFontManager class]];
|
||||||
|
@ -665,25 +669,12 @@ static Class fontPanelClass = Nil;
|
||||||
//
|
//
|
||||||
- (NSFontTraitMask) traitsOfFont: (NSFont*)fontObject
|
- (NSFontTraitMask) traitsOfFont: (NSFont*)fontObject
|
||||||
{
|
{
|
||||||
GSFontInfo *info;
|
return [[fontObject fontInfo] traits];
|
||||||
NSFontTraitMask mask = 0;
|
|
||||||
|
|
||||||
info = [GSFontInfo fontInfoForFontName: [fontObject fontName]
|
|
||||||
matrix: [fontObject matrix]];
|
|
||||||
|
|
||||||
if (info)
|
|
||||||
mask = [info traits];
|
|
||||||
return mask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (int) weightOfFont: (NSFont*)fontObject
|
- (int) weightOfFont: (NSFont*)fontObject
|
||||||
{
|
{
|
||||||
GSFontInfo *info;
|
return [[fontObject fontInfo] weight];
|
||||||
|
|
||||||
info = [GSFontInfo fontInfoForFontName: [fontObject fontName]
|
|
||||||
matrix: [fontObject matrix]];
|
|
||||||
|
|
||||||
return [info weight];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) fontNamed: (NSString*)typeface
|
- (BOOL) fontNamed: (NSString*)typeface
|
||||||
|
|
|
@ -829,6 +829,11 @@ NSGraphicsContext *GSCurrentContext()
|
||||||
methodTable.DPSsetinputstate__ =
|
methodTable.DPSsetinputstate__ =
|
||||||
GET_IMP(@selector(DPSsetinputstate::));
|
GET_IMP(@selector(DPSsetinputstate::));
|
||||||
|
|
||||||
|
methodTable.DPScurrentserverdevice_ =
|
||||||
|
GET_IMP(@selector(DPScurrentserverdevice:));
|
||||||
|
methodTable.DPScurrentwindowdevice__ =
|
||||||
|
GET_IMP(@selector(DPScurrentwindowdevice::));
|
||||||
|
|
||||||
mptr = NSZoneMalloc(_globalGSZone, sizeof(gsMethodTable));
|
mptr = NSZoneMalloc(_globalGSZone, sizeof(gsMethodTable));
|
||||||
memcpy(mptr, &methodTable, sizeof(gsMethodTable));
|
memcpy(mptr, &methodTable, sizeof(gsMethodTable));
|
||||||
return mptr;
|
return mptr;
|
||||||
|
@ -2283,4 +2288,15 @@ NSGraphicsContext *GSCurrentContext()
|
||||||
{
|
{
|
||||||
[self subclassResponsibility: _cmd];
|
[self subclassResponsibility: _cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) DPScurrentserverdevice: (void **)serverptr
|
||||||
|
{
|
||||||
|
[self subclassResponsibility: _cmd];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) DPScurrentwindowdevice: (int)win : (void **)windowptr
|
||||||
|
{
|
||||||
|
[self subclassResponsibility: _cmd];
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue