home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Utilities / FileSpy-1.1-MIHS / MyScrollView.m < prev    next >
Encoding:
Text File  |  1996-04-12  |  2.1 KB  |  82 lines

  1. /*
  2.  *   This sourcecode is part of FileSpy, a logfile observing utility.
  3.  *   Copyright (C) 1996  Felix Rauch
  4.  *
  5.  *   This program is free software; you can redistribute it and/or modify
  6.  *   it under the terms of the GNU General Public License as published by
  7.  *   the Free Software Foundation; either version 2 of the License, or
  8.  *   (at your option) any later version.
  9.  *   
  10.  *   Notice that this program may not be possessed, used, copied,
  11.  *   distributed or modified by people having to do with nuclear
  12.  *   weapons. See the file CONDITIONS for details.
  13.  *
  14.  *   This program is distributed in the hope that it will be useful,
  15.  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  *   GNU General Public License for more details.
  18.  *
  19.  *   You should have received a copy of the GNU General Public License
  20.  *   along with this program; if not, write to the Free Software
  21.  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  *
  23.  *   To contact the original author, try:
  24.  *   e-mail: Felix.Rauch@nice.ch
  25.  *   Traditional mail:    Felix Rauch
  26.  *            Sempacherstrasse 33
  27.  *            8032 Zurich
  28.  *            Switzerland
  29.  */
  30.  
  31. #import "MyScrollView.h"
  32.  
  33. @implementation MyScrollView
  34.  
  35. - setController:sender
  36. {
  37.     controller = sender;
  38.     return self;
  39. }
  40.  
  41. - (NXDragOperation)draggingEntered:sender
  42. {
  43.     if([sender draggingSourceOperationMask] & NX_DragOperationCopy)
  44.     return NX_DragOperationCopy;
  45.     return NX_DragOperationNone;
  46. }
  47.  
  48. - (BOOL)prepareForDragOperation:sender
  49. {
  50.     return YES;
  51. }
  52.  
  53. - (BOOL)performDragOperation:sender
  54. {
  55.     Pasteboard *aPb = [sender draggingPasteboard];
  56.     char *filename;
  57.     int length;
  58.  
  59.     if([aPb readType:NXFilenamePboardType
  60.         data:&filename length:&length]) {
  61.     char *end = filename, tmp;
  62.     while(*end++ != '\000') {
  63.         while((*end != '\t') && (*end != '\000'))
  64.         end++;
  65.         tmp = *end;
  66.         *end = '\000';
  67.         [controller addFileWithName:filename];
  68.         *end = tmp;
  69.         filename = (char *)(end + 1);
  70.     }
  71.     return YES;
  72.     }
  73.     return NO;
  74. }
  75.  
  76. - (BOOL)acceptsFirstMouse
  77. {
  78.     return YES;
  79. }
  80.  
  81. @end
  82.