Annotation of chimera/BookmarksService.h, revision 1.6

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.1       hyatt      16: 
                     17: class BookmarksService;
                     18: class nsIAtom;
                     19: 
                     20: @interface BookmarksDataSource : NSObject
                     21: {
                     22:     BookmarksService* mBookmarks;
                     23:     IBOutlet id mOutlineView;
                     24:     IBOutlet id mBrowserView;
1.2       hyatt      25:     IBOutlet id mAddButton;
                     26:     IBOutlet id mDeleteButton;
1.1       hyatt      27: }
                     28: 
                     29: -(id) init;
                     30: -(void) dealloc;
1.4       hyatt      31: -(void) windowClosing;
1.1       hyatt      32: 
                     33: -(void) ensureBookmarks;
1.2       hyatt      34: 
                     35: -(IBAction)addBookmark:(id)aSender;
                     36: -(IBAction)deleteBookmark: (id)aSender;
1.1       hyatt      37: 
                     38: // Datasource methods.
                     39: - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
                     40: - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
                     41: - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
                     42: - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
                     43: - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
                     44: 
1.4       hyatt      45: - (void)reloadDataForItem:(id)item reloadChildren: (BOOL)aReloadChildren;
                     46: 
1.1       hyatt      47: @end
                     48: 
                     49: @interface BookmarkItem : NSObject
                     50: {
                     51:     nsIContent* mContentNode;
                     52: }
                     53: 
                     54: -(nsIContent*)contentNode;
                     55: -(void)setContentNode: (nsIContent*)aContentNode;
1.6     ! hyatt      56: - (id)copyWithZone:(NSZone *)aZone;
1.1       hyatt      57: @end
                     58: 
1.4       hyatt      59: class BookmarksService
1.1       hyatt      60: {
                     61: public:
1.4       hyatt      62:     BookmarksService(BookmarksDataSource* aDataSource);
1.3       hyatt      63:     virtual ~BookmarksService();
1.1       hyatt      64:     
1.3       hyatt      65:     void AddObserver();
                     66:     void RemoveObserver();
                     67: 
1.4       hyatt      68:     void NotifyObserver(nsIContent* aContainer, PRBool aReloadChildren);
                     69:     static void NotifyObservers(nsIContent* aContainer, PRBool aReloadChildren);
                     70: 
1.3       hyatt      71: public:
1.6     ! hyatt      72:     static void GetRootContent(nsIContent** aResult);
1.3       hyatt      73:     static BookmarkItem* GetWrapperFor(nsIContent* aItem);
1.5       hyatt      74:     static void FlushBookmarks();
1.1       hyatt      75:     
1.6     ! hyatt      76:     static void ConstructBookmarksMenu(NSMenu* aMenu, nsIContent* aContent);
        !            77:     
1.1       hyatt      78: private:
1.3       hyatt      79:     // Global counter and pointers to our singletons.
1.1       hyatt      80:     static PRUint32 gRefCnt;
1.6     ! hyatt      81:     
        !            82:     // A dictionary that maps from content IDs (which uniquely identify content nodes)
        !            83:     // to Obj-C bookmarkItem objects.  These objects are handed back to UI elements like
        !            84:     // the outline view.
1.3       hyatt      85:     static NSMutableDictionary* gDictionary;
1.6     ! hyatt      86:     
        !            87:     // Dictionaries that map from menus to bookmark items and vice versa.  We use these dictionaries
        !            88:     // to look up the content node that a menu or menu item represents and vice versa.
        !            89:     static NSMutableDictionary* gMenuToBookmarkMap;
        !            90:     static NSMutableDictionary* gBookmarkToMenuMap;
1.3       hyatt      91:     
1.1       hyatt      92: public:
                     93:     static nsIAtom* gFolderAtom;
                     94:     static nsIAtom* gNameAtom;
                     95:     static nsIAtom* gHrefAtom;
                     96:     static nsIAtom* gBookmarkAtom;
1.4       hyatt      97:     static nsIDocument* gBookmarks;
                     98:     static nsVoidArray* gInstances;
                     99:     
                    100: private:
                    101:     BookmarksDataSource* mDataSource;
1.1       hyatt     102: };

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