mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-05 10:50:55 +00:00
Add peek event methods to NSApplication.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@2260 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
fe5dc912f5
commit
a72c207c16
4 changed files with 84 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Thu Mar 27 09:43:02 1997 GNUstep Development <gnustep@net-community.com>
|
||||||
|
|
||||||
|
* Headers/gnustep/gui/NSApplication.h (-peekNextEvent): New method.
|
||||||
|
(-peekEventMatchingMask:untilDate:inMode:dequeue:): New method.
|
||||||
|
* Source/NSApplication.m (-peekNextEvent): New method.
|
||||||
|
(-peekEventMatchingMask:untilDate:inMode:dequeue:): New method.
|
||||||
|
* Source/NSControl.m (-setAlignment:): Display if needed.
|
||||||
|
|
||||||
Thu Mar 20 10:40:51 1997 GNUstep Development <gnustep@net-community.com>
|
Thu Mar 20 10:40:51 1997 GNUstep Development <gnustep@net-community.com>
|
||||||
|
|
||||||
* Source/NSControl.m: Call displayIfNeeded after setting the
|
* Source/NSControl.m: Call displayIfNeeded after setting the
|
||||||
|
|
|
@ -132,6 +132,12 @@ extern NSString *NSEventTrackingRunLoopMode;
|
||||||
dequeue:(BOOL)flag;
|
dequeue:(BOOL)flag;
|
||||||
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag;
|
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag;
|
||||||
|
|
||||||
|
// xxx Not part of OpenStep, should be removed someday
|
||||||
|
- (NSEvent *)peekEventMatchingMask:(unsigned int)mask
|
||||||
|
untilDate:(NSDate *)expiration
|
||||||
|
inMode:(NSString *)mode
|
||||||
|
dequeue:(BOOL)flag;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Sending action messages
|
// Sending action messages
|
||||||
//
|
//
|
||||||
|
@ -266,6 +272,7 @@ extern NSString *NSEventTrackingRunLoopMode;
|
||||||
|
|
||||||
// Get next event
|
// Get next event
|
||||||
- (NSEvent *)getNextEvent;
|
- (NSEvent *)getNextEvent;
|
||||||
|
- (NSEvent *)peekNextEvent;
|
||||||
|
|
||||||
// handle a non-translated event
|
// handle a non-translated event
|
||||||
- (void)handleNullEvent;
|
- (void)handleNullEvent;
|
||||||
|
|
|
@ -496,6 +496,65 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
|
||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSEvent *)peekEventMatchingMask:(unsigned int)mask
|
||||||
|
untilDate:(NSDate *)expiration
|
||||||
|
inMode:(NSString *)mode
|
||||||
|
dequeue:(BOOL)flag
|
||||||
|
{
|
||||||
|
NSEvent *e;
|
||||||
|
BOOL done;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
|
// If the queue isn't empty then check those messages
|
||||||
|
if ([event_queue count])
|
||||||
|
{
|
||||||
|
j = [event_queue count];
|
||||||
|
for (i = j-1;i >= 0; --i)
|
||||||
|
{
|
||||||
|
e = [event_queue objectAtIndex: i];
|
||||||
|
if ([self event: e matchMask: mask])
|
||||||
|
{
|
||||||
|
[event_queue removeObjectAtIndex: i];
|
||||||
|
[self setCurrentEvent: e];
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not in queue so peek for event
|
||||||
|
e = [self peekNextEvent];
|
||||||
|
|
||||||
|
// Check mask
|
||||||
|
if ([self event: e matchMask: mask])
|
||||||
|
{
|
||||||
|
if (e)
|
||||||
|
{
|
||||||
|
[event_queue removeObject: e];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
// Unhide the cursor if necessary
|
||||||
|
{
|
||||||
|
NSEventType type;
|
||||||
|
|
||||||
|
// Only if we should unhide when mouse moves
|
||||||
|
if ([NSCursor isHiddenUntilMouseMoves])
|
||||||
|
{
|
||||||
|
// Make sure the event is a mouse event before unhiding
|
||||||
|
type = [e type];
|
||||||
|
if ((type == NSLeftMouseDown) || (type == NSLeftMouseUp)
|
||||||
|
|| (type == NSRightMouseDown) || (type == NSRightMouseUp)
|
||||||
|
|| (type == NSMouseMoved))
|
||||||
|
[NSCursor unhide];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[self setCurrentEvent: e];
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
- (void)postEvent:(NSEvent *)event atStart:(BOOL)flag
|
||||||
{
|
{
|
||||||
if (flag)
|
if (flag)
|
||||||
|
@ -1059,6 +1118,11 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
|
||||||
return NullEvent;
|
return NullEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSEvent *)peekNextEvent
|
||||||
|
{
|
||||||
|
return NullEvent;
|
||||||
|
}
|
||||||
|
|
||||||
// handle a non-translated event
|
// handle a non-translated event
|
||||||
- (void)handleNullEvent
|
- (void)handleNullEvent
|
||||||
{}
|
{}
|
||||||
|
|
|
@ -260,7 +260,11 @@ NSString *NSControlTextDidChangeNotification = @"NSControlTextDidChangeNotificat
|
||||||
|
|
||||||
- (void)setAlignment:(NSTextAlignment)mode
|
- (void)setAlignment:(NSTextAlignment)mode
|
||||||
{
|
{
|
||||||
if (cell) [cell setAlignment:mode];
|
if (cell)
|
||||||
|
{
|
||||||
|
[cell setAlignment:mode];
|
||||||
|
[self displayIfNeeded];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setFont:(NSFont *)fontObject
|
- (void)setFont:(NSFont *)fontObject
|
||||||
|
|
Loading…
Reference in a new issue