File:  [mozdev] / chimera / BookmarksService.h
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Sat Feb 9 01:24:11 2002 UTC (15 years, 10 months ago) by hyatt
Branches: MAIN
CVS tags: HEAD
Stubs for adding bookmarks.

/*
 *  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"

class nsIDocumentObserver;
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) ensureBookmarks;

-(IBAction)addBookmark:(id)aSender;
-(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;

@end

@interface BookmarkItem : NSObject
{
    nsIContent* mContentNode;
}

-(nsIContent*)contentNode;
-(void)setContentNode: (nsIContent*)aContentNode;
@end

class BookmarksService
{
public:
    BookmarksService();
    ~BookmarksService();
    
    static BookmarksService* AddObserver(nsIDocumentObserver* aObserver);
    static void RemoveObserver(nsIDocumentObserver* aObserver);
    
    void GetRootContent(nsIContent** aResult);
    BookmarkItem* GetWrapperFor(nsIContent* aItem);
    
private:
    // Global counter and pointer to our singleton.
    static PRUint32 gRefCnt;
    static BookmarksService* gSingleton;

public:
    static nsIAtom* gFolderAtom;
    static nsIAtom* gNameAtom;
    static nsIAtom* gHrefAtom;
    static nsIAtom* gBookmarkAtom;

private: // Singleton members.
    nsCOMPtr<nsIDocument> mBookmarks;
    NSMutableDictionary* mDictionary;
};

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