mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 12:00:52 +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
a2f13a8686
commit
0730df1fc4
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>
|
||||
|
||||
* 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;
|
||||
@end /* NSSavePanel (PrivateMethods) */
|
||||
|
||||
@interface PanelView : NSView
|
||||
{
|
||||
NSSavePanel *owner;
|
||||
}
|
||||
- (id) initWithFrame: (NSRect)r owner: (NSSavePanel*)p;
|
||||
- (BOOL) performDragOperation: (id<NSDraggingInfo>)sender;
|
||||
- (BOOL) prepareForDragOperation: (id<NSDraggingInfo>)sender;
|
||||
@end
|
||||
|
||||
@implementation PanelView
|
||||
@implementation NSSavePanel (_PrivateMethods)
|
||||
|
||||
- (unsigned int) draggingEntered: (id <NSDraggingInfo>)sender
|
||||
{
|
||||
|
@ -115,17 +106,6 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
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
|
||||
{
|
||||
NSArray *types;
|
||||
|
@ -138,7 +118,7 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
NSArray *names = [dragPb propertyListForType: NSFilenamesPboardType];
|
||||
NSString *file = [names lastObject];
|
||||
|
||||
[owner setDirectory: file];
|
||||
[self setDirectory: file];
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
|
@ -148,9 +128,7 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
{
|
||||
return YES;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSSavePanel (_PrivateMethods)
|
||||
|
||||
-(id) _initWithoutGModel
|
||||
{
|
||||
NSBox *bar;
|
||||
|
@ -158,7 +136,6 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
NSImage *image;
|
||||
NSRect r;
|
||||
id lastKeyView;
|
||||
id panelView;
|
||||
|
||||
// Track window resizing so we can change number of browser columns.
|
||||
[[NSNotificationCenter defaultCenter] addObserver: self
|
||||
|
@ -177,13 +154,10 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
[self setMinSize: [self frame].size];
|
||||
|
||||
r = NSMakeRect (0, 0, 308, 317);
|
||||
panelView = [[PanelView alloc] initWithFrame: r owner: self];
|
||||
[self setContentView: panelView];
|
||||
RELEASE(panelView);
|
||||
[[self contentView] setBounds: r];
|
||||
|
||||
r = NSMakeRect (0, 64, 308, 245);
|
||||
_topView = [[PanelView alloc] initWithFrame: r owner: self];
|
||||
_topView = [[NSView alloc] initWithFrame: r];
|
||||
[_topView setBounds: r];
|
||||
[_topView setAutoresizingMask: NSViewWidthSizable|NSViewHeightSizable];
|
||||
[_topView setAutoresizesSubviews: YES];
|
||||
|
@ -191,7 +165,7 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
[_topView release];
|
||||
|
||||
r = NSMakeRect (0, 0, 308, 64);
|
||||
_bottomView = [[PanelView alloc] initWithFrame: r owner: self];
|
||||
_bottomView = [[NSView alloc] initWithFrame: r];
|
||||
[_bottomView setBounds: r];
|
||||
[_bottomView setAutoresizingMask: NSViewWidthSizable|NSViewMaxYMargin];
|
||||
[_bottomView setAutoresizesSubviews: YES];
|
||||
|
@ -352,6 +326,9 @@ static BOOL _gs_display_reading_progress = NO;
|
|||
[self setInitialFirstResponder: _form];
|
||||
[super setTitle: @""];
|
||||
|
||||
[self registerForDraggedTypes: [NSArray arrayWithObjects:
|
||||
NSFilenamesPboardType, nil]];
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
|
|
@ -3131,15 +3131,19 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
#define GSPerformDragSelector(view, sel, info, action) \
|
||||
if ([view window] == self) \
|
||||
{ \
|
||||
id target; \
|
||||
id target = view; \
|
||||
\
|
||||
if (view == _contentView && _delegate != nil) \
|
||||
if (target == _wv) \
|
||||
{ \
|
||||
target = _delegate; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
target= view; \
|
||||
if (_delegate != nil \
|
||||
&& [_delegate respondsToSelector: sel] == YES) \
|
||||
{ \
|
||||
target = _delegate; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
target = self; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if ([target respondsToSelector: sel]) \
|
||||
|
@ -3152,15 +3156,19 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
#define GSPerformVoidDragSelector(view, sel, info) \
|
||||
if ([view window] == self) \
|
||||
{ \
|
||||
id target; \
|
||||
id target = view; \
|
||||
\
|
||||
if (view == _contentView && _delegate) \
|
||||
if (target == _wv) \
|
||||
{ \
|
||||
target = _delegate; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
target= view; \
|
||||
if (_delegate != nil \
|
||||
&& [_delegate respondsToSelector: sel] == YES) \
|
||||
{ \
|
||||
target = _delegate; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
target = self; \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if ([target respondsToSelector: sel]) \
|
||||
|
@ -3175,9 +3183,14 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
BOOL isEntry;
|
||||
|
||||
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)
|
||||
{
|
||||
v = _contentView;
|
||||
v = _wv;
|
||||
}
|
||||
dragInfo = [GSServerForWindow(self) dragInfo];
|
||||
if (_lastDragView == v)
|
||||
|
@ -3195,7 +3208,7 @@ Code shared with [NSPanel -sendEvent:], remember to update both places.
|
|||
}
|
||||
ASSIGN(_lastDragView, v);
|
||||
_f.accepts_drag = GSViewAcceptsDrag(v, dragInfo);
|
||||
action = NSDragOperationNone;
|
||||
action = NSDragOperationNone;
|
||||
}
|
||||
if (_f.accepts_drag)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue