mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:00:47 +00:00
* move DPSOperators.h to XDPS.
* move GPS headers into a new backend. * define GSContext.h/GSContext.m as abstract super for all drawing destinations (eliminates the need for DPS, GPS, DGS at the root of the AppKit) add appropriate defintion to various classes. * NSMatrix.m add abstract backend code from xraw (eliminate backend). * NSSlider.m add abstract backend code from xraw (eliminate backend). * NSSliderCell.m add abstract backend code from xraw (eliminate backend). * NSSplitView.m add abstract backend code from xraw (eliminate backend). replace private divider highlight method with NSHighlightRect() * NSWindow.m add class method to create backend specific window view. * NSTextField.m add abstract backend code from xraw (eliminate backend). * NSForm.m add abstract backend code from xraw (eliminate backend). * NSFormCell.m add abstract backend code from xraw (eliminate backend). * NSColorWell.m add abstract backend code from xraw (eliminate backend). * NSButton.m add abstract backend code from xraw (eliminate backend). * NSControl.m add abstract backend code from xraw (eliminate backend). * NSBox.m add abstract backend code from xraw (eliminate backend). * NSBrowser.m add abstract backend code from xraw (eliminate backend). * NSBrowserCell.m add abstract backend code from xraw (eliminate backend). git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@3321 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d1456177e3
commit
2d4079f2cf
53 changed files with 2429 additions and 5144 deletions
|
@ -28,6 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <gnustep/gui/config.h>
|
||||
|
||||
#include <AppKit/NSButton.h>
|
||||
#include <AppKit/NSWindow.h>
|
||||
#include <AppKit/NSButtonCell.h>
|
||||
|
@ -48,14 +49,11 @@ id gnustep_gui_nsbutton_class = nil;
|
|||
//
|
||||
+ (void)initialize
|
||||
{
|
||||
if (self == [NSButton class])
|
||||
{
|
||||
// Initial version
|
||||
[self setVersion:1];
|
||||
|
||||
// Set our cell class to NSButtonCell
|
||||
[self setCellClass:[NSButtonCell class]];
|
||||
}
|
||||
if (self == [NSButton class])
|
||||
{
|
||||
[self setVersion:1];
|
||||
[self setCellClass:[NSButtonCell class]];
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -284,81 +282,6 @@ id gnustep_gui_nsbutton_class = nil;
|
|||
//
|
||||
// Handling Events and Action Messages
|
||||
//
|
||||
- (void)mouseDown:(NSEvent *)theEvent
|
||||
{
|
||||
NSApplication *theApp = [NSApplication sharedApplication];
|
||||
BOOL mouseUp, done;
|
||||
NSEvent *e;
|
||||
unsigned int event_mask = NSLeftMouseDownMask | NSLeftMouseUpMask |
|
||||
NSMouseMovedMask | NSLeftMouseDraggedMask | NSRightMouseDraggedMask;
|
||||
int oldActionMask;
|
||||
|
||||
NSDebugLog(@"NSButton mouseDown\n");
|
||||
|
||||
// If we are not enabled then ignore the mouse
|
||||
if (![self isEnabled])
|
||||
return;
|
||||
|
||||
// Have NSCell send action only if we are continuous
|
||||
if ([cell isContinuous])
|
||||
oldActionMask = [cell sendActionOn:0];
|
||||
else
|
||||
oldActionMask = [cell sendActionOn: NSPeriodicMask];
|
||||
|
||||
// capture mouse
|
||||
[[self window] captureMouse: self];
|
||||
|
||||
[self lockFocus];
|
||||
|
||||
done = NO;
|
||||
e = theEvent;
|
||||
while (!done)
|
||||
{
|
||||
[cell highlight: YES withFrame: bounds inView: self]; // highlight cell
|
||||
[self setNeedsDisplayInRect:bounds];
|
||||
mouseUp = [cell trackMouse: e inRect: bounds
|
||||
ofView:self untilMouseUp:YES];
|
||||
e = [theApp currentEvent];
|
||||
|
||||
// If mouse went up then we are done
|
||||
if ((mouseUp) || ([e type] == NSLeftMouseUp))
|
||||
done = YES;
|
||||
else
|
||||
{
|
||||
NSDebugLog(@"NSButton process another event\n");
|
||||
e = [theApp nextEventMatchingMask:event_mask untilDate:nil
|
||||
inMode:NSEventTrackingRunLoopMode dequeue:YES];
|
||||
}
|
||||
}
|
||||
|
||||
// Release mouse
|
||||
[[self window] releaseMouse: self];
|
||||
|
||||
// If the mouse went up in the button
|
||||
if (mouseUp)
|
||||
{
|
||||
// Unhighlight the button
|
||||
[cell highlight: NO withFrame: bounds
|
||||
inView: self];
|
||||
|
||||
[cell setState:![self state]];
|
||||
#if 1
|
||||
[self setNeedsDisplayInRect:bounds];
|
||||
#else
|
||||
[cell drawWithFrame:bounds inView:self];
|
||||
[[self window] flushWindow];
|
||||
#endif
|
||||
}
|
||||
[self unlockFocus];
|
||||
|
||||
/* Restore the old action mask */
|
||||
[cell sendActionOn:oldActionMask];
|
||||
|
||||
// Have the target perform the action
|
||||
if (mouseUp)
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
}
|
||||
|
||||
- (void)performClick:(id)sender
|
||||
{
|
||||
[cell performClick:sender];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue