comparison dwt/internal/cocoa/NSBrowser.d @ 0:380af2bdd8e5

Upload of whole dwt tree
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Sat, 09 Aug 2008 17:00:02 +0200
parents
children 8b48be5454ce
comparison
equal deleted inserted replaced
-1:000000000000 0:380af2bdd8e5
1 /*******************************************************************************
2 * Copyright (c) 2007 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *
11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/
14 module dwt.internal.cocoa.NSBrowser;
15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.CGFloat;
18 import dwt.internal.cocoa.NSArray;
19 import dwt.internal.cocoa.NSCell;
20 import dwt.internal.cocoa.NSColor;
21 import dwt.internal.cocoa.NSControl;
22 import dwt.internal.cocoa.NSEvent;
23 import dwt.internal.cocoa.NSImage;
24 import dwt.internal.cocoa.NSIndexSet;
25 import dwt.internal.cocoa.NSInteger;
26 import dwt.internal.cocoa.NSMatrix;
27 import dwt.internal.cocoa.NSPoint : NSPointPointer;
28 import dwt.internal.cocoa.NSRect;
29 import dwt.internal.cocoa.NSScroller;
30 import dwt.internal.cocoa.NSString;
31 import dwt.internal.cocoa.OS;
32 import objc = dwt.internal.objc.runtime;
33
34 public class NSBrowser : NSControl
35 {
36 public this ()
37 {
38 super();
39 }
40
41 public this (objc.id id)
42 {
43 super(id);
44 }
45
46 public bool acceptsArrowKeys ()
47 {
48 return OS.objc_msgSend(this.id, OS.sel_acceptsArrowKeys) !is null;
49 }
50
51 public void addColumn ()
52 {
53 OS.objc_msgSend(this.id, OS.sel_addColumn);
54 }
55
56 public bool allowsBranchSelection ()
57 {
58 return OS.objc_msgSend(this.id, OS.sel_allowsBranchSelection) !is null;
59 }
60
61 public bool allowsEmptySelection ()
62 {
63 return OS.objc_msgSend(this.id, OS.sel_allowsEmptySelection) !is null;
64 }
65
66 public bool allowsMultipleSelection ()
67 {
68 return OS.objc_msgSend(this.id, OS.sel_allowsMultipleSelection) !is null;
69 }
70
71 public bool allowsTypeSelect ()
72 {
73 return OS.objc_msgSend(this.id, OS.sel_allowsTypeSelect) !is null;
74 }
75
76 public NSColor backgroundColor ()
77 {
78 objc.id result = OS.objc_msgSend(this.id, OS.sel_backgroundColor);
79 return result !is null ? new NSColor(result) : null;
80 }
81
82 public bool canDragRowsWithIndexes (NSIndexSet rowIndexes, NSInteger column, NSEvent event)
83 {
84 return OS.objc_msgSend(this.id, OS.sel_canDragRowsWithIndexes_1inColumn_1withEvent_1, rowIndexes !is null ? rowIndexes.id : null, column,
85 event !is null ? event.id : null) !is null;
86 }
87
88 public static objc.Class cellClass ()
89 {
90 return OS.objc_msgSend(OS.class_NSBrowser, OS.sel_cellClass);
91 }
92
93 public id cellPrototype ()
94 {
95 objc.id result = OS.objc_msgSend(this.id, OS.sel_cellPrototype);
96 return result !is null ? new id(result) : null;
97 }
98
99 public CGFloat columnContentWidthForColumnWidth (CGFloat columnWidth)
100 {
101 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_columnContentWidthForColumnWidth_1, columnWidth);
102 }
103
104 public NSInteger columnOfMatrix (NSMatrix matrix)
105 {
106 return OS.objc_msgSend(this.id, OS.sel_columnOfMatrix_1, matrix !is null ? matrix.id : null);
107 }
108
109 public objc.id columnResizingType ()
110 {
111 return OS.objc_msgSend(this.id, OS.sel_columnResizingType);
112 }
113
114 public CGFloat columnWidthForColumnContentWidth (CGFloat columnContentWidth)
115 {
116 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_columnWidthForColumnContentWidth_1, columnContentWidth);
117 }
118
119 public NSString columnsAutosaveName ()
120 {
121 objc.id result = OS.objc_msgSend(this.id, OS.sel_columnsAutosaveName);
122 return result !is null ? new NSString(result) : null;
123 }
124
125 public id delegatee ()
126 {
127 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate);
128 return result !is null ? new id(result) : null;
129 }
130
131 public void displayAllColumns ()
132 {
133 OS.objc_msgSend(this.id, OS.sel_displayAllColumns);
134 }
135
136 public void displayColumn (NSInteger column)
137 {
138 OS.objc_msgSend(this.id, OS.sel_displayColumn_1, column);
139 }
140
141 public void doClick (id sender)
142 {
143 OS.objc_msgSend(this.id, OS.sel_doClick_1, sender !is null ? sender.id : null);
144 }
145
146 public void doDoubleClick (id sender)
147 {
148 OS.objc_msgSend(this.id, OS.sel_doDoubleClick_1, sender !is null ? sender.id : null);
149 }
150
151 public SEL doubleAction ()
152 {
153 return OS.objc_msgSend(this.id, OS.sel_doubleAction);
154 }
155
156 public NSImage draggingImageForRowsWithIndexes (NSIndexSet rowIndexes, NSInteger column, NSEvent event, NSPointPointer dragImageOffset)
157 {
158 objc.id result = OS.objc_msgSend(this.id, OS.sel_draggingImageForRowsWithIndexes_1inColumn_1withEvent_1offset_1,
159 rowIndexes !is null ? rowIndexes.id : null, column, event !is null ? event.id : null, dragImageOffset);
160 return result !is null ? new NSImage(result) : null;
161 }
162
163 public void drawTitleOfColumn (NSInteger column, NSRect aRect)
164 {
165 OS.objc_msgSend(this.id, OS.sel_drawTitleOfColumn_1inRect_1, column, aRect);
166 }
167
168 public NSInteger firstVisibleColumn ()
169 {
170 return OS.objc_msgSend(this.id, OS.sel_firstVisibleColumn);
171 }
172
173 public NSRect frameOfColumn (NSInteger column)
174 {
175 NSRect result;
176 OS.objc_msgSend_stret(result, this.id, OS.sel_frameOfColumn_1, column);
177 return result;
178 }
179
180 public NSRect frameOfInsideOfColumn (NSInteger column)
181 {
182 NSRect result;
183 OS.objc_msgSend_stret(result, this.id, OS.sel_frameOfInsideOfColumn_1, column);
184 return result;
185 }
186
187 public bool hasHorizontalScroller ()
188 {
189 return OS.objc_msgSend(this.id, OS.sel_hasHorizontalScroller) !is null;
190 }
191
192 public bool isLoaded ()
193 {
194 return OS.objc_msgSend(this.id, OS.sel_isLoaded) !is null;
195 }
196
197 public bool isTitled ()
198 {
199 return OS.objc_msgSend(this.id, OS.sel_isTitled) !is null;
200 }
201
202 public NSInteger lastColumn ()
203 {
204 return OS.objc_msgSend(this.id, OS.sel_lastColumn);
205 }
206
207 public NSInteger lastVisibleColumn ()
208 {
209 return OS.objc_msgSend(this.id, OS.sel_lastVisibleColumn);
210 }
211
212 public void loadColumnZero ()
213 {
214 OS.objc_msgSend(this.id, OS.sel_loadColumnZero);
215 }
216
217 public id loadedCellAtRow (NSInteger row, NSInteger col)
218 {
219 objc.id result = OS.objc_msgSend(this.id, OS.sel_loadedCellAtRow_1column_1, row, col);
220 return result !is null ? new id(result) : null;
221 }
222
223 public objc.Class matrixClass ()
224 {
225 return OS.objc_msgSend(this.id, OS.sel_matrixClass);
226 }
227
228 public NSMatrix matrixInColumn (NSInteger column)
229 {
230 objc.id result = OS.objc_msgSend(this.id, OS.sel_matrixInColumn_1, column);
231 return result !is null ? new NSMatrix(result) : null;
232 }
233
234 public NSInteger maxVisibleColumns ()
235 {
236 return OS.objc_msgSend(this.id, OS.sel_maxVisibleColumns);
237 }
238
239 public CGFloat minColumnWidth ()
240 {
241 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_minColumnWidth);
242 }
243
244 public NSInteger numberOfVisibleColumns ()
245 {
246 return OS.objc_msgSend(this.id, OS.sel_numberOfVisibleColumns);
247 }
248
249 public NSString path ()
250 {
251 objc.id result = OS.objc_msgSend(this.id, OS.sel_path);
252 return result !is null ? new NSString(result) : null;
253 }
254
255 public NSString pathSeparator ()
256 {
257 objc.id result = OS.objc_msgSend(this.id, OS.sel_pathSeparator);
258 return result !is null ? new NSString(result) : null;
259 }
260
261 public NSString pathToColumn (NSInteger column)
262 {
263 objc.id result = OS.objc_msgSend(this.id, OS.sel_pathToColumn_1, column);
264 return result !is null ? new NSString(result) : null;
265 }
266
267 public bool prefersAllColumnUserResizing ()
268 {
269 return OS.objc_msgSend(this.id, OS.sel_prefersAllColumnUserResizing) !is null;
270 }
271
272 public void reloadColumn (NSInteger column)
273 {
274 OS.objc_msgSend(this.id, OS.sel_reloadColumn_1, column);
275 }
276
277 public static void removeSavedColumnsWithAutosaveName (NSString name)
278 {
279 OS.objc_msgSend(OS.class_NSBrowser, OS.sel_removeSavedColumnsWithAutosaveName_1, name !is null ? name.id : null);
280 }
281
282 public bool reusesColumns ()
283 {
284 return OS.objc_msgSend(this.id, OS.sel_reusesColumns) !is null;
285 }
286
287 public void scrollColumnToVisible (NSInteger column)
288 {
289 OS.objc_msgSend(this.id, OS.sel_scrollColumnToVisible_1, column);
290 }
291
292 public void scrollColumnsLeftBy (NSInteger shiftAmount)
293 {
294 OS.objc_msgSend(this.id, OS.sel_scrollColumnsLeftBy_1, shiftAmount);
295 }
296
297 public void scrollColumnsRightBy (NSInteger shiftAmount)
298 {
299 OS.objc_msgSend(this.id, OS.sel_scrollColumnsRightBy_1, shiftAmount);
300 }
301
302 public void scrollViaScroller (NSScroller sender)
303 {
304 OS.objc_msgSend(this.id, OS.sel_scrollViaScroller_1, sender !is null ? sender.id : null);
305 }
306
307 public void selectAll (id sender)
308 {
309 OS.objc_msgSend(this.id, OS.sel_selectAll_1, sender !is null ? sender.id : null);
310 }
311
312 public void selectRow (NSInteger row, NSInteger column)
313 {
314 OS.objc_msgSend(this.id, OS.sel_selectRow_1inColumn_1, row, column);
315 }
316
317 public void selectRowIndexes (NSIndexSet indexes, NSInteger column)
318 {
319 OS.objc_msgSend(this.id, OS.sel_selectRowIndexes_1inColumn_1, indexes !is null ? indexes.id : null, column);
320 }
321
322 public id selectedCell ()
323 {
324 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedCell);
325 return result !is null ? new id(result) : null;
326 }
327
328 public id selectedCellInColumn (NSInteger column)
329 {
330 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedCellInColumn_1, column);
331 return result !is null ? new id(result) : null;
332 }
333
334 public NSArray selectedCells ()
335 {
336 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedCells);
337 return result !is null ? new NSArray(result) : null;
338 }
339
340 public NSInteger selectedColumn ()
341 {
342 return OS.objc_msgSend(this.id, OS.sel_selectedColumn);
343 }
344
345 public NSInteger selectedRowInColumn (NSInteger column)
346 {
347 return OS.objc_msgSend(this.id, OS.sel_selectedRowInColumn_1, column);
348 }
349
350 public NSIndexSet selectedRowIndexesInColumn (NSInteger column)
351 {
352 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedRowIndexesInColumn_1, column);
353 return result !is null ? new NSIndexSet(result) : null;
354 }
355
356 public bool sendAction ()
357 {
358 return OS.objc_msgSend(this.id, OS.sel_sendAction) !is null;
359 }
360
361 public bool sendsActionOnArrowKeys ()
362 {
363 return OS.objc_msgSend(this.id, OS.sel_sendsActionOnArrowKeys) !is null;
364 }
365
366 public bool separatesColumns ()
367 {
368 return OS.objc_msgSend(this.id, OS.sel_separatesColumns) !is null;
369 }
370
371 public void setAcceptsArrowKeys (bool flag)
372 {
373 OS.objc_msgSend(this.id, OS.sel_setAcceptsArrowKeys_1, flag);
374 }
375
376 public void setAllowsBranchSelection (bool flag)
377 {
378 OS.objc_msgSend(this.id, OS.sel_setAllowsBranchSelection_1, flag);
379 }
380
381 public void setAllowsEmptySelection (bool flag)
382 {
383 OS.objc_msgSend(this.id, OS.sel_setAllowsEmptySelection_1, flag);
384 }
385
386 public void setAllowsMultipleSelection (bool flag)
387 {
388 OS.objc_msgSend(this.id, OS.sel_setAllowsMultipleSelection_1, flag);
389 }
390
391 public void setAllowsTypeSelect (bool value)
392 {
393 OS.objc_msgSend(this.id, OS.sel_setAllowsTypeSelect_1, value);
394 }
395
396 public void setBackgroundColor (NSColor color)
397 {
398 OS.objc_msgSend(this.id, OS.sel_setBackgroundColor_1, color !is null ? color.id : null);
399 }
400
401 //public void setCellClass(Class factoryId) {
402 // OS.objc_msgSend(this.id, OS.sel_setCellClass_1, factoryId);
403 //}
404
405 public void setCellPrototype (NSCell aCell)
406 {
407 OS.objc_msgSend(this.id, OS.sel_setCellPrototype_1, aCell !is null ? aCell.id : null);
408 }
409
410 public void setColumnResizingType (objc.id columnResizingType)
411 {
412 OS.objc_msgSend(this.id, OS.sel_setColumnResizingType_1, columnResizingType);
413 }
414
415 public void setColumnsAutosaveName (NSString name)
416 {
417 OS.objc_msgSend(this.id, OS.sel_setColumnsAutosaveName_1, name !is null ? name.id : null);
418 }
419
420 public void setDelegate (id anObject)
421 {
422 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null);
423 }
424
425 public void setDoubleAction (objc.SEL aSelector)
426 {
427 OS.objc_msgSend(this.id, OS.sel_setDoubleAction_1, aSelector);
428 }
429
430 public void setDraggingSourceOperationMask (objc.id mask, bool isLocal)
431 {
432 OS.objc_msgSend(this.id, OS.sel_setDraggingSourceOperationMask_1forLocal_1, mask, isLocal);
433 }
434
435 public void setHasHorizontalScroller (bool flag)
436 {
437 OS.objc_msgSend(this.id, OS.sel_setHasHorizontalScroller_1, flag);
438 }
439
440 public void setLastColumn (NSInteger column)
441 {
442 OS.objc_msgSend(this.id, OS.sel_setLastColumn_1, column);
443 }
444
445 public void setMatrixClass (Class factoryId)
446 {
447 OS.objc_msgSend(this.id, OS.sel_setMatrixClass_1, factoryId);
448 }
449
450 public void setMaxVisibleColumns (NSInteger columnCount)
451 {
452 OS.objc_msgSend(this.id, OS.sel_setMaxVisibleColumns_1, columnCount);
453 }
454
455 public void setMinColumnWidth (CGFloat columnWidth)
456 {
457 OS.objc_msgSend(this.id, OS.sel_setMinColumnWidth_1, columnWidth);
458 }
459
460 public bool setPath (NSString path)
461 {
462 return OS.objc_msgSend(this.id, OS.sel_setPath_1, path !is null ? path.id : null) !is null;
463 }
464
465 public void setPathSeparator (NSString newString)
466 {
467 OS.objc_msgSend(this.id, OS.sel_setPathSeparator_1, newString !is null ? newString.id : null);
468 }
469
470 public void setPrefersAllColumnUserResizing (bool prefersAllColumnResizing)
471 {
472 OS.objc_msgSend(this.id, OS.sel_setPrefersAllColumnUserResizing_1, prefersAllColumnResizing);
473 }
474
475 public void setReusesColumns (bool flag)
476 {
477 OS.objc_msgSend(this.id, OS.sel_setReusesColumns_1, flag);
478 }
479
480 public void setSendsActionOnArrowKeys (bool flag)
481 {
482 OS.objc_msgSend(this.id, OS.sel_setSendsActionOnArrowKeys_1, flag);
483 }
484
485 public void setSeparatesColumns (bool flag)
486 {
487 OS.objc_msgSend(this.id, OS.sel_setSeparatesColumns_1, flag);
488 }
489
490 public void setTakesTitleFromPreviousColumn (bool flag)
491 {
492 OS.objc_msgSend(this.id, OS.sel_setTakesTitleFromPreviousColumn_1, flag);
493 }
494
495 public void setTitle (NSString aString, NSInteger column)
496 {
497 OS.objc_msgSend(this.id, OS.sel_setTitle_1ofColumn_1, aString !is null ? aString.id : null, column);
498 }
499
500 public void setTitled (bool flag)
501 {
502 OS.objc_msgSend(this.id, OS.sel_setTitled_1, flag);
503 }
504
505 public void setWidth (CGFloat columnWidth, NSInteger columnIndex)
506 {
507 OS.objc_msgSend(this.id, OS.sel_setWidth_1ofColumn_1, columnWidth, columnIndex);
508 }
509
510 public bool takesTitleFromPreviousColumn ()
511 {
512 return OS.objc_msgSend(this.id, OS.sel_takesTitleFromPreviousColumn) !is null;
513 }
514
515 public void tile ()
516 {
517 OS.objc_msgSend(this.id, OS.sel_tile);
518 }
519
520 public NSRect titleFrameOfColumn (NSInteger column)
521 {
522 NSRect result;
523 OS.objc_msgSend_stret(result, this.id, OS.sel_titleFrameOfColumn_1, column);
524 return result;
525 }
526
527 public CGFloat titleHeight ()
528 {
529 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_titleHeight);
530 }
531
532 public NSString titleOfColumn (NSInteger column)
533 {
534 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleOfColumn_1, column);
535 return result !is null ? new NSString(result) : null;
536 }
537
538 public void updateScroller ()
539 {
540 OS.objc_msgSend(this.id, OS.sel_updateScroller);
541 }
542
543 public void validateVisibleColumns ()
544 {
545 OS.objc_msgSend(this.id, OS.sel_validateVisibleColumns);
546 }
547
548 public CGFloat widthOfColumn (NSInteger column)
549 {
550 return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_widthOfColumn_1, column);
551 }
552 }