OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #import <Cocoa/Cocoa.h> |
| 6 #include <vector> |
| 7 |
| 8 @class BookmarkManagerController; |
| 9 class BookmarkModel; |
| 10 class BookmarkNode; |
| 11 |
| 12 |
| 13 // Controller for the bookmark tree view (the right pane). |
| 14 @interface BookmarkTreeController : NSObject { |
| 15 @private |
| 16 IBOutlet NSOutlineView* outline_; |
| 17 IBOutlet BookmarkManagerController* manager_; |
| 18 id group_; |
| 19 std::vector<const BookmarkNode*> draggedNodes_; |
| 20 } |
| 21 |
| 22 // The top-level bookmark folder used as the root of the outline's tree. |
| 23 // Observable, bindable. |
| 24 @property (assign) id group; |
| 25 // The currently selected item(s) in the outline. (Not observable.) |
| 26 @property (retain) NSArray* selectedItems; |
| 27 |
| 28 // Action for the Delete command; also invoked by the delete key. |
| 29 - (IBAction)delete:(id)sender; |
| 30 |
| 31 // Maps BookmarkNodes to NSOutlineView items. Equivalent to the method on |
| 32 // BookmarkManagerController except that it maps the root node to nil. |
| 33 - (id)itemFromNode:(const BookmarkNode*)node; |
| 34 |
| 35 // Maps NSOutlineView items back to BookmarkNodes. Equivalent to the method on |
| 36 // BookmarkManagerController except that it maps nil back to the root node. |
| 37 - (const BookmarkNode*)nodeFromItem:(id)item; |
| 38 |
| 39 // Called by the BookmarkManagerController to notify the data model's changed. |
| 40 - (void)itemChanged:(id)nodeItem childrenChanged:(BOOL)childrenChanged; |
| 41 |
| 42 @end |
| 43 |
| 44 |
| 45 // Drag/drop and copy/paste methods |
| 46 // (These are implemented in bookmark_tree_controller_paste.mm.) |
| 47 @interface BookmarkTreeController (Pasteboard) |
| 48 // One-time drag-n-drop setup; called from -awakeFromNib. |
| 49 - (void)registerDragTypes; |
| 50 - (IBAction)cut:(id)sender; |
| 51 - (IBAction)copy:(id)sender; |
| 52 - (IBAction)paste:(id)sender; |
| 53 @end |
| 54 |
| 55 |
| 56 // Exposed only for unit tests. |
| 57 @interface BookmarkTreeController (UnitTesting) |
| 58 |
| 59 - (BOOL)copyToPasteboard:(NSPasteboard*)pb; |
| 60 - (BOOL)pasteFromPasteboard:(NSPasteboard*)pb; |
| 61 @property (readonly) NSOutlineView* outline; |
| 62 |
| 63 @end |
| 64 |
| 65 |
| 66 // Outline view for bookmark tree; handles Cut/Copy/Paste and Delete key. |
| 67 @interface BookmarksOutlineView : NSOutlineView |
| 68 @end |
OLD | NEW |