File:  [mozdev] / chimera / BookmarksService.h
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Sat Feb 9 00:00:47 2002 UTC (18 years, 3 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Bookmarks work! Update your Mozilla tree though or chimera won't build.

    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: 
   15: class nsIDocumentObserver;
   16: class BookmarksService;
   17: class nsIAtom;
   18: 
   19: @interface BookmarksDataSource : NSObject
   20: {
   21:     BookmarksService* mBookmarks;
   22:     IBOutlet id mOutlineView;
   23:     IBOutlet id mBrowserView;
   24: }
   25: 
   26: -(id) init;
   27: -(void) dealloc;
   28: 
   29: -(void) ensureBookmarks;
   30: 
   31: // Datasource methods.
   32: - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
   33: - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
   34: - (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
   35: - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
   36: - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
   37: 
   38: @end
   39: 
   40: @interface BookmarkItem : NSObject
   41: {
   42:     nsIContent* mContentNode;
   43: }
   44: 
   45: -(nsIContent*)contentNode;
   46: -(void)setContentNode: (nsIContent*)aContentNode;
   47: @end
   48: 
   49: class BookmarksService
   50: {
   51: public:
   52:     BookmarksService();
   53:     ~BookmarksService();
   54:     
   55:     static BookmarksService* AddObserver(nsIDocumentObserver* aObserver);
   56:     static void RemoveObserver(nsIDocumentObserver* aObserver);
   57:     
   58:     void GetRootContent(nsIContent** aResult);
   59:     BookmarkItem* GetWrapperFor(nsIContent* aItem);
   60:     
   61: private:
   62:     // Global counter and pointer to our singleton.
   63:     static PRUint32 gRefCnt;
   64:     static BookmarksService* gSingleton;
   65: 
   66: public:
   67:     static nsIAtom* gFolderAtom;
   68:     static nsIAtom* gNameAtom;
   69:     static nsIAtom* gHrefAtom;
   70:     static nsIAtom* gBookmarkAtom;
   71: 
   72: private: // Singleton members.
   73:     nsCOMPtr<nsIDocument> mBookmarks;
   74:     NSMutableDictionary* mDictionary;
   75: };

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