mirror of
https://github.com/gnustep/apps-gorm.git
synced 2025-04-22 14:10:44 +00:00
implement draggingExited: to autoscroll during the IBAction connection if needed
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@26544 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
b908ca07b1
commit
b68527e3ec
1 changed files with 39 additions and 0 deletions
|
@ -30,6 +30,8 @@
|
|||
#include "GormFunctions.h"
|
||||
#include "GormDocument.h"
|
||||
#include "GormClassManager.h"
|
||||
|
||||
#include <AppKit/NSClipView.h>
|
||||
/*
|
||||
* Method to return the image that should be used to display objects within
|
||||
* the matrix containing the objects in a document.
|
||||
|
@ -277,6 +279,43 @@ static NSMapTable *docMap = 0;
|
|||
return NSDragOperationNone;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used for autoscrolling when you connect IBActions.
|
||||
* FIXME: Maybye there is a better way to do it.
|
||||
*/
|
||||
- (void)draggingExited:(id < NSDraggingInfo >)sender
|
||||
{
|
||||
if (dragType == GormLinkPboardType)
|
||||
{
|
||||
NSRect documentVisibleRect;
|
||||
NSRect documentRect;
|
||||
NSPoint loc = [sender draggingLocation];
|
||||
|
||||
loc = [self convertPoint:loc fromView:nil];
|
||||
documentVisibleRect = [(NSClipView *)[self superview] documentVisibleRect];
|
||||
documentRect = [(NSClipView *)[self superview] documentRect];
|
||||
|
||||
/* Down */
|
||||
if ( (loc.y >= documentVisibleRect.size.height)
|
||||
&& ( ! NSEqualRects(documentVisibleRect,documentRect) ) )
|
||||
{
|
||||
loc.x = 0;
|
||||
loc.y = documentRect.origin.y + [self cellSize].height;
|
||||
[(NSClipView*) [self superview] scrollToPoint:loc];
|
||||
}
|
||||
/* up */
|
||||
else if ( (loc.y + 10 >= documentVisibleRect.origin.y )
|
||||
&& ( ! NSEqualRects(documentVisibleRect,documentRect) ) )
|
||||
{
|
||||
loc.x = 0;
|
||||
loc.y = documentRect.origin.y - [self cellSize].height;
|
||||
[(NSClipView*) [self superview] scrollToPoint:loc];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (unsigned int) draggingSourceOperationMaskForLocal: (BOOL)flag
|
||||
{
|
||||
return NSDragOperationLink;
|
||||
|
|
Loading…
Reference in a new issue