1 |
/* BIcon.h |
2 |
* |
3 |
* Copyright (C) 2003 Free Software Foundation, Inc. |
4 |
* |
5 |
* Author: Enrico Sersale <enrico@imago.ro> |
6 |
* Date: August 2001 |
7 |
* |
8 |
* This file is part of the GNUstep GWorkspace application |
9 |
* |
10 |
* This program is free software; you can redistribute it and/or modify |
11 |
* it under the terms of the GNU General Public License as published by |
12 |
* the Free Software Foundation; either version 2 of the License, or |
13 |
* (at your option) any later version. |
14 |
* |
15 |
* This program is distributed in the hope that it will be useful, |
16 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 |
* GNU General Public License for more details. |
19 |
* |
20 |
* You should have received a copy of the GNU General Public License |
21 |
* along with this program; if not, write to the Free Software |
22 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 |
*/ |
24 |
|
25 |
|
26 |
#ifndef BICON_H |
27 |
#define BICON_H |
28 |
|
29 |
#include <AppKit/NSView.h> |
30 |
|
31 |
#define ICONPOSITION(s1, s2) (NSMakePoint(((int)(s1).width - (int)(s2).width) >> 1, \ |
32 |
((int)(s1).height - (int)(s2).height) >> 1)) |
33 |
|
34 |
#define ONICON(p, s1, s2) ([self mouse: (p) \ |
35 |
inRect: NSMakeRect(((int)(s1).width - (int)(s2).width) >> 1,\ |
36 |
((int)(s1).height - (int)(s2).height) >> 1, 48, 48)]) |
37 |
|
38 |
@class NSString; |
39 |
@class NSArray; |
40 |
@class NSFileManager; |
41 |
@class NSEvent; |
42 |
@class NSPasteboard; |
43 |
@class NSImage; |
44 |
@class NSTextField; |
45 |
@class BIconLabel; |
46 |
|
47 |
@interface BIcon : NSView |
48 |
{ |
49 |
NSArray *paths; |
50 |
NSString *fullpath; |
51 |
NSString *name; |
52 |
NSString *hostname; |
53 |
|
54 |
BOOL isRootIcon; |
55 |
BOOL singlepath; |
56 |
NSString *type; |
57 |
BOOL isPakage; |
58 |
BOOL isbranch; |
59 |
BOOL dimmed; |
60 |
BOOL locked; |
61 |
|
62 |
NSImage *icon, *highlight, *arrow; |
63 |
BIconLabel *namelabel; |
64 |
|
65 |
id delegate; |
66 |
id gworkspace; |
67 |
|
68 |
BOOL isSelect; |
69 |
BOOL contestualMenu; |
70 |
|
71 |
int dragdelay; |
72 |
BOOL isDragTarget; |
73 |
BOOL onSelf; |
74 |
|
75 |
NSFileManager *fm; |
76 |
} |
77 |
|
78 |
- (void)setDelegate:(id)aDelegate; |
79 |
|
80 |
- (id)delegate; |
81 |
|
82 |
- (void)setPaths:(NSArray *)p; |
83 |
|
84 |
- (void)select; |
85 |
|
86 |
- (void)unselect; |
87 |
|
88 |
- (void)renewIcon; |
89 |
|
90 |
- (void)openWithApp:(id)sender; |
91 |
|
92 |
- (void)openWith:(id)sender; |
93 |
|
94 |
- (NSTextField *)label; |
95 |
|
96 |
- (void)clickOnLabel; |
97 |
|
98 |
- (NSString *)type; |
99 |
|
100 |
- (BOOL)isSinglePath; |
101 |
|
102 |
- (BOOL)isSelect; |
103 |
|
104 |
- (void)setBranch:(BOOL)value; |
105 |
|
106 |
- (BOOL)isBranch; |
107 |
|
108 |
- (void)setDimmed:(BOOL)value; |
109 |
|
110 |
- (BOOL)isDimmed; |
111 |
|
112 |
- (void)setLocked:(BOOL)value; |
113 |
|
114 |
- (BOOL)isLocked; |
115 |
|
116 |
- (BOOL)isRootIcon; |
117 |
|
118 |
- (NSArray *)paths; |
119 |
|
120 |
- (NSString *)name; |
121 |
|
122 |
- (NSString *)hostname; |
123 |
|
124 |
- (NSImage *)icon; |
125 |
|
126 |
- (NSSize)iconShift; |
127 |
|
128 |
@end |
129 |
|
130 |
|
131 |
@interface BIcon (DraggingSource) |
132 |
|
133 |
- (void)startExternalDragOnEvent:(NSEvent *)event; |
134 |
|
135 |
- (void)declareAndSetShapeOnPasteboard:(NSPasteboard *)pb; |
136 |
|
137 |
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)flag; |
138 |
|
139 |
- (void)draggedImage:(NSImage *)anImage |
140 |
endedAt:(NSPoint)aPoint |
141 |
deposited:(BOOL)flag; |
142 |
|
143 |
@end |
144 |
|
145 |
|
146 |
@interface BIcon (DraggingDestination) |
147 |
|
148 |
- (unsigned int)draggingEntered:(id <NSDraggingInfo>)sender; |
149 |
|
150 |
- (unsigned int)draggingUpdated:(id <NSDraggingInfo>)sender; |
151 |
|
152 |
- (void)draggingExited:(id <NSDraggingInfo>)sender; |
153 |
|
154 |
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; |
155 |
|
156 |
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender; |
157 |
|
158 |
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender; |
159 |
|
160 |
@end |
161 |
|
162 |
|
163 |
// |
164 |
// Methods Implemented by the Delegate |
165 |
// |
166 |
|
167 |
@interface NSObject (BIconDelegateMethods) |
168 |
|
169 |
- (void)icon:(BIcon *)sender setFrameOfLabel:(NSTextField *)label; |
170 |
|
171 |
- (void)unselectOtherIcons:(BIcon *)selicon; |
172 |
|
173 |
- (void)unselectNameEditor; |
174 |
|
175 |
- (void)restoreSelectionAfterDndOfIcon:(BIcon *)dndicon; |
176 |
|
177 |
- (void)clickOnIcon:(BIcon *)clicked; |
178 |
|
179 |
- (void)doubleClickOnIcon:(BIcon *)clicked newViewer:(BOOL)isnew; |
180 |
|
181 |
@end |
182 |
|
183 |
#endif // BICON_H |