Annotation of chimera/BookmarksService.h, revision 1.7

1.1       hyatt       1: /*
                      2:  *  BookmarksService.h
                      3:  *  Chimera
                      4:  *
                      5:  *  Created by David Hyatt on Thu Feb 07 2002.
                      6:  *  Copyright (c) 2001 __MyCompanyName__. All rights reserved.
                      7:  *
                      8:  */
                      9: 
                     10: #include <Appkit/Appkit.h>
                     11: #include <Carbon/Carbon.h>
                     12: #include "nsCOMPtr.h"
                     13: #include "nsIDocument.h"
1.3       hyatt      14: #include "nsIDocumentObserver.h"
1.4       hyatt      15: #include "nsVoidArray.h"
1.7     ! hyatt      16: #import "MainController.h"
1.1       hyatt      17: 
                     18: class BookmarksService;
                     19: class nsIAtom;
                     20: 
                     21: @interface BookmarksDataSource : NSObject
                     22: {
                     23:     BookmarksService* mBookmarks;
                     24:     IBOutlet id mOutlineView;
                     25:     IBOutlet id mBrowserView;
1.2       hyatt      26:     IBOutlet id mAddButton;
                     27:     IBOutlet id mDeleteButton;
1.1       hyatt      28: }
                     29: 
                     30: -(id) init;
                     31: -(void) dealloc;
1.4       hyatt      32: -(void) windowClosing;
1.1       hyatt      33: 
                     34: -(void) ensureBookmarks;
1.2       hyatt      35: 
                     36: -(IBAction)addBookmark:(id)aSender;
                     37: -(IBAction)deleteBookmark: (id)aSender;
1.1       hyatt      38: 
                     39: // Datasource methods.
                     40: - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
                     41: - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
                     42: - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
                     43: - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
                     44: - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
                     45: 
1.4       hyatt      46: - (void)reloadDataForItem:(id)item reloadChildren: (BOOL)aReloadChildren;
                     47: 
1.1       hyatt      48: @end
                     49: 
                     50: @interface BookmarkItem : NSObject
                     51: {
                     52:     nsIContent* mContentNode;
                     53: }
                     54: 
                     55: -(nsIContent*)contentNode;
                     56: -(void)setContentNode: (nsIContent*)aContentNode;
1.6       hyatt      57: - (id)copyWithZone:(NSZone *)aZone;
1.1       hyatt      58: @end
                     59: 
1.4       hyatt      60: class BookmarksService
1.1       hyatt      61: {
                     62: public:
1.4       hyatt      63:     BookmarksService(BookmarksDataSource* aDataSource);
1.3       hyatt      64:     virtual ~BookmarksService();
1.1       hyatt      65:     
1.3       hyatt      66:     void AddObserver();
                     67:     void RemoveObserver();
                     68: 
1.4       hyatt      69:     void NotifyObserver(nsIContent* aContainer, PRBool aReloadChildren);
                     70:     static void NotifyObservers(nsIContent* aContainer, PRBool aReloadChildren);
                     71: 
1.3       hyatt      72: public:
1.6       hyatt      73:     static void GetRootContent(nsIContent** aResult);
1.3       hyatt      74:     static BookmarkItem* GetWrapperFor(nsIContent* aItem);
1.5       hyatt      75:     static void FlushBookmarks();
1.1       hyatt      76:     
1.6       hyatt      77:     static void ConstructBookmarksMenu(NSMenu* aMenu, nsIContent* aContent);
1.7     ! hyatt      78:     static void OpenMenuBookmark(BrowserWindowController* aController, id aMenuItem);
1.6       hyatt      79:     
1.1       hyatt      80: private:
1.3       hyatt      81:     // Global counter and pointers to our singletons.
1.1       hyatt      82:     static PRUint32 gRefCnt;
1.6       hyatt      83:     
                     84:     // A dictionary that maps from content IDs (which uniquely identify content nodes)
                     85:     // to Obj-C bookmarkItem objects.  These objects are handed back to UI elements like
                     86:     // the outline view.
1.3       hyatt      87:     static NSMutableDictionary* gDictionary;
1.7     ! hyatt      88:         
1.1       hyatt      89: public:
1.7     ! hyatt      90:     static MainController* gMainController;
1.1       hyatt      91:     static nsIAtom* gFolderAtom;
                     92:     static nsIAtom* gNameAtom;
                     93:     static nsIAtom* gHrefAtom;
                     94:     static nsIAtom* gBookmarkAtom;
1.4       hyatt      95:     static nsIDocument* gBookmarks;
                     96:     static nsVoidArray* gInstances;
1.7     ! hyatt      97:         
1.4       hyatt      98: private:
                     99:     BookmarksDataSource* mDataSource;
1.1       hyatt     100: };

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>