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:
Scott Christley 1997-03-27 17:47:03 +00:00
parent b44d89e34a
commit a05e35e336
4 changed files with 84 additions and 1 deletions

View file

@ -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>
* Source/NSControl.m: Call displayIfNeeded after setting the

View file

@ -132,6 +132,12 @@ extern NSString *NSEventTrackingRunLoopMode;
dequeue:(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
//
@ -266,6 +272,7 @@ extern NSString *NSEventTrackingRunLoopMode;
// Get next event
- (NSEvent *)getNextEvent;
- (NSEvent *)peekNextEvent;
// handle a non-translated event
- (void)handleNullEvent;

View file

@ -496,6 +496,65 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
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
{
if (flag)
@ -1059,6 +1118,11 @@ NSString *NSApplicationWillUpdateNotification = @"ApplicationWillUpdate";
return NullEvent;
}
- (NSEvent *)peekNextEvent
{
return NullEvent;
}
// handle a non-translated event
- (void)handleNullEvent
{}

View file

@ -260,7 +260,11 @@ NSString *NSControlTextDidChangeNotification = @"NSControlTextDidChangeNotificat
- (void)setAlignment:(NSTextAlignment)mode
{
if (cell) [cell setAlignment:mode];
if (cell)
{
[cell setAlignment:mode];
[self displayIfNeeded];
}
}
- (void)setFont:(NSFont *)fontObject