//
//  LCTabBarController.h
//  LCToolkit
//
//  Created by Logan Collins on 7/19/10.
//  Copyright 2010 Logan Collins. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "LCTabBar.h"


@class LCViewController;

@protocol LCTabBarControllerDelegate;


@interface LCTabBarController : NSViewController <LCTabBarDelegate> {
@private
	NSMutableArray *viewControllers;
	NSUInteger selectedIndex;
	
	LCTabBar *tabBar;
	NSView *containerView;
	
	id <LCTabBarControllerDelegate> delegate;
}

- (id)init;

@property (assign) IBOutlet LCTabBar *tabBar;
@property (assign) IBOutlet NSView *containerView;

@property (assign) id <LCTabBarControllerDelegate> delegate;

@property (assign) NSArray *viewControllers;

@property (readonly) LCViewController *selectedViewController;
@property (readonly) NSUInteger selectedIndex;

- (void)addViewController:(LCViewController *)viewController;
- (void)insertViewController:(LCViewController *)viewController atIndex:(NSUInteger)index;
- (void)removeViewController:(LCViewController *)viewController;
- (void)removeViewControllerAtIndex:(NSUInteger)index;
- (LCViewController *)viewControllerAtIndex:(NSUInteger)index;

- (void)selectViewController:(LCViewController *)viewController;
- (void)selectViewControllerAtIndex:(NSUInteger)index;

@end


@protocol LCTabBarControllerDelegate <NSObject>

@optional

- (void)tabBarController:(LCTabBarController *)aTabBarController willAddViewController:(LCViewController *)viewController;
- (void)tabBarController:(LCTabBarController *)aTabBarController didAddViewController:(LCViewController *)viewController;

- (void)tabBarController:(LCTabBarController *)aTabBarController willRemoveViewController:(LCViewController *)viewController;
- (void)tabBarController:(LCTabBarController *)aTabBarController didRemoveViewController:(LCViewController *)viewController;

- (BOOL)tabBarController:(LCTabBarController *)aTabBarController shouldSelectViewController:(LCViewController *)viewController;
- (void)tabBarController:(LCTabBarController *)aTabBarController willSelectViewController:(LCViewController *)viewController;
- (void)tabBarController:(LCTabBarController *)aTabBarController didSelectViewController:(LCViewController *)viewController;

- (BOOL)tabBarController:(LCTabBarController *)aTabBarController canCloseViewController:(LCViewController *)viewController;
- (BOOL)tabBarController:(LCTabBarController *)aTabBarController shouldCloseViewController:(LCViewController *)viewController;

@end


// Notifications
extern NSString * const LCTabBarControllerWillAddViewControllerNotification;
extern NSString * const LCTabBarControllerDidAddViewControllerNotification;

extern NSString * const LCTabBarControllerWillRemoveViewControllerNotification;
extern NSString * const LCTabBarControllerDidRemoveViewControllerNotification;

extern NSString * const LCTabBarControllerWillSelectViewControllerNotification;
extern NSString * const LCTabBarControllerDidSelectViewControllerNotification;

