1 |
/* Browser2.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 BROWSER2_H |
27 |
#define BROWSER2_H |
28 |
|
29 |
#include <AppKit/NSView.h> |
30 |
|
31 |
enum { |
32 |
GWColumnIconMask = 1, |
33 |
GWIconCellsMask = 2, |
34 |
GWViewsPaksgesMask = 4 |
35 |
}; |
36 |
|
37 |
@class NSString; |
38 |
@class NSArray; |
39 |
@class NSFileManager; |
40 |
@class NSDictionary; |
41 |
@class NSNotification; |
42 |
@class NSScroller; |
43 |
@class NSFont; |
44 |
@class NSCursor; |
45 |
@class BColumn; |
46 |
@class BIcon; |
47 |
@class BCell; |
48 |
@class BNameEditor; |
49 |
|
50 |
typedef int (*intIMP)(id, SEL, id); |
51 |
|
52 |
@interface Browser2 : NSView |
53 |
{ |
54 |
NSString *basePath; |
55 |
NSString *pathSeparator; |
56 |
BOOL isLoaded; |
57 |
unsigned int styleMask; |
58 |
|
59 |
NSMutableArray *columns; |
60 |
NSRect *colRects; |
61 |
BCell *cellPrototype; |
62 |
NSScroller *scroller; |
63 |
BOOL skipUpdateScroller; |
64 |
|
65 |
BOOL canUpdateViews; |
66 |
|
67 |
int visibleColumns; |
68 |
int lastColumnLoaded; |
69 |
int firstVisibleColumn; |
70 |
int lastVisibleColumn; |
71 |
int currentshift; |
72 |
|
73 |
NSSize columnSize; |
74 |
float columnOriginY; |
75 |
float columnWidth; |
76 |
float iconsPathWidth; |
77 |
NSRect scrollerRect; |
78 |
float scrollerWidth; |
79 |
|
80 |
BOOL simulatingDoubleClick; |
81 |
NSArray *doubleClickSelection; |
82 |
float mousePointX; |
83 |
float mousePointY; |
84 |
|
85 |
BNameEditor *nameEditor; |
86 |
NSFont *editorFont; |
87 |
BColumn *edCol; |
88 |
BOOL isEditingIconName; |
89 |
|
90 |
NSString *charBuffer; |
91 |
NSTimeInterval lastKeyPressed; |
92 |
int alphaNumericalLastColumn; |
93 |
|
94 |
id delegate; |
95 |
id gworkspace; |
96 |
|
97 |
SEL createEmptySel; |
98 |
IMP createEmpty; |
99 |
SEL addAndLoadSel; |
100 |
IMP addAndLoad; |
101 |
SEL unloadFromSel; |
102 |
IMP unloadFrom; |
103 |
SEL lastColumnSel; |
104 |
IMP lastColumn; |
105 |
SEL setPathsSel; |
106 |
IMP setPaths; |
107 |
SEL getSel; |
108 |
IMP getImp; |
109 |
SEL indexSel; |
110 |
intIMP indexImp; |
111 |
} |
112 |
|
113 |
- (id)initWithBasePath:(NSString *)bpath |
114 |
visibleColumns:(int)vcols |
115 |
styleMask:(int)mask |
116 |
delegate:(id)anobject; |
117 |
|
118 |
- (void)setPathAndSelection:(NSArray *)selection; |
119 |
|
120 |
- (void)loadColumnZero; |
121 |
- (BColumn *)createEmptyColumn; |
122 |
- (void)addAndLoadColumnForPaths:(NSArray *)cpaths; |
123 |
- (void)unloadFromColumn:(int)column; |
124 |
- (void)reloadColumnWithPath:(NSString *)cpath; |
125 |
- (void)reloadFromColumnWithPath:(NSString *)cpath; |
126 |
- (void)setLastColumn:(int)column; |
127 |
|
128 |
- (void)tile; |
129 |
- (void)makeColumnsRects; |
130 |
- (void)scrollViaScroller:(NSScroller *)sender; |
131 |
- (void)updateScroller; |
132 |
- (void)scrollColumnsLeftBy:(int)shiftAmount; |
133 |
- (void)scrollColumnsRightBy:(int)shiftAmount; |
134 |
- (void)scrollColumnToVisible:(int)column; |
135 |
- (void)moveLeft:(id)sender; |
136 |
- (void)moveRight:(id)sender; |
137 |
- (void)setShift:(int)s; |
138 |
|
139 |
- (BOOL)isShowingPath:(NSString *)path; |
140 |
- (NSString *)pathToLastColumn; |
141 |
- (BColumn *)selectedColumn; |
142 |
- (NSArray *)selectionInColumn:(int)column; |
143 |
- (NSArray *)selectionInColumnBeforeColumn:(BColumn *)col; |
144 |
- (void)selectCellsWithNames:(NSArray *)names |
145 |
inColumnWithPath:(NSString *)cpath |
146 |
sendAction:(BOOL)act; |
147 |
- (void)extendSelectionWithDimmedFiles:(NSArray *)dimmFiles |
148 |
fromColumnWithPath:(NSString *)cpath; |
149 |
- (void)selectAllInLastColumn; |
150 |
- (void)selectForEditingInLastColumn; |
151 |
- (void)unselectNameEditor; |
152 |
- (void)restoreSelectionAfterDndOfIcon:(BIcon *)dndicon; |
153 |
- (void)renewLastIcon; |
154 |
|
155 |
- (void)addCellsWithNames:(NSArray *)names |
156 |
inColumnWithPath:(NSString *)cpath; |
157 |
- (void)addDimmedCellsWithNames:(NSArray *)names |
158 |
inColumnWithPath:(NSString *)cpath; |
159 |
- (void)removeCellsWithNames:(NSArray *)names |
160 |
inColumnWithPath:(NSString *)cpath; |
161 |
- (void)lockCellsWithNames:(NSArray *)names |
162 |
inColumnWithPath:(NSString *)cpath; |
163 |
- (void)unLockCellsWithNames:(NSArray *)names |
164 |
inColumnWithPath:(NSString *)cpath |
165 |
mustExtend:(BOOL)extend; |
166 |
|
167 |
- (int)firstVisibleColumn; |
168 |
- (BColumn *)lastLoadedColumn; |
169 |
- (BColumn *)lastNotEmptyColumn; |
170 |
- (BColumn *)columnWithPath:(NSString *)cpath; |
171 |
- (BColumn *)columnBeforeColumn:(BColumn *)col; |
172 |
- (BColumn *)columnAfterColumn:(BColumn *)col; |
173 |
- (NSArray *)columnsDifferentFromColumn:(BColumn *)col; |
174 |
|
175 |
- (NSPoint)positionOfLastIcon; |
176 |
- (NSPoint)positionForSlidedImage; |
177 |
|
178 |
- (BOOL)viewsapps; |
179 |
|
180 |
- (void)doubleClikTimeOut:(id)sender; |
181 |
- (void)clickInMatrixOfColumn:(BColumn *)col; |
182 |
- (void)doubleClickInMatrixOfColumn:(BColumn *)col; |
183 |
- (void)clickOnIcon:(BIcon *)icon ofColumn:(BColumn *)col; |
184 |
- (void)doubleClickOnIcon:(BIcon *)icon |
185 |
ofColumn:(BColumn *)col |
186 |
newViewer:(BOOL)isnew; |
187 |
|
188 |
- (void)updateNameEditor; |
189 |
- (BOOL)isEditingIconName; |
190 |
- (void)controlTextDidBeginEditing:(NSNotification *)aNotification; |
191 |
- (void)controlTextDidChange:(NSNotification *)aNotification; |
192 |
- (void)controlTextDidEndEditing:(NSNotification *)aNotification; |
193 |
- (void)editorAction:(id)sender; |
194 |
- (BOOL)fileManager:(NSFileManager *)manager |
195 |
shouldProceedAfterError:(NSDictionary *)errorDict; |
196 |
- (void)fileManager:(NSFileManager *)manager willProcessPath:(NSString *)path; |
197 |
|
198 |
@end |
199 |
|
200 |
// |
201 |
// Methods Implemented by the Delegate |
202 |
// |
203 |
@interface NSObject (Browser2DelegateMethods) |
204 |
|
205 |
- (void)currentSelectedPaths:(NSArray *)paths; |
206 |
|
207 |
- (void)openSelectedPaths:(NSArray *)paths newViewer:(BOOL)isnew; |
208 |
|
209 |
@end |
210 |
|
211 |
#endif // BROWSER2_H |
212 |
|