/*
SRSBBookmarksController.h

Author: Makoto Kinoshita

Copyright 2004 The Shiira Project. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted 
provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions 
  and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of 
  conditions and the following disclaimer in the documentation and/or other materials provided 
  with the distribution.

THIS SOFTWARE IS PROVIDED BY THE SHIIRA PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, 
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE SHIIRA PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
POSSIBILITY OF SUCH DAMAGE.
*/

#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
#import "SRError.h"

typedef enum _SRBookmarkDetail {
    SRBookmarkHTMLDetail = 0, 
    SRBookmarkFolderDetail, 
    SRBookmarkRSSDetail, 
} SRBookmarkDetail;

@class SRMainWindowController;
@class SRSideBarController;
@class SRBookmark;

@interface SRSBBookmarksController : NSResponder
{
    SRMainWindowController* _mainWindowController;
    SRSideBarController*    _sideBarController;
    
    NSIndexSet*             _bookmarkTableSelectedIndex;
    NSArray*                _findResults;
    
    NSArray*                _draggingBookmarks;
    
    IBOutlet id _bookmarksView;
    IBOutlet id _searchField;
    IBOutlet id _bookmarksTab;
    IBOutlet id _bookmarksOutline;
    IBOutlet id _findTable;
    IBOutlet id _detailView;
    
    IBOutlet id _htmlView;
    IBOutlet id _htmlImageView;
    IBOutlet id _htmlNameLabel;
    IBOutlet id _htmlNameTextField;
    IBOutlet id _htmlAddressTextField;
    
    IBOutlet id _folderView;
    IBOutlet id _folderImageView;
    IBOutlet id _folderNameLabel;
    IBOutlet id _folderNameTextField;
    IBOutlet id _folderAutoTabCheckBox;
    
    IBOutlet id _rssView;
    IBOutlet id _rssImageView;
    IBOutlet id _rssNameLabel;
    IBOutlet id _rssNameTextField;
    IBOutlet id _rssAddressTextField;
    IBOutlet id _rssUpdateCheckBox;
}

// Initialize
- (id)initWithMainWindowController:(SRMainWindowController*)mainWindowController 
        sideBarController:(SRSideBarController*)sideBarController;

// Controller
- (SRMainWindowController*)mainWindowController;
- (void)setMainWindowController:(SRMainWindowController*)mainWindowController;
- (SRSideBarController*)sideBarController;
- (void)setSidebarController:(SRSideBarController*)sideBarController;

// View
- (NSView*)view;
- (id)selectedBookmarksView;

// Detail view
- (void)setDetailView:(SRBookmarkDetail)type;

// Bookmark
- (NSArray*)selectedBookmarks;
- (void)selectBookmark:(SRBookmark*)bookmark;
- (void)selectBookmarks:(NSArray*)bookmarks;
- (void)selectBookmarkAtRow:(int)row;
- (void)copySelectedBookmarks;
- (void)deleteSelectedBookmarks;
- (void)pasteBookmarks;
- (void)reloadBookmark;

- (void)revealBookmarkWithURLString:(NSString*)URLString;

// Actions
- (void)bookmarkSelectedAction:(id)sender;
- (void)openBookmarkAction:(id)sender;
- (void)createNewBookmarkFolderAction:(id)sender;

- (void)changeBookmarkPropertyAction:(id)sender;
- (void)findBookmarkAction:(id)sender;

@end
