mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 10:21:00 +00:00
DnD fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17994 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
914ac48552
commit
060c18ec01
3 changed files with 45 additions and 47 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2003-10-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSSavePanel.m: Change to have entire window accept DnD.
|
||||||
|
* Source/NSWindow.m: Fix to get whole window DnD working, also
|
||||||
|
to enable propogation of drag events up the view hierarchy to the
|
||||||
|
first drag-aware view ... not sure that this is correct but it
|
||||||
|
seems sensible.
|
||||||
|
|
||||||
2003-10-27 Richard Frith-Macdonald <rfm@gnu.org>
|
2003-10-27 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSOpenPanel.m: Allow users to type in an absolute path name.
|
* Source/NSOpenPanel.m: Allow users to type in an absolute path name.
|
||||||
|
|
|
@ -92,16 +92,7 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
- (NSComparisonResult) _compareFilename: (NSString *)n1 with: (NSString *)n2;
|
- (NSComparisonResult) _compareFilename: (NSString *)n1 with: (NSString *)n2;
|
||||||
@end /* NSSavePanel (PrivateMethods) */
|
@end /* NSSavePanel (PrivateMethods) */
|
||||||
|
|
||||||
@interface PanelView : NSView
|
@implementation NSSavePanel (_PrivateMethods)
|
||||||
{
|
|
||||||
NSSavePanel *owner;
|
|
||||||
}
|
|
||||||
- (id) initWithFrame: (NSRect)r owner: (NSSavePanel*)p;
|
|
||||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender;
|
|
||||||
- (BOOL) prepareForDragOperation: (id<NSDraggingInfo>)sender;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation PanelView
|
|
||||||
|
|
||||||
- (unsigned int) draggingEntered: (id <NSDraggingInfo>)sender
|
- (unsigned int) draggingEntered: (id <NSDraggingInfo>)sender
|
||||||
{
|
{
|
||||||
|
@ -115,17 +106,6 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
return NSDragOperationAll;
|
return NSDragOperationAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id) initWithFrame: (NSRect)r owner: (NSSavePanel*)p
|
|
||||||
{
|
|
||||||
if ((self = [super initWithFrame: r]) != nil)
|
|
||||||
{
|
|
||||||
owner = p;
|
|
||||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
|
||||||
NSFilenamesPboardType, nil]];
|
|
||||||
}
|
|
||||||
return self;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender
|
||||||
{
|
{
|
||||||
NSArray *types;
|
NSArray *types;
|
||||||
|
@ -138,7 +118,7 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
NSArray *names = [dragPb propertyListForType: NSFilenamesPboardType];
|
NSArray *names = [dragPb propertyListForType: NSFilenamesPboardType];
|
||||||
NSString *file = [names lastObject];
|
NSString *file = [names lastObject];
|
||||||
|
|
||||||
[owner setDirectory: file];
|
[self setDirectory: file];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -148,9 +128,7 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
{
|
{
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation NSSavePanel (_PrivateMethods)
|
|
||||||
-(id) _initWithoutGModel
|
-(id) _initWithoutGModel
|
||||||
{
|
{
|
||||||
NSBox *bar;
|
NSBox *bar;
|
||||||
|
@ -158,7 +136,6 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
NSImage *image;
|
NSImage *image;
|
||||||
NSRect r;
|
NSRect r;
|
||||||
id lastKeyView;
|
id lastKeyView;
|
||||||
id panelView;
|
|
||||||
|
|
||||||
// Track window resizing so we can change number of browser columns.
|
// Track window resizing so we can change number of browser columns.
|
||||||
[[NSNotificationCenter defaultCenter] addObserver: self
|
[[NSNotificationCenter defaultCenter] addObserver: self
|
||||||
|
@ -177,13 +154,10 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
[self setMinSize: [self frame].size];
|
[self setMinSize: [self frame].size];
|
||||||
|
|
||||||
r = NSMakeRect (0, 0, 308, 317);
|
r = NSMakeRect (0, 0, 308, 317);
|
||||||
panelView = [[PanelView alloc] initWithFrame: r owner: self];
|
|
||||||
[self setContentView: panelView];
|
|
||||||
RELEASE(panelView);
|
|
||||||
[[self contentView] setBounds: r];
|
[[self contentView] setBounds: r];
|
||||||
|
|
||||||
r = NSMakeRect (0, 64, 308, 245);
|
r = NSMakeRect (0, 64, 308, 245);
|
||||||
_topView = [[PanelView alloc] initWithFrame: r owner: self];
|
_topView = [[NSView alloc] initWithFrame: r];
|
||||||
[_topView setBounds: r];
|
[_topView setBounds: r];
|
||||||
[_topView setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
[_topView setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
||||||
[_topView setAutoresizesSubviews: YES];
|
[_topView setAutoresizesSubviews: YES];
|
||||||
|
@ -191,7 +165,7 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
[_topView release];
|
[_topView release];
|
||||||
|
|
||||||
r = NSMakeRect (0, 0, 308, 64);
|
r = NSMakeRect (0, 0, 308, 64);
|
||||||
_bottomView = [[PanelView alloc] initWithFrame: r owner: self];
|
_bottomView = [[NSView alloc] initWithFrame: r];
|
||||||
[_bottomView setBounds: r];
|
[_bottomView setBounds: r];
|
||||||
[_bottomView setAutoresizingMask: NSViewWidthSizable|NSViewMaxYMargin];
|
[_bottomView setAutoresizingMask: NSViewWidthSizable|NSViewMaxYMargin];
|
||||||
[_bottomView setAutoresizesSubviews: YES];
|
[_bottomView setAutoresizesSubviews: YES];
|
||||||
|
@ -352,6 +326,9 @@ static BOOL _gs_display_reading_progress = NO;
|
||||||
[self setInitialFirstResponder: _form];
|
[self setInitialFirstResponder: _form];
|
||||||
[super setTitle: @""];
|
[super setTitle: @""];
|
||||||
|
|
||||||
|
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||||
|
NSFilenamesPboardType, nil]];
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3131,15 +3131,19 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
||||||
#define GSPerformDragSelector(view, sel, info, action) \
|
#define GSPerformDragSelector(view, sel, info, action) \
|
||||||
if ([view window] == self) \
|
if ([view window] == self) \
|
||||||
{ \
|
{ \
|
||||||
id target; \
|
id target = view; \
|
||||||
\
|
\
|
||||||
if (view == _contentView && _delegate != nil) \
|
if (target == _wv) \
|
||||||
{ \
|
{ \
|
||||||
target = _delegate; \
|
if (_delegate != nil \
|
||||||
} \
|
&& [_delegate respondsToSelector: sel] == YES) \
|
||||||
else \
|
{ \
|
||||||
{ \
|
target = _delegate; \
|
||||||
target= view; \
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
target = self; \
|
||||||
|
} \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if ([target respondsToSelector: sel]) \
|
if ([target respondsToSelector: sel]) \
|
||||||
|
@ -3152,15 +3156,19 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
||||||
#define GSPerformVoidDragSelector(view, sel, info) \
|
#define GSPerformVoidDragSelector(view, sel, info) \
|
||||||
if ([view window] == self) \
|
if ([view window] == self) \
|
||||||
{ \
|
{ \
|
||||||
id target; \
|
id target = view; \
|
||||||
\
|
\
|
||||||
if (view == _contentView && _delegate) \
|
if (target == _wv) \
|
||||||
{ \
|
{ \
|
||||||
target = _delegate; \
|
if (_delegate != nil \
|
||||||
} \
|
&& [_delegate respondsToSelector: sel] == YES) \
|
||||||
else \
|
{ \
|
||||||
{ \
|
target = _delegate; \
|
||||||
target= view; \
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
target = self; \
|
||||||
|
} \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
if ([target respondsToSelector: sel]) \
|
if ([target respondsToSelector: sel]) \
|
||||||
|
@ -3175,9 +3183,14 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
||||||
BOOL isEntry;
|
BOOL isEntry;
|
||||||
|
|
||||||
v = [_contentView hitTest: [theEvent locationInWindow]];
|
v = [_contentView hitTest: [theEvent locationInWindow]];
|
||||||
|
// FIXME ... check whether drag shoulkd propogate up hierarchy
|
||||||
|
while (v != nil && ((NSViewPtr)v)->_rFlags.has_draginfo == 0)
|
||||||
|
{
|
||||||
|
v = [v superview];
|
||||||
|
}
|
||||||
if (v == nil)
|
if (v == nil)
|
||||||
{
|
{
|
||||||
v = _contentView;
|
v = _wv;
|
||||||
}
|
}
|
||||||
dragInfo = [GSServerForWindow(self) dragInfo];
|
dragInfo = [GSServerForWindow(self) dragInfo];
|
||||||
if (_lastDragView == v)
|
if (_lastDragView == v)
|
||||||
|
@ -3195,7 +3208,7 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
||||||
}
|
}
|
||||||
ASSIGN(_lastDragView, v);
|
ASSIGN(_lastDragView, v);
|
||||||
_f.accepts_drag = GSViewAcceptsDrag(v, dragInfo);
|
_f.accepts_drag = GSViewAcceptsDrag(v, dragInfo);
|
||||||
action = NSDragOperationNone;
|
action = NSDragOperationNone;
|
||||||
}
|
}
|
||||||
if (_f.accepts_drag)
|
if (_f.accepts_drag)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue