File:  [mozdev] / chimera / BookmarksService.h
Revision 1.4: download - view: text, annotated - select for diffs - revision graph
Sat Feb 9 08:12:33 2002 UTC (18 years, 3 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Adding bookmarks works.

    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"
   14: #include "nsIDocumentObserver.h"
   15: #include "nsVoidArray.h"
   16: 
   17: class BookmarksService;
   18: class nsIAtom;
   19: 
   20: @interface BookmarksDataSource : NSObject
   21: {
   22:     BookmarksService* mBookmarks;
   23:     IBOutlet id mOutlineView;
   24:     IBOutlet id mBrowserView;
   25:     IBOutlet id mAddButton;
   26:     IBOutlet id mDeleteButton;
   27: }
   28: 
   29: -(id) init;
   30: -(void) dealloc;
   31: -(void) windowClosing;
   32: 
   33: -(void) ensureBookmarks;
   34: 
   35: -(IBAction)addBookmark:(id)aSender;
   36: -(IBAction)deleteBookmark: (id)aSender;
   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: 
   45: - (void)reloadDataForItem:(id)item reloadChildren: (BOOL)aReloadChildren;
   46: 
   47: @end
   48: 
   49: @interface BookmarkItem : NSObject
   50: {
   51:     nsIContent* mContentNode;
   52: }
   53: 
   54: -(nsIContent*)contentNode;
   55: -(void)setContentNode: (nsIContent*)aContentNode;
   56: @end
   57: 
   58: class BookmarksService
   59: {
   60: public:
   61:     BookmarksService(BookmarksDataSource* aDataSource);
   62:     virtual ~BookmarksService();
   63:     
   64:     void AddObserver();
   65:     void RemoveObserver();
   66: 
   67:     void NotifyObserver(nsIContent* aContainer, PRBool aReloadChildren);
   68:     static void NotifyObservers(nsIContent* aContainer, PRBool aReloadChildren);
   69: 
   70: public:
   71:     void GetRootContent(nsIContent** aResult);
   72:     static BookmarkItem* GetWrapperFor(nsIContent* aItem);
   73:     
   74: private:
   75:     // Global counter and pointers to our singletons.
   76:     static PRUint32 gRefCnt;
   77:     static NSMutableDictionary* gDictionary;
   78:     
   79: public:
   80:     static nsIAtom* gFolderAtom;
   81:     static nsIAtom* gNameAtom;
   82:     static nsIAtom* gHrefAtom;
   83:     static nsIAtom* gBookmarkAtom;
   84:     static nsIDocument* gBookmarks;
   85:     static nsVoidArray* gInstances;
   86:     
   87: private:
   88:     BookmarksDataSource* mDataSource;
   89: };

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