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 |
NSString *remoteHostName; |
55 |
BOOL isRemote; |
56 |
|
57 |
BOOL isRootIcon; |
58 |
BOOL singlepath; |
59 |
NSString *type; |
60 |
BOOL isPakage; |
61 |
BOOL isbranch; |
62 |
BOOL dimmed; |
63 |
BOOL locked; |
64 |
|
65 |
NSImage *icon, *highlight, *arrow; |
66 |
BIconLabel *namelabel; |
67 |
|
68 |
id delegate; |
69 |
id gworkspace; |
70 |
|
71 |
BOOL isSelect; |
72 |
BOOL contestualMenu; |
73 |
|
74 |
int dragdelay; |
75 |
BOOL isDragTarget; |
76 |
BOOL onSelf; |
77 |
|
78 |
NSFileManager *fm; |
79 |
} |
80 |
|
81 |
- (id)initForRemoteHost:(NSString *)rhost; |
82 |
|
83 |
- (void)setDelegate:(id)aDelegate; |
84 |
|
85 |
- (id)delegate; |
86 |
|
87 |
- (void)setPaths:(NSArray *)p; |
88 |
|
89 |
- (void)select; |
90 |
|
91 |
- (void)unselect; |
92 |
|
93 |
- (void)renewIcon; |
94 |
|
95 |
- (void)openWithApp:(id)sender; |
96 |
|
97 |
- (void)openWith:(id)sender; |
98 |
|
99 |
- (NSTextField *)label; |
100 |
|
101 |
- (void)clickOnLabel; |
102 |
|
103 |
- (NSString *)type; |
104 |
|
105 |
- (BOOL)isSinglePath; |
106 |
|
107 |
- (BOOL)isSelect; |
108 |
|
109 |
- (void)setBranch:(BOOL)value; |
110 |
|
111 |
- (BOOL)isBranch; |
112 |
|
113 |
- (void)setDimmed:(BOOL)value; |
114 |
|
115 |
- (BOOL)isDimmed; |
116 |
|
117 |
- (void)setLocked:(BOOL)value; |
118 |
|
119 |
- (BOOL)isLocked; |
120 |
|
121 |
- (BOOL)isRootIcon; |
122 |
|
123 |
- (NSArray *)paths; |
124 |
|
125 |
- (NSString *)name; |
126 |
|
127 |
- (NSString *)hostname; |
128 |
|
129 |
- (NSImage *)icon; |
130 |
|
131 |
- (NSSize)iconShift; |
132 |
|
133 |
@end |
134 |
|
135 |
|
136 |
@interface BIcon (DraggingSource) |
137 |
|
138 |
- (void)startExternalDragOnEvent:(NSEvent *)event; |
139 |
|
140 |
- (void)declareAndSetShapeOnPasteboard:(NSPasteboard *)pb; |
141 |
|
142 |
- (unsigned int)draggingSourceOperationMaskForLocal:(BOOL)flag; |
143 |
|
144 |
- (void)draggedImage:(NSImage *)anImage |
145 |
endedAt:(NSPoint)aPoint |
146 |
deposited:(BOOL)flag; |
147 |
|
148 |
@end |
149 |
|
150 |
|
151 |
@interface BIcon (DraggingDestination) |
152 |
|
153 |
- (unsigned int)draggingEntered:(id <NSDraggingInfo>)sender; |
154 |
|
155 |
- (unsigned int)draggingUpdated:(id <NSDraggingInfo>)sender; |
156 |
|
157 |
- (void)draggingExited:(id <NSDraggingInfo>)sender; |
158 |
|
159 |
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender; |
160 |
|
161 |
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender; |
162 |
|
163 |
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender; |
164 |
|
165 |
@end |
166 |
|
167 |
|
168 |
// |
169 |
// Methods Implemented by the Delegate |
170 |
// |
171 |
|
172 |
@interface NSObject (BIconDelegateMethods) |
173 |
|
174 |
- (void)icon:(BIcon *)sender setFrameOfLabel:(NSTextField *)label; |
175 |
|
176 |
- (void)unselectOtherIcons:(BIcon *)selicon; |
177 |
|
178 |
- (void)unselectNameEditor; |
179 |
|
180 |
- (void)restoreSelectionAfterDndOfIcon:(BIcon *)dndicon; |
181 |
|
182 |
- (void)clickOnIcon:(BIcon *)clicked; |
183 |
|
184 |
- (void)doubleClickOnIcon:(BIcon *)clicked newViewer:(BOOL)isnew; |
185 |
|
186 |
@end |
187 |
|
188 |
#endif // BICON_H |