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 |
|
96 |
SEL createEmptySel; |
97 |
IMP createEmpty; |
98 |
SEL addAndLoadSel; |
99 |
IMP addAndLoad; |
100 |
SEL unloadFromSel; |
101 |
IMP unloadFrom; |
102 |
SEL lastColumnSel; |
103 |
IMP lastColumn; |
104 |
SEL setPathsSel; |
105 |
IMP setPaths; |
106 |
SEL getSel; |
107 |
IMP getImp; |
108 |
SEL indexSel; |
109 |
intIMP indexImp; |
110 |
} |
111 |
|
112 |
- (id)initWithBasePath:(NSString *)bpath |
113 |
visibleColumns:(int)vcols |
114 |
styleMask:(int)mask |
115 |
delegate:(id)anobject; |
116 |
|
117 |
- (void)setPathAndSelection:(NSArray *)selection; |
118 |
|
119 |
- (void)loadColumnZero; |
120 |
- (BColumn *)createEmptyColumn; |
121 |
- (void)addAndLoadColumnForPaths:(NSArray *)cpaths; |
122 |
- (void)unloadFromColumn:(int)column; |
123 |
- (void)reloadColumnWithPath:(NSString *)cpath; |
124 |
- (void)reloadFromColumnWithPath:(NSString *)cpath; |
125 |
- (void)setLastColumn:(int)column; |
126 |
|
127 |
- (void)tile; |
128 |
- (void)makeColumnsRects; |
129 |
- (void)scrollViaScroller:(NSScroller *)sender; |
130 |
- (void)updateScroller; |
131 |
- (void)scrollColumnsLeftBy:(int)shiftAmount; |
132 |
- (void)scrollColumnsRightBy:(int)shiftAmount; |
133 |
- (void)scrollColumnToVisible:(int)column; |
134 |
- (void)moveLeft:(id)sender; |
135 |
- (void)moveRight:(id)sender; |
136 |
- (void)setShift:(int)s; |
137 |
|
138 |
- (BOOL)isShowingPath:(NSString *)path; |
139 |
- (NSString *)pathToLastColumn; |
140 |
- (BColumn *)selectedColumn; |
141 |
- (NSArray *)selectionInColumn:(int)column; |
142 |
- (NSArray *)selectionInColumnBeforeColumn:(BColumn *)col; |
143 |
- (void)selectCellsWithNames:(NSArray *)names |
144 |
inColumnWithPath:(NSString *)cpath |
145 |
sendAction:(BOOL)act; |
146 |
- (void)extendSelectionWithDimmedFiles:(NSArray *)dimmFiles |
147 |
fromColumnWithPath:(NSString *)cpath; |
148 |
- (void)selectAllInLastColumn; |
149 |
- (void)selectForEditingInLastColumn; |
150 |
- (void)unselectNameEditor; |
151 |
- (void)restoreSelectionAfterDndOfIcon:(BIcon *)dndicon; |
152 |
- (void)renewLastIcon; |
153 |
|
154 |
- (void)addCellsWithNames:(NSArray *)names |
155 |
inColumnWithPath:(NSString *)cpath; |
156 |
- (void)addDimmedCellsWithNames:(NSArray *)names |
157 |
inColumnWithPath:(NSString *)cpath; |
158 |
- (void)removeCellsWithNames:(NSArray *)names |
159 |
inColumnWithPath:(NSString *)cpath; |
160 |
- (void)lockCellsWithNames:(NSArray *)names |
161 |
inColumnWithPath:(NSString *)cpath; |
162 |
- (void)unLockCellsWithNames:(NSArray *)names |
163 |
inColumnWithPath:(NSString *)cpath |
164 |
mustExtend:(BOOL)extend; |
165 |
|
166 |
- (int)firstVisibleColumn; |
167 |
- (BColumn *)lastLoadedColumn; |
168 |
- (BColumn *)lastNotEmptyColumn; |
169 |
- (BColumn *)columnWithPath:(NSString *)cpath; |
170 |
- (BColumn *)columnBeforeColumn:(BColumn *)col; |
171 |
- (BColumn *)columnAfterColumn:(BColumn *)col; |
172 |
- (NSArray *)columnsDifferentFromColumn:(BColumn *)col; |
173 |
|
174 |
- (NSPoint)positionOfLastIcon; |
175 |
- (NSPoint)positionForSlidedImage; |
176 |
|
177 |
- (BOOL)viewsapps; |
178 |
|
179 |
- (void)doubleClikTimeOut:(id)sender; |
180 |
- (void)clickInMatrixOfColumn:(BColumn *)col; |
181 |
- (void)doubleClickInMatrixOfColumn:(BColumn *)col; |
182 |
- (void)clickOnIcon:(BIcon *)icon ofColumn:(BColumn *)col; |
183 |
- (void)doubleClickOnIcon:(BIcon *)icon |
184 |
ofColumn:(BColumn *)col |
185 |
newViewer:(BOOL)isnew; |
186 |
|
187 |
- (void)updateNameEditor; |
188 |
- (BOOL)isEditingIconName; |
189 |
- (void)controlTextDidBeginEditing:(NSNotification *)aNotification; |
190 |
- (void)controlTextDidChange:(NSNotification *)aNotification; |
191 |
- (void)controlTextDidEndEditing:(NSNotification *)aNotification; |
192 |
- (void)editorAction:(id)sender; |
193 |
- (BOOL)fileManager:(NSFileManager *)manager |
194 |
shouldProceedAfterError:(NSDictionary *)errorDict; |
195 |
- (void)fileManager:(NSFileManager *)manager willProcessPath:(NSString *)path; |
196 |
|
197 |
@end |
198 |
|
199 |
// |
200 |
// Methods Implemented by the Delegate |
201 |
// |
202 |
@interface NSObject (Browser2DelegateMethods) |
203 |
|
204 |
- (void)currentSelectedPaths:(NSArray *)paths; |
205 |
|
206 |
- (void)openSelectedPaths:(NSArray *)paths newViewer:(BOOL)isnew; |
207 |
|
208 |
@end |
209 |
|
210 |
#endif // BROWSER2_H |
211 |
|