API  0.9.10
CPBrowser.j
Go to the documentation of this file.
1 /*
2  * CPBrowser.j
3  * AppKit
4  *
5  * Created by Ross Boucher.
6  * Copyright 2010, 280 North, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
24 
25 @global CPApp
26 
27 @protocol CPBrowserDelegate <CPObject>
28 
29 @optional
30 - (BOOL)browser:(CPBrowser)browser acceptDrop:(id)info atRow:(CPInteger)row column:(CPInteger)column dropOperation:(CPTableViewDropOperation)dropOperation;
31 - (BOOL)browser:(CPBrowser)browser canDragRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)column withEvent:(CPEvent )event;
32 - (BOOL)browser:(CPBrowser)browser isLeafItem:(id)item;
33 - (BOOL)browser:(CPBrowser)browser shouldSelectRowIndexes:(CPIndexSet)anIndexSet inColumn:(CPInteger)column;
34 - (BOOL)browser:(CPBrowser)browser writeRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)column toPasteboard:(CPPasteboard)pasteboard;
35 - (CPDragOperation)browser:(CPBrowser)browser validateDrop:(id)info proposedRow:(CPInteger)row column:(CPInteger)column dropOperation:(CPTableViewDropOperation)dropOperation;
36 - (CPImage)browser:(CPBrowser)browser imageValueForItem:(id)anItem;
37 - (CPImage)browser:(CPBrowser)browser draggingImageForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)column withEvent:(CPEvent)event offset:(CGPoint)dragImageOffset;
38 - (CPImage)browser:(CPBrowser)browser imageValueForItem:(id)item;
39 - (CPIndexSet)browser:(CPBrowser)browser selectionIndexesForProposedSelection:(CPIndexSet)proposedSelectionIndexes inColumn:(CPInteger)column;
40 - (CPInteger)browser:(CPBrowser)browser numberOfChildrenOfItem:(id)item;
41 - (CPView)browser:(CPBrowser)browser draggingViewForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)column withEvent:(CPEvent)event offset:(CGPoint)dragImageOffset;
42 - (id)browser:(CPBrowser)browser child:(CPInteger)index ofItem:(id)item;
43 - (id)browser:(CPBrowser)browser objectValueForItem:(id)item;
44 - (id)rootItemForBrowser:(CPBrowser)browser;
45 - (void)browser:(CPBrowser)browser didChangeLastColumn:(CPInteger)oldLastColumn toColumn:(CPInteger)column;
46 - (void)browser:(CPBrowser)browser didResizeColumn:(CPInteger)column;
47 - (void)browserSelectionIsChanging:(CPBrowser)browser;
48 - (void)browserSelectionDidChange:(CPBrowser)browser;
49 
50 @end
51 
71 
75 @implementation CPBrowser : CPControl
76 {
77  id <CPBrowserDelegate> _delegate;
78  CPString _pathSeparator;
79  unsigned _implementedDelegateMethods;
80 
81  CPView _contentView;
82  CPScrollView _horizontalScrollView;
83  CPView _prototypeView;
84 
85  CPArray _tableViews;
86  CPArray _tableDelegates;
87 
88  id _rootItem;
89 
90  BOOL _delegateSupportsImages;
91 
92  SEL _doubleAction;
93 
94  BOOL _allowsMultipleSelection;
95  BOOL _allowsEmptySelection;
96 
97  Class _tableViewClass;
98 
99  float _rowHeight;
100  float _imageWidth;
101  float _leafWidth;
102  float _minColumnWidth;
103  float _defaultColumnWidth;
104 
105  CPArray _columnWidths;
106 }
107 
109 {
110  return "browser";
111 }
112 
114 {
115  return @{
116  @"image-control-resize": [CPNull null],
117  @"image-control-leaf": [CPNull null],
118  @"image-control-leaf-pressed": [CPNull null]
119  };
120 }
121 
122 - (id)initWithFrame:(CGRect)aFrame
123 {
124  if (self = [super initWithFrame:aFrame])
125  {
126  [self _init];
127  }
128 
129  return self;
130 }
131 
132 - (void)_init
133 {
134  _rowHeight = 23.0;
135  _defaultColumnWidth = 140.0;
136  _minColumnWidth = 80.0;
137  _imageWidth = 23.0;
138  _leafWidth = 13.0;
139  _columnWidths = [];
140 
141  _pathSeparator = "/";
142  _tableViews = [];
143  _tableDelegates = [];
144  _allowsMultipleSelection = YES;
145  _allowsEmptySelection = YES;
146  _tableViewClass = [_CPBrowserTableView class];
147 
148  _prototypeView = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
149  [_prototypeView setVerticalAlignment:CPCenterVerticalTextAlignment];
150  [_prototypeView setValue:[CPColor whiteColor] forThemeAttribute:"text-color" inState:CPThemeStateSelectedDataView];
151  [_prototypeView setLineBreakMode:CPLineBreakByTruncatingTail];
152 
153  _horizontalScrollView = [[CPScrollView alloc] initWithFrame:[self bounds]];
154 
155  [_horizontalScrollView setHasVerticalScroller:NO];
156  [_horizontalScrollView setAutohidesScrollers:YES];
157  [_horizontalScrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
158 
159  _contentView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 0, CGRectGetHeight([self bounds]))];
160  [_contentView setAutoresizingMask:CPViewHeightSizable];
161 
162  [_horizontalScrollView setDocumentView:_contentView];
163 
164  [self addSubview:_horizontalScrollView];
165 }
166 
167 - (void)setPrototypeView:(CPView)aPrototypeView
168 {
169  _prototypeView = [CPKeyedUnarchiver unarchiveObjectWithData:
171 }
172 
174 {
177 }
178 
179 - (void)setDelegate:(id <CPBrowserDelegate>)anObject
180 {
181  if (_delegate === anObject)
182  return;
183 
184  _delegate = anObject;
185  _implementedDelegateMethods = 0;
186  _delegateSupportsImages = NO;
187 
188  if ([_delegate respondsToSelector:@selector(browser:acceptDrop:atRow:column:dropOperation:)])
190 
191  if ([_delegate respondsToSelector:@selector(browser:canDragRowsWithIndexes:inColumn:withEvent:)])
193 
194  if ([_delegate respondsToSelector:@selector(browser:isLeafItem:)])
195  _implementedDelegateMethods |= CPBrowserDelegate_browser_isLeafItem_;
196 
197  if ([_delegate respondsToSelector:@selector(browser:shouldSelectRowIndexes:inColumn:)])
198  _implementedDelegateMethods |= CPBrowserDelegate_browser_shouldSelectRowIndexes_inColumn_;
199 
200  if ([_delegate respondsToSelector:@selector(browser:writeRowsWithIndexes:inColumn:toPasteboard:)])
202 
203  if ([_delegate respondsToSelector:@selector(browser:validateDrop:proposedRow:column:dropOperation:)])
205 
206  if ([_delegate respondsToSelector:@selector(browser:imageValueForItem:)])
207  _implementedDelegateMethods |= CPBrowserDelegate_browser_imageValueForItem_;
208 
209  if ([_delegate respondsToSelector:@selector(browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:)])
211 
212  if ([_delegate respondsToSelector:@selector(browser:imageValueForItem:)])
213  {
214  _delegateSupportsImages = YES;
215  _implementedDelegateMethods |= CPBrowserDelegate_browser_imageValueForItem_;
216  }
217 
218  if ([_delegate respondsToSelector:@selector(browser:selectionIndexesForProposedSelection:inColumn:)])
220 
221  if ([_delegate respondsToSelector:@selector(browser:numberOfChildrenOfItem:)])
222  _implementedDelegateMethods |= CPBrowserDelegate_browser_numberOfChildrenOfItem_;
223 
224  if ([_delegate respondsToSelector:@selector(browser:draggingViewForRowsWithIndexes:inColumn:withEvent:offset:)])
226 
227  if ([_delegate respondsToSelector:@selector(browser:child:ofItem:)])
228  _implementedDelegateMethods |= CPBrowserDelegate_browser_child_ofItem_;
229 
230  if ([_delegate respondsToSelector:@selector(browser:objectValueForItem:)])
231  _implementedDelegateMethods |= CPBrowserDelegate_browser_objectValueForItem_;
232 
233  if ([_delegate respondsToSelector:@selector(rootItemForBrowser:)])
234  _implementedDelegateMethods |= CPBrowserDelegate_rootItemForBrowser_;
235 
236  if ([_delegate respondsToSelector:@selector(browser:didChangeLastColumn:toColumn:)])
237  _implementedDelegateMethods |= CPBrowserDelegate_browser_didChangeLastColumn_toColumn_;
238 
239  if ([_delegate respondsToSelector:@selector(browser:didChangeLastColumn:)])
240  _implementedDelegateMethods |= CPBrowserDelegate_browser_didResizeColumn_;
241 
242  if ([_delegate respondsToSelector:@selector(browserSelectionIsChanging:)])
243  _implementedDelegateMethods |= CPBrowserDelegate_browserSelectionIsChanging_;
244 
245  if ([_delegate respondsToSelector:@selector(browserSelectionDidChange:)])
246  _implementedDelegateMethods |= CPBrowserDelegate_browserSelectionDidChange_;
247 
248  [self loadColumnZero];
249 }
250 
251 - (id)delegate
252 {
253  return _delegate;
254 }
255 
256 - (CPTableView)tableViewInColumn:(unsigned)index
257 {
258  return _tableViews[index];
259 }
260 
261 - (unsigned)columnOfTableView:(CPTableView)aTableView
262 {
263  return [_tableViews indexOfObject:aTableView];
264 }
265 
267 {
268  _rootItem = [self _sendDelegateRootItemForBrowser];
269 
270  [self setLastColumn:-1];
271  [self addColumn];
272 }
273 
274 - (void)setLastColumn:(CPInteger)columnIndex
275 {
276  if (columnIndex >= _tableViews.length)
277  return;
278 
279  var oldValue = _tableViews.length - 1,
280  indexPlusOne = columnIndex + 1; // unloads all later columns.
281 
282  if (columnIndex > 0)
283  [_tableViews[columnIndex - 1] setNeedsDisplay:YES];
284 
285  [_tableViews[columnIndex] setNeedsDisplay:YES];
286 
287  [[_tableViews.slice(indexPlusOne) valueForKey:"enclosingScrollView"]
288  makeObjectsPerformSelector:@selector(removeFromSuperview)];
289 
290  _tableViews = _tableViews.slice(0, indexPlusOne);
291  _tableDelegates = _tableDelegates.slice(0, indexPlusOne);
292 
293  [self _sendDelegateBrowserDidChangeLastColumn:oldValue toColumn:columnIndex];
294 
295  [self tile];
296 }
297 
299 {
300  return _tableViews.length - 1;
301 }
302 
303 - (void)addColumn
304 {
305  var lastIndex = [self lastColumn],
306  lastColumn = _tableViews[lastIndex],
307  selectionIndexes = [lastColumn selectedRowIndexes];
308 
309  if (lastIndex >= 0 && [selectionIndexes count] > 1)
310  [CPException raise:CPInvalidArgumentException
311  reason:"Can't add column, column "+lastIndex+" has invalid selection."];
312 
313  var index = lastIndex + 1,
314  item = index === 0 ? _rootItem : [_tableDelegates[lastIndex] childAtIndex:[selectionIndexes firstIndex]];
315 
316  if (index > 0 && item && [self isLeafItem:item])
317  return;
318 
319  var table = [[_tableViewClass alloc] initWithFrame:CGRectMakeZero() browser:self];
320 
321  [table setHeaderView:nil];
322  [table setCornerView:nil];
323  [table setAllowsMultipleSelection:_allowsMultipleSelection];
324  [table setAllowsEmptySelection:_allowsEmptySelection];
325  [table registerForDraggedTypes:[self registeredDraggedTypes]];
326 
327  [self _addTableColumnsToTableView:table forColumnIndex:index];
328 
329  var delegate = [[_CPBrowserTableDelegate alloc] init];
330 
331  [delegate _setDelegate:_delegate];
332  [delegate _setBrowser:self];
333  [delegate _setIndex:index];
334  [delegate _setItem:item];
335 
336  _tableViews[index] = table;
337  _tableDelegates[index] = delegate;
338 
339  [table setDelegate:delegate];
340  [table setDataSource:delegate];
341  [table setTarget:delegate];
342  [table setAction:@selector(_tableViewClicked:)];
343  [table setDoubleAction:@selector(_tableViewDoubleClicked:)];
344  [table setDraggingDestinationFeedbackStyle:CPTableViewDraggingDestinationFeedbackStyleRegular];
345 
346  var scrollView = [[_CPBrowserScrollView alloc] initWithFrame:CGRectMakeZero()];
347  [scrollView _setBrowser:self];
348  [scrollView setDocumentView:table];
349  [scrollView setHasHorizontalScroller:NO];
350  [scrollView setAutoresizingMask:CPViewHeightSizable];
351 
352  [_contentView addSubview:scrollView];
353 
354  [self tile];
355 
356  [self scrollColumnToVisible:index];
357 }
358 
359 - (void)_addTableColumnsToTableView:(CPTableView)aTableView forColumnIndex:(unsigned)index
360 {
361  if (_delegateSupportsImages)
362  {
363  var column = [[CPTableColumn alloc] initWithIdentifier:@"Image"],
364  view = [[CPImageView alloc] initWithFrame:CGRectMakeZero()];
365 
366  [view setImageScaling:CPImageScaleProportionallyDown];
367 
368  [column setDataView:view];
369  [column setResizingMask:CPTableColumnNoResizing];
370 
371  [aTableView addTableColumn:column];
372  }
373 
374  var column = [[CPTableColumn alloc] initWithIdentifier:@"Content"];
375 
376  [column setDataView:_prototypeView];
377  [column setResizingMask:CPTableColumnNoResizing];
378 
379  [aTableView addTableColumn:column];
380 
381  var column = [[CPTableColumn alloc] initWithIdentifier:@"Leaf"],
382  view = [[_CPBrowserLeafView alloc] initWithFrame:CGRectMakeZero()];
383 
384  [view setBranchImage:[self valueForThemeAttribute:@"image-control-leaf"]];
385  [view setHighlightedBranchImage:[self valueForThemeAttribute:@"image-control-leaf-pressed"]];
386 
387  [column setDataView:view];
388  [column setResizingMask:CPTableColumnNoResizing];
389 
390  [aTableView addTableColumn:column];
391 }
392 
393 - (void)reloadColumn:(CPInteger)column
394 {
395  [[self tableViewInColumn:column] reloadData];
396 }
397 
398 - (void)tile
399 {
400  var xOrigin = 0,
401  scrollerWidth = [CPScroller scrollerWidth],
402  height = CGRectGetHeight([_contentView bounds]);
403 
404  for (var i = 0, count = _tableViews.length; i < count; i++)
405  {
406  var tableView = _tableViews[i],
407  scrollView = [tableView enclosingScrollView],
408  width = [self widthOfColumn:i],
409  tableHeight = CGRectGetHeight([tableView bounds]);
410 
411  [[tableView tableColumnWithIdentifier:"Image"] setWidth:_imageWidth];
412  [[tableView tableColumnWithIdentifier:"Content"] setWidth:[self columnContentWidthForColumnWidth:width]];
413  [[tableView tableColumnWithIdentifier:"Leaf"] setWidth:_leafWidth];
414 
415  [tableView setRowHeight:_rowHeight];
416  [tableView setFrameSize:CGSizeMake(width - scrollerWidth, tableHeight)];
417  [scrollView setFrameOrigin:CGPointMake(xOrigin, 0)];
418  [scrollView setFrameSize:CGSizeMake(width, height)];
419 
420  xOrigin += width;
421  }
422 
423  [_contentView setFrameSize:CGSizeMake(xOrigin, height)];
424 }
425 
426 - (unsigned)rowAtPoint:(CGPoint)aPoint
427 {
428  var column = [self columnAtPoint:aPoint];
429  if (column === -1)
430  return -1;
431 
432  var tableView = _tableViews[column];
433  return [tableView rowAtPoint:[tableView convertPoint:aPoint fromView:self]];
434 }
435 
436 - (unsigned)columnAtPoint:(CGPoint)aPoint
437 {
438  var adjustedPoint = [_contentView convertPoint:aPoint fromView:self];
439 
440  for (var i = 0, count = _tableViews.length; i < count; i++)
441  {
442  var frame = [[_tableViews[i] enclosingScrollView] frame];
443  if (CGRectContainsPoint(frame, adjustedPoint))
444  return i;
445  }
446 
447  return -1;
448 }
449 
450 - (CGRect)rectOfRow:(unsigned)aRow inColumn:(unsigned)aColumn
451 {
452  var tableView = _tableViews[aColumn],
453  rect = [tableView rectOfRow:aRow];
454 
455  rect.origin = [self convertPoint:rect.origin fromView:tableView];
456  return rect;
457 }
458 
459 // ITEMS
460 
461 - (id)itemAtRow:(CPInteger)row inColumn:(CPInteger)column
462 {
463  return [_tableDelegates[column] childAtIndex:row];
464 }
465 
466 - (BOOL)isLeafItem:(id)item
467 {
468  return (_implementedDelegateMethods & CPBrowserDelegate_browser_isLeafItem_) && [_delegate browser:self isLeafItem:item];
469 }
470 
471 - (id)parentForItemsInColumn:(CPInteger)column
472 {
473  return [_tableDelegates[column] _item];
474 }
475 
477 {
478  var selectedColumn = [self selectedColumn],
479  selectedIndexes = [self selectedRowIndexesInColumn:selectedColumn],
480  set = [CPSet set],
481  index = [selectedIndexes firstIndex];
482 
483  while (index !== CPNotFound)
484  {
485  [set addObject:[self itemAtRow:index inColumn:selectedColumn]];
486  index = [selectedIndexes indexGreaterThanIndex:index];
487  }
488 
489  return set;
490 }
491 
493 {
494  var selectedColumn = [self selectedColumn],
495  selectedRow = [self selectedRowInColumn:selectedColumn];
496 
497  return [self itemAtRow:selectedRow inColumn:selectedColumn];
498 }
499 
500 // CLICK EVENTS
501 
502 - (void)trackMouse:(CPEvent)anEvent
503 {
504 }
505 
506 - (void)_column:(unsigned)columnIndex clickedRow:(unsigned)rowIndex
507 {
508  [self setLastColumn:columnIndex];
509 
510  if (rowIndex >= 0)
511  [self addColumn];
512 
513  [self doClick:self];
514 }
515 
516 - (void)sendAction
517 {
518  [self sendAction:_action to:_target];
519 }
520 
521 - (void)doClick:(id)sender
522 {
523  [self sendAction:_action to:_target];
524 }
525 
526 - (void)doDoubleClick:(id)sender
527 {
528  [self sendAction:_doubleAction to:_target];
529 }
530 
531 - (void)keyDown:(CPEvent)anEvent
532 {
533  var key = [anEvent charactersIgnoringModifiers],
534  column = [self selectedColumn];
535 
536  if (column === CPNotFound)
537  return;
538 
539  if (key === CPLeftArrowFunctionKey || key === CPRightArrowFunctionKey)
540  {
541  if (key === CPLeftArrowFunctionKey)
542  {
543  var previousColumn = column - 1,
544  selectedRow = [self selectedRowInColumn:previousColumn];
545 
546  [self selectRow:selectedRow inColumn:previousColumn];
547  }
548  else
549  [self selectRow:0 inColumn:column + 1];
550  }
551  else
552  [_tableViews[column] keyDown:anEvent];
553 }
554 
555 // SIZING
556 
557 - (float)columnContentWidthForColumnWidth:(float)aWidth
558 {
559  var columnSpacing = [_tableViews[0] intercellSpacing].width;
560  return aWidth - (_leafWidth + columnSpacing + (_delegateSupportsImages ? _imageWidth + columnSpacing : 0)) - columnSpacing - [CPScroller scrollerWidth];
561 }
562 
563 - (float)columnWidthForColumnContentWidth:(float)aWidth
564 {
565  var columnSpacing = [_tableViews[0] intercellSpacing].width;
566  return aWidth + (_leafWidth + columnSpacing + (_delegateSupportsImages ? _imageWidth + columnSpacing: 0)) + columnSpacing + [CPScroller scrollerWidth];
567 }
568 
569 - (void)setImageWidth:(float)aWidth
570 {
571  _imageWidth = aWidth;
572  [self tile];
573 }
574 
575 - (float)imageWidth
576 {
577  return _imageWidth;
578 }
579 
580 - (void)setMinColumnWidth:(float)minWidth
581 {
582  _minColumnWidth = minWidth;
583  [self tile];
584 }
585 
587 {
588  return _minColumnWidth;
589 }
590 
591 - (void)setWidth:(float)aWidth ofColumn:(unsigned)column
592 {
593  _columnWidths[column] = aWidth;
594 
595  [self _sendDelegateBrowserDidResizeColumn:column];
596  [self tile];
597 }
598 
599 - (float)widthOfColumn:(unsigned)column
600 {
601  var width = _columnWidths[column];
602 
603  if (width == null)
604  width = _defaultColumnWidth;
605 
606  return MAX([CPScroller scrollerWidth], MAX(_minColumnWidth, width));
607 }
608 
609 - (void)setRowHeight:(float)aHeight
610 {
611  _rowHeight = aHeight;
612 }
613 
614 - (float)rowHeight
615 {
616  return _rowHeight;
617 }
618 
619 // SCROLLERS
620 
621 - (void)scrollColumnToVisible:(unsigned)columnIndex
622 {
623  [_contentView scrollRectToVisible:[[[self tableViewInColumn:columnIndex] enclosingScrollView] frame]];
624 }
625 
626 - (void)scrollRowToVisible:(unsigned)rowIndex inColumn:(unsigned)columnIndex
627 {
628  [self scrollColumnToVisible:columnIndex];
629  [[self tableViewInColumn:columnIndex] scrollRowToVisible:rowIndex];
630 }
631 
633 {
634  return [_horizontalScrollView autohidesScrollers];
635 }
636 
637 - (void)setAutohidesScroller:(BOOL)shouldHide
638 {
639  [_horizontalScrollView setAutohidesScrollers:shouldHide];
640 }
641 
642 // SELECTION
643 
644 - (unsigned)selectedRowInColumn:(unsigned)columnIndex
645 {
646  if (columnIndex > [self lastColumn] || columnIndex < 0)
647  return -1;
648 
649  return [_tableViews[columnIndex] selectedRow];
650 }
651 
652 - (unsigned)selectedColumn
653 {
654  var column = [self lastColumn],
655  row = [self selectedRowInColumn:column];
656 
657  if (row >= 0)
658  return column;
659  else
660  return column - 1;
661 }
662 
663 - (void)selectRow:(unsigned)row inColumn:(unsigned)column
664 {
665  var selectedIndexes = row === -1 ? [CPIndexSet indexSet] : [CPIndexSet indexSetWithIndex:row];
666  [self selectRowIndexes:selectedIndexes inColumn:column];
667 }
668 
670 {
671  return _allowsMultipleSelection;
672 }
673 
674 - (void)setAllowsMultipleSelection:(BOOL)shouldAllow
675 {
676  if (_allowsMultipleSelection === shouldAllow)
677  return;
678 
679  _allowsMultipleSelection = shouldAllow;
680  [_tableViews makeObjectsPerformSelector:@selector(setAllowsMultipleSelection:) withObject:shouldAllow];
681 }
682 
684 {
685  return _allowsEmptySelection;
686 }
687 
688 - (void)setAllowsEmptySelection:(BOOL)shouldAllow
689 {
690  if (_allowsEmptySelection === shouldAllow)
691  return;
692 
693  _allowsEmptySelection = shouldAllow;
694  [_tableViews makeObjectsPerformSelector:@selector(setAllowsEmptySelection:) withObject:shouldAllow];
695 }
696 
697 - (CPIndexSet)selectedRowIndexesInColumn:(unsigned)column
698 {
699  if (column < 0 || column > [self lastColumn] +1)
700  return [CPIndexSet indexSet];
701 
702  return [[self tableViewInColumn:column] selectedRowIndexes];
703 }
704 
705 - (void)selectRowIndexes:(CPIndexSet)indexSet inColumn:(unsigned)column
706 {
707  if (column < 0 || column > [self lastColumn] + 1)
708  return;
709 
710  indexSet = [self _sendDelegateBrowserSelectionIndexesForProposedSelection:indexSet inColumn:column];
711 
712  if (![self _sendDelegateBrowserShouldSelectRowIndexes:indexSet inColumn:column])
713  return;
714 
715  [self _sendDelegateBrowserSelectionIsChanging];
716 
717  if (column > [self lastColumn])
718  [self addColumn];
719 
720  [self setLastColumn:column];
721 
722  [[self tableViewInColumn:column] selectRowIndexes:indexSet byExtendingSelection:NO];
723 
724  [self scrollColumnToVisible:column];
725 
726  [self _sendDelegateBrowserSelectionDidChange];
727 }
728 
729 - (void)setBackgroundColor:(CPColor)aColor
730 {
731  [super setBackgroundColor:aColor];
732  [_contentView setBackgroundColor:aColor];
733 }
734 
736 {
737  return YES;
738 }
739 
740 // DRAG AND DROP
741 
742 - (void)registerForDraggedTypes:(CPArray)types
743 {
744  [super registerForDraggedTypes:types];
745  [_tableViews makeObjectsPerformSelector:@selector(registerForDraggedTypes:) withObject:types];
746 }
747 
748 @end
749 
750 @implementation CPBrowser (CPCoding)
751 
752 - (id)initWithCoder:(CPCoder)aCoder
753 {
754  self = [super initWithCoder:aCoder];
755 
756  if (self)
757  {
758  [self _init];
759 
760  _allowsEmptySelection = [aCoder decodeBoolForKey:@"CPBrowserAllowsEmptySelectionKey"];
761  _allowsMultipleSelection = [aCoder decodeBoolForKey:@"CPBrowserAllowsMultipleSelectionKey"];
762  _prototypeView = [aCoder decodeObjectForKey:@"CPBrowserPrototypeViewKey"];
763  _rowHeight = [aCoder decodeFloatForKey:@"CPBrowserRowHeightKey"];
764  _imageWidth = [aCoder decodeFloatForKey:@"CPBrowserImageWidthKey"];
765  _minColumnWidth = [aCoder decodeFloatForKey:@"CPBrowserMinColumnWidthKey"];
766  _columnWidths = [aCoder decodeObjectForKey:@"CPBrowserColumnWidthsKey"];
767 
768  [self setDelegate:[aCoder decodeObjectForKey:@"CPBrowserDelegateKey"]];
769  [self setAutohidesScroller:[aCoder decodeBoolForKey:@"CPBrowserAutohidesScrollerKey"]];
770  }
771 
772  return self;
773 }
774 
775 - (void)encodeWithCoder:(CPCoder)aCoder
776 {
777  // Don't encode the subviews, they're transient and will be recreated from data.
778  var actualSubviews = _subviews;
779  _subviews = [];
780  [super encodeWithCoder:aCoder];
781  _subviews = actualSubviews;
782 
783  [aCoder encodeBool:[self autohidesScroller] forKey:@"CPBrowserAutohidesScrollerKey"];
784  [aCoder encodeBool:_allowsEmptySelection forKey:@"CPBrowserAllowsEmptySelectionKey"];
785  [aCoder encodeBool:_allowsMultipleSelection forKey:@"CPBrowserAllowsMultipleSelectionKey"];
786  [aCoder encodeObject:_delegate forKey:@"CPBrowserDelegateKey"];
787  [aCoder encodeObject:_prototypeView forKey:@"CPBrowserPrototypeViewKey"];
788  [aCoder encodeFloat:_rowHeight forKey:@"CPBrowserRowHeightKey"];
789  [aCoder encodeFloat:_imageWidth forKey:@"CPBrowserImageWidthKey"];
790  [aCoder encodeFloat:_minColumnWidth forKey:@"CPBrowserMinColumnWidthKey"];
791  [aCoder encodeObject:_columnWidths forKey:@"CPBrowserColumnWidthsKey"];
792 }
793 
794 @end
795 
796 
797 @implementation _CPBrowserResizeControl : CPView
798 {
799  CGPoint _mouseDownX;
800  CPBrowser _browser;
801  unsigned _index;
802  unsigned _width;
803 }
804 
805 - (id)initWithFrame:(CGRect)aFrame
806 {
807  if (self = [super initWithFrame:aFrame])
808  {
809  var browser = [[CPBrowser alloc] init];
810  [self setBackgroundColor:[CPColor colorWithPatternImage:[browser valueForThemeAttribute:@"image-control-resize"]]];
811  }
812 
813 
814  return self;
815 }
816 
817 - (void)mouseDown:(CPEvent)anEvent
818 {
819  _mouseDownX = [anEvent locationInWindow].x;
820  _browser = [[self superview] _browser];
821  _index = [_browser columnOfTableView:[[self superview] documentView]];
822  _width = [_browser widthOfColumn:_index];
823 }
824 
825 - (void)mouseDragged:(CPEvent)anEvent
826 {
827  var deltaX = [anEvent locationInWindow].x - _mouseDownX;
828  [_browser setWidth:_width + deltaX ofColumn:_index];
829 }
830 
831 - (void)mouseUp:(CPEvent)anEvent
832 {
833 }
834 
835 @end
836 
837 @implementation _CPBrowserScrollView : CPScrollView
838 {
839  _CPBrowserResizeControl _resizeControl;
840  CPBrowser _browser;
841 }
842 
843 - (id)initWithFrame:(CGRect)aFrame
844 {
845  if (self = [super initWithFrame:aFrame])
846  {
847  _resizeControl = [[_CPBrowserResizeControl alloc] initWithFrame:CGRectMakeZero()];
848  [self addSubview:_resizeControl];
849  }
850 
851  return self;
852 }
853 
854 - (void)reflectScrolledClipView:(CPClipView)aClipView
855 {
856  [super reflectScrolledClipView:aClipView];
857 
858  var frame = [_verticalScroller frame];
859  frame.size.height = CGRectGetHeight([self bounds]) - 14.0 - frame.origin.y;
860  [_verticalScroller setFrameSize:frame.size];
861 
862  var resizeFrame = CGRectMake(CGRectGetMinX(frame), CGRectGetMaxY(frame), [CPScroller scrollerWidth], 14.0);
863  [_resizeControl setFrame:resizeFrame];
864 }
865 
866 @end
867 
868 @implementation _CPBrowserTableView : CPTableView
869 {
870  CPBrowser _browser;
871 }
872 
873 - (id)initWithFrame:(CGRect)aFrame browser:(CPBrowser)aBrowser
874 {
875  if (self = [super initWithFrame:aFrame])
876  _browser = aBrowser;
877 
878  return self;
879 }
880 
881 - (BOOL)acceptsFirstResponder
882 {
883  return NO;
884 }
885 
886 - (void)mouseDown:(CPEvent)anEvent
887 {
888  [super mouseDown:anEvent];
889  [[self window] makeFirstResponder:_browser];
890 }
891 
892 - (CPView)browserView
893 {
894  return _browser;
895 }
896 
900 - (BOOL)_isFocused
901 {
902  return ([super _isFocused] || [_browser tableViewInColumn:[_browser selectedColumn]] === self);
903 }
904 
905 - (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes atPoint:(CGPoint)mouseDownPoint
906 {
907  return [_browser canDragRowsWithIndexes:rowIndexes inColumn:[_browser columnOfTableView:self] withEvent:[CPApp currentEvent]];
908 }
909 
910 - (CPImage)dragImageForRowsWithIndexes:(CPIndexSet)dragRows tableColumns:(CPArray)theTableColumns event:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset
911 {
912  return [_browser draggingImageForRowsWithIndexes:dragRows inColumn:[_browser columnOfTableView:self] withEvent:dragEvent offset:dragImageOffset] ||
913  [super dragImageForRowsWithIndexes:dragRows tableColumns:theTableColumns event:dragEvent offset:dragImageOffset];
914 }
915 
916 - (CPView)dragViewForRowsWithIndexes:(CPIndexSet)dragRows tableColumns:(CPArray)theTableColumns event:(CPEvent)dragEvent offset:(CGPoint)dragViewOffset
917 {
918  var count = theTableColumns.length;
919  while (count--)
920  {
921  if ([theTableColumns[count] identifier] === "Leaf")
922  [theTableColumns removeObject:theTableColumns[count]];
923  }
924 
925  return [_browser draggingViewForRowsWithIndexes:dragRows inColumn:[_browser columnOfTableView:self] withEvent:dragEvent offset:dragViewOffset] ||
926  [super dragViewForRowsWithIndexes:dragRows tableColumns:theTableColumns event:dragEvent offset:dragViewOffset];
927 }
928 
929 
930 @end
931 
932 @implementation _CPBrowserTableDelegate : CPObject
933 {
934  CPBrowser _browser;
935  unsigned _index;
936  id _delegate;
937  id _item;
938 }
939 
940 - (unsigned)numberOfRowsInTableView:(CPTableView)aTableView
941 {
942  return [_delegate browser:_browser numberOfChildrenOfItem:_item];
943 }
944 
945 - (void)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)column row:(unsigned)row
946 {
947  if ([column identifier] === "Image")
948  return [_delegate browser:_browser imageValueForItem:[self childAtIndex:row]];
949  else if ([column identifier] === "Leaf")
950  return ![_browser isLeafItem:[self childAtIndex:row]];
951  else
952  return [_delegate browser:_browser objectValueForItem:[self childAtIndex:row]];
953 }
954 
955 - (void)_tableViewDoubleClicked:(CPTableView)aTableView
956 {
957  [_browser doDoubleClick:self];
958 }
959 
960 - (void)_tableViewClicked:(CPTableView)aTableView
961 {
962  var selectedIndexes = [aTableView selectedRowIndexes];
963  [_browser _column:_index clickedRow:[selectedIndexes count] === 1 ? [selectedIndexes firstIndex] : -1];
964 }
965 
966 - (void)tableViewSelectionDidChange:(CPNotification)aNotification
967 {
968  var selectedIndexes = [[aNotification object] selectedRowIndexes];
969  [_browser selectRowIndexes:selectedIndexes inColumn:_index];
970 }
971 
972 - (id)childAtIndex:(CPUInteger)index
973 {
974  return [_delegate browser:_browser child:index ofItem:_item];
975 }
976 
977 - (BOOL)tableView:(CPTableView)aTableView acceptDrop:(id)info row:(CPInteger)row dropOperation:(CPTableViewDropOperation)operation
978 {
979  if (_browser._implementedDelegateMethods & CPBrowserDelegate_browser_acceptDrop_atRow_column_dropOperation_)
980  return [_delegate browser:_browser acceptDrop:info atRow:row column:_index dropOperation:operation];
981  else
982  return NO;
983 }
984 
985 - (CPDragOperation)tableView:(CPTableView)aTableView validateDrop:(id)info proposedRow:(CPInteger)row proposedDropOperation:(CPTableViewDropOperation)operation
986 {
987  if (_browser._implementedDelegateMethods & CPBrowserDelegate_browser_validateDrop_proposedRow_column_dropOperation_)
988  return [_delegate browser:_browser validateDrop:info proposedRow:row column:_index dropOperation:operation];
989  else
990  return CPDragOperationNone;
991 }
992 
993 - (BOOL)tableView:(CPTableView)aTableView writeRowsWithIndexes:(CPIndexSet)rowIndexes toPasteboard:(CPPasteboard)pboard
994 {
995  if (_browser._implementedDelegateMethods & CPBrowserDelegate_browser_writeRowsWithIndexes_inColumn_toPasteboard_)
996  return [_delegate browser:_browser writeRowsWithIndexes:rowIndexes inColumn:_index toPasteboard:pboard];
997  else
998  return NO;
999 }
1000 
1001 - (BOOL)respondsToSelector:(SEL)aSelector
1002 {
1003  if (aSelector === @selector(browser:writeRowsWithIndexes:inColumn:toPasteboard:))
1004  return [_delegate respondsToSelector:@selector(browser:writeRowsWithIndexes:inColumn:toPasteboard:)];
1005  else
1006  return [super respondsToSelector:aSelector];
1007 }
1008 
1009 @end
1010 
1011 @implementation _CPBrowserLeafView : CPView
1012 {
1013  BOOL _isLeaf;
1014  CPImage _branchImage;
1015  CPImage _highlightedBranchImage;
1016 }
1017 
1018 - (BOOL)objectValue
1019 {
1020  return _isLeaf;
1021 }
1022 
1023 - (void)setObjectValue:(id)aValue
1024 {
1025  _isLeaf = !!aValue;
1026  [self setNeedsLayout];
1027 }
1028 
1029 - (CGRect)rectForEphemeralSubviewNamed:(CPString)aName
1030 {
1031  if (aName === "image-view")
1032  return CGRectInset([self bounds], 1, 1);
1033 
1034  return [super rectForEphemeralSubviewNamed:aName];
1035 }
1036 
1037 - (CPView)createEphemeralSubviewNamed:(CPString)aName
1038 {
1039  if (aName === "image-view")
1040  return [[CPImageView alloc] initWithFrame:CGRectMakeZero()];
1041 
1042  return [super createEphemeralSubviewNamed:aName];
1043 }
1044 
1045 - (void)layoutSubviews
1046 {
1047  var imageView = [self layoutEphemeralSubviewNamed:@"image-view"
1048  positioned:CPWindowAbove
1050  isHighlighted = [self hasThemeState:CPThemeStateSelectedDataView];
1051 
1052  [imageView setImage: _isLeaf ? (isHighlighted ? _highlightedBranchImage : _branchImage) : nil];
1053  [imageView setImageScaling:CPImageScaleNone];
1054 }
1055 
1056 - (void)encodeWithCoder:(CPCoder)aCoder
1057 {
1058  [super encodeWithCoder:aCoder];
1059 
1060  [aCoder encodeBool:_isLeaf forKey:"_CPBrowserLeafViewIsLeafKey"];
1061  [aCoder encodeObject:_branchImage forKey:"_CPBrowserLeafViewBranchImageKey"];
1062  [aCoder encodeObject:_highlightedBranchImage forKey:"_CPBrowserLeafViewHighlightedBranchImageKey"];
1063 }
1064 
1065 - (id)initWithCoder:(CPCoder)aCoder
1066 {
1067  if (self = [super initWithCoder:aCoder])
1068  {
1069  _isLeaf = [aCoder decodeBoolForKey:"_CPBrowserLeafViewIsLeafKey"];
1070  _branchImage = [aCoder decodeObjectForKey:"_CPBrowserLeafViewBranchImageKey"];
1071  _highlightedBranchImage = [aCoder decodeObjectForKey:"_CPBrowserLeafViewHighlightedBranchImageKey"];
1072  }
1073 
1074  return self;
1075 }
1076 
1077 @end
1078 
1080 
1085 - (id)_sendDelegateRootItemForBrowser
1086 {
1087  if (!(_implementedDelegateMethods & CPBrowserDelegate_rootItemForBrowser_))
1088  return nil;
1089 
1090  return [_delegate rootItemForBrowser:self];
1091 }
1092 
1097 - (void)_sendDelegateBrowserDidChangeLastColumn:(CPInteger)lastColumn toColumn:(CPInteger)newColumn
1098 {
1099  if (!(_implementedDelegateMethods & CPBrowserDelegate_browser_didChangeLastColumn_toColumn_))
1100  return;
1101 
1102  [_delegate browser:self didChangeLastColumn:lastColumn toColumn:newColumn];
1103 }
1104 
1109 - (void)_sendDelegateBrowserDidResizeColumn:(CPInteger)column
1110 {
1111  if (!(_implementedDelegateMethods & CPBrowserDelegate_browser_didResizeColumn_))
1112  return;
1113 
1114  [_delegate browser:self didResizeColumn:column];
1115 }
1116 
1121 - (void)_sendDelegateBrowserSelectionIsChanging
1122 {
1123  if (!(_implementedDelegateMethods & CPBrowserDelegate_browserSelectionIsChanging_))
1124  return;
1125 
1126  [_delegate browserSelectionIsChanging:self];
1127 }
1128 
1133 - (BOOL)_sendDelegateBrowserShouldSelectRowIndexes:(CPIndexSet)anIndexSet inColumn:(CPInteger)aColumn
1134 {
1135  if (!(_implementedDelegateMethods & CPBrowserDelegate_browser_shouldSelectRowIndexes_inColumn_))
1136  return YES;
1137 
1138  return [_delegate browser:self shouldSelectRowIndexes:anIndexSet inColumn:aColumn];
1139 }
1140 
1145 - (CPIndexSet)_sendDelegateBrowserSelectionIndexesForProposedSelection:(CPIndexSet)anIndexSet inColumn:(CPInteger)aColumn
1146 {
1148  return anIndexSet;
1149 
1150  return [_delegate browser:self selectionIndexesForProposedSelection:anIndexSet inColumn:aColumn];
1151 }
1152 
1157 - (void)_sendDelegateBrowserSelectionDidChange
1158 {
1159  if (!(_implementedDelegateMethods & CPBrowserDelegate_browserSelectionDidChange_))
1160  return;
1161 
1162  [_delegate browserSelectionDidChange:self];
1163 }
1164 
1165 - (BOOL)canDragRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent
1166 {
1168  return [_delegate browser:self canDragRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent];
1169 
1170  return YES;
1171 }
1172 
1173 - (CPImage)draggingImageForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset
1174 {
1176  return [_delegate browser:self draggingImageForRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent offset:dragImageOffset];
1177 
1178  return nil;
1179 }
1180 
1181 - (CPView)draggingViewForRowsWithIndexes:(CPIndexSet)rowIndexes inColumn:(CPInteger)columnIndex withEvent:(CPEvent)dragEvent offset:(CGPoint)dragImageOffset
1182 {
1184  return [_delegate browser:self draggingViewForRowsWithIndexes:rowIndexes inColumn:columnIndex withEvent:dragEvent offset:dragImageOffset];
1185 
1186  return nil;
1187 }
1188 
1189 @end
1190 
1192 
1197 {
1198  return _doubleAction;
1199 }
1200 
1204 - (void)setDoubleAction:(SEL)aValue
1205 {
1206  _doubleAction = aValue;
1207 }
1208 
1213 {
1214  return _tableViewClass;
1215 }
1216 
1220 - (void)setTableViewClass:(Class)aValue
1221 {
1222  _tableViewClass = aValue;
1223 }
1224 
1229 {
1230  return _defaultColumnWidth;
1231 }
1232 
1236 - (void)setDefaultColumnWidth:(float)aValue
1237 {
1238  _defaultColumnWidth = aValue;
1239 }
1240 
1241 @end
var CPBrowserDelegate_browser_draggingViewForRowsWithIndexes_inColumn_withEvent_offset_
Definition: CPBrowser.j:63
Used to implement exception handling (creating & raising).
Definition: CPException.h:2
var CPBrowserDelegate_browser_didChangeLastColumn_toColumn_
Definition: CPBrowser.j:67
CPView prototypeView()
Definition: CPBrowser.j:173
BOOL makeFirstResponder:(CPResponder aResponder)
Definition: CPWindow.j:1617
BOOL allowsMultipleSelection()
Definition: CPBrowser.j:669
void setDelegate:(id< CPBrowserDelegate > anObject)
Definition: CPBrowser.j:179
void selectRowIndexes:inColumn:(CPIndexSet indexSet, [inColumn] unsigned column)
Definition: CPBrowser.j:705
var CPBrowserDelegate_browser_selectionIndexesForProposedSelection_inColumn_
Definition: CPBrowser.j:61
BOOL isHighlighted()
Definition: CPControl.j:1001
void doClick:(id sender)
Definition: CPBrowser.j:521
void addColumn()
Definition: CPBrowser.j:303
CPIndexSet selectedRowIndexes()
Definition: CPTableView.j:1490
void addSubview:(CPView aSubview)
Definition: CPView.j:512
A CALayer is similar to a CPView
Definition: CALayer.j:46
void layoutSubviews()
Definition: CPView.j:2765
FrameUpdater prototype identifier
float minColumnWidth()
Definition: CPBrowser.j:586
CPString defaultThemeClass()
Definition: CPBrowser.j:108
void setAutohidesScroller:(BOOL shouldHide)
Definition: CPBrowser.j:637
var CPBrowserDelegate_browser_objectValueForItem_
Definition: CPBrowser.j:65
An object representation of nil.
Definition: CPNull.h:2
void setLastColumn:(CPInteger columnIndex)
Definition: CPBrowser.j:274
int columnIndex
Definition: CPTableView.j:6308
float scrollerWidth()
Definition: CPScroller.j:124
CPDragOperation CPDragOperationNone
id itemAtRow:inColumn:(CPInteger row, [inColumn] CPInteger column)
Definition: CPBrowser.j:461
id delegate()
Definition: CPBrowser.j:251
CPRightArrowFunctionKey
void reloadData()
Definition: CPTableView.j:599
CPColor colorWithPatternImage:(CPImage anImage)
Definition: CPColor.j:481
BOOL autohidesScroller()
Definition: CPBrowser.j:632
unsigned selectedColumn()
Definition: CPBrowser.j:652
int lastColumn()
Definition: CPBrowser.j:298
CGPoint locationInWindow()
Definition: CPEvent.j:290
CPSet selectedItems()
Definition: CPBrowser.j:476
CPColor whiteColor()
Definition: CPColor.j:360
int width
var CPBrowserDelegate_browserSelectionDidChange_
Definition: CPBrowser.j:70
CGRect bounds()
Definition: CPView.j:1302
void raise:reason:(CPString aName, [reason] CPString aReason)
Definition: CPException.j:66
CPArray registeredDraggedTypes()
Definition: CPView.j:2441
A collection of unique integers.
Definition: CPIndexSet.h:2
CPString charactersIgnoringModifiers()
Definition: CPEvent.j:392
Unarchives objects created using CPKeyedArchiver.
var CPBrowserDelegate_rootItemForBrowser_
Definition: CPBrowser.j:66
A mutable key-value pair collection.
Definition: CPDictionary.h:2
CPScrollView enclosingScrollView()
Definition: CPView.j:2928
BOOL allowsEmptySelection()
Definition: CPBrowser.j:683
var CPBrowserDelegate_browserSelectionIsChanging_
Definition: CPBrowser.j:69
var CPBrowserDelegate_browser_draggingImageForRowsWithIndexes_inColumn_withEvent_offset_
Definition: CPBrowser.j:59
CPWindow window()
Definition: CPView.j:503
void selectRowIndexes:byExtendingSelection:(CPIndexSet rows, [byExtendingSelection] BOOL shouldExtendSelection)
Definition: CPTableView.j:1365
void addTableColumn:(CPTableColumn aTableColumn)
Definition: CPTableView.j:1077
CPDictionary themeAttributes()
Definition: CPBrowser.j:113
var CPBrowserDelegate_browser_shouldSelectRowIndexes_inColumn_
Definition: CPBrowser.j:55
CPView createEphemeralSubviewNamed:(CPString aViewName)
Definition: CPView.j:3356
Implements keyed archiving of object graphs (e.g. for storing data).
float widthOfColumn:(unsigned column)
Definition: CPBrowser.j:599
An immutable string (collection of characters).
Definition: CPString.h:2
CPNull null()
Definition: CPNull.j:51
id selectedItem()
Definition: CPBrowser.j:492
CGPoint convertPoint:fromView:(CGPoint aPoint, [fromView] CPView aView)
Definition: CPView.j:2208
Definition: CPImage.h:2
void mouseDown:(CPEvent anEvent)
Definition: CPControl.j:496
var CPBrowserDelegate_browser_acceptDrop_atRow_column_dropOperation_
Definition: CPBrowser.j:52
unsigned selectedRowInColumn:(unsigned columnIndex)
Definition: CPBrowser.j:644
BOOL sendAction:to:(SEL anAction, [to] id anObject)
Definition: CPControl.j:319
var CPBrowserDelegate_browser_numberOfChildrenOfItem_
Definition: CPBrowser.j:62
id initWithCoder:(CPCoder aCoder)
Definition: CPControl.j:1085
BOOL acceptsFirstResponder()
Definition: CPBrowser.j:735
var CPBrowserDelegate_browser_didResizeColumn_
Definition: CPBrowser.j:68
CPTableView tableView
Definition: CPTableView.j:6194
var CPBrowserDelegate_browser_isLeafItem_
Definition: CPBrowser.j:54
CPLeftArrowFunctionKey
A notification that can be posted to a CPNotificationCenter.
Definition: CPNotification.h:2
CPTableView tableViewInColumn:(unsigned index)
Definition: CPBrowser.j:256
void setNeedsLayout()
Definition: CPView.j:2707
float rowHeight()
Definition: CPBrowser.j:614
void loadColumnZero()
Definition: CPBrowser.j:266
void scrollColumnToVisible:(unsigned columnIndex)
Definition: CPBrowser.j:621
var CPBrowserDelegate_browser_imageValueForItem_
Definition: CPBrowser.j:58
var CPBrowserDelegate_browser_canDragRowsWithIndexes_inColumn_withEvent_
Definition: CPBrowser.j:53
Defines methods for use when archiving & restoring (enc/decoding).
Definition: CPCoder.h:2
float imageWidth()
Definition: CPBrowser.j:575
CPNotFound
Definition: CPObjJRuntime.j:62
unsigned columnAtPoint:(CGPoint aPoint)
Definition: CPBrowser.j:436
id unarchiveObjectWithData:(CPData aData)
void setBackgroundColor:(CPColor aColor)
Definition: CPView.j:1923
var CPBrowserDelegate_browser_validateDrop_proposedRow_column_dropOperation_
Definition: CPBrowser.j:57
void selectRow:inColumn:(unsigned row, [inColumn] unsigned column)
Definition: CPBrowser.j:663
void tile()
Definition: CPBrowser.j:398
Definition: CPEvent.h:2
CPView superview()
Definition: CPView.j:486
CPIndexSet selectedRowIndexesInColumn:(unsigned column)
Definition: CPBrowser.j:697
var CPBrowserDelegate_browser_child_ofItem_
Definition: CPBrowser.j:64
CGRect frame()
Definition: CPView.j:1022
void scrollRowToVisible:(int rowIndex)
Definition: CPTableView.j:2497
void setBackgroundColor:(CPColor aColor)
Definition: CPBrowser.j:729
id indexSetWithIndex:(int anIndex)
Definition: CPIndexSet.j:51
void encodeWithCoder:(CPCoder aCoder)
Definition: CPControl.j:1114
id objectValue()
Definition: CPControl.j:526
id indexSet()
Definition: CPIndexSet.j:43
void sendAction()
Definition: CPBrowser.j:516
CPView layoutEphemeralSubviewNamed:positioned:relativeToEphemeralSubviewNamed:(CPString aViewName, [positioned] CPWindowOrderingMode anOrderingMode, [relativeToEphemeralSubviewNamed] CPString relativeToViewName)
Definition: CPView.j:3366
void registerForDraggedTypes:(CPArray pasteboardTypes)
Definition: CPView.j:2423
id alloc()
Definition: CPObject.j:130
CGRect rectForEphemeralSubviewNamed:(CPString aViewName)
Definition: CPView.j:3361
Definition: CPView.j:136
void reflectScrolledClipView:(CPClipView aClipView)
Definition: CPView.j:2954
CPData archivedDataWithRootObject:(id anObject)
float columnContentWidthForColumnWidth:(float aWidth)
Definition: CPBrowser.j:557
var CPBrowserDelegate_browser_writeRowsWithIndexes_inColumn_toPasteboard_
Definition: CPBrowser.j:56