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 (16 years, 1 month ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Adding bookmarks works.

 *  BookmarksService.h
 *  Chimera
 *  Created by David Hyatt on Thu Feb 07 2002.
 *  Copyright (c) 2001 __MyCompanyName__. All rights reserved.

#include <Appkit/Appkit.h>
#include <Carbon/Carbon.h>
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "nsIDocumentObserver.h"
#include "nsVoidArray.h"

class BookmarksService;
class nsIAtom;

@interface BookmarksDataSource : NSObject
    BookmarksService* mBookmarks;
    IBOutlet id mOutlineView;
    IBOutlet id mBrowserView;
    IBOutlet id mAddButton;
    IBOutlet id mDeleteButton;

-(id) init;
-(void) dealloc;
-(void) windowClosing;

-(void) ensureBookmarks;

-(IBAction)deleteBookmark: (id)aSender;

// Datasource methods.
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item;
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item;
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
- (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;

- (void)reloadDataForItem:(id)item reloadChildren: (BOOL)aReloadChildren;


@interface BookmarkItem : NSObject
    nsIContent* mContentNode;

-(void)setContentNode: (nsIContent*)aContentNode;

class BookmarksService
    BookmarksService(BookmarksDataSource* aDataSource);
    virtual ~BookmarksService();
    void AddObserver();
    void RemoveObserver();

    void NotifyObserver(nsIContent* aContainer, PRBool aReloadChildren);
    static void NotifyObservers(nsIContent* aContainer, PRBool aReloadChildren);

    void GetRootContent(nsIContent** aResult);
    static BookmarkItem* GetWrapperFor(nsIContent* aItem);
    // Global counter and pointers to our singletons.
    static PRUint32 gRefCnt;
    static NSMutableDictionary* gDictionary;
    static nsIAtom* gFolderAtom;
    static nsIAtom* gNameAtom;
    static nsIAtom* gHrefAtom;
    static nsIAtom* gBookmarkAtom;
    static nsIDocument* gBookmarks;
    static nsVoidArray* gInstances;
    BookmarksDataSource* mDataSource;

FreeBSD-CVSweb <>