Develop and Download Open Source Software

Browse CVS Repository

Contents of /lupin/lupin/LupinBrowser/LPOutlineView.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download)
Fri Apr 22 05:29:45 2005 UTC (18 years, 11 months ago) by letter
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +0 -102 lines
20050422

1 /*
2 * Copyright (c) 2004-2005 The Lupin Project. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without modification, are permitted
5 * provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions
8 * and the following disclaimer.
9 *
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of
11 * conditions and the following disclaimer in the documentation and/or other materials provided
12 * with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE LUPIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
15 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LUPIN PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
17 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
18 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
20 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
21 * POSSIBILITY OF SUCH DAMAGE.
22 */
23
24 #import "LPOutlineView.h"
25
26 @implementation LPOutlineView
27
28 - (void)dragImage:(NSImage *)anImage at:(NSPoint)viewLocation offset:(NSSize)initialOffset event:(NSEvent *)event pasteboard:(NSPasteboard *)pboard source:(id)sourceObj slideBack:(BOOL)slideFlag
29 {
30 float x,y;
31 x = y = 0;
32 NSImage* dragImage = [self dragImageForSelectedRows:event x:&x y:&y];
33 NSPoint point = NSMakePoint(x+20,y); //NSBrowserCell���������������������
34 NSSize size = NSMakeSize(0,0);
35 [super dragImage:dragImage at:point offset:size event:event pasteboard:pboard source:sourceObj slideBack:slideFlag];
36 }
37
38 - (NSImage*)dragImageForSelectedRows:(NSEvent*)event x:(float*)x y:(float*)y
39 {
40 int numOfRows = [self numberOfRows];
41 int maxIndexOfSelected = 0;
42 int i;
43 NSMutableArray* selectedRows = [NSMutableArray array];
44 for (i=0;i<numOfRows;i++) {
45 if ([self isRowSelected:i]) {
46 [selectedRows addObject:[NSNumber numberWithInt:i]];
47 maxIndexOfSelected = i;
48 }
49 }
50 NSPoint point = NSMakePoint(0,0); //������������������������������������������������
51 *x = 1;
52 *y = (maxIndexOfSelected+1)*([self rowHeight]+[self intercellSpacing].height);
53 NSPointPointer pointer = &point;
54 return [super dragImageForRows:selectedRows event:event dragImageOffset:pointer];
55 }
56 @end

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26