//
//  LCTabBar.h
//  LCToolkit
//
//  Created by Logan Collins on 9/28/09.
//  Copyright 2010 Logan Collins. All rights reserved.
//

#import <Cocoa/Cocoa.h>


enum {
	LCTabBarStyleDark = 0,
	LCTabBarStyleLight
};
typedef NSUInteger LCTabBarStyle;


@class LCTabBarItem;

@protocol LCTabBarDelegate;


@interface LCTabBar : NSControl {
@private
    NSMutableArray *_items;
	
    NSPopUpButton *_overflowPopUpButton;
    
	LCTabBarStyle _style;
    BOOL _shouldSizeCellsToFit;
	BOOL _showsBaselineSeparator;
    
    NSInteger _minWidth;
    NSInteger _maxWidth;
    NSInteger _preferredWidth;
	
    NSEvent *_lastMouseDownEvent;
	
	LCTabBarItem *_selectedItem;
    
    id <LCTabBarDelegate> delegate;
}

@property (assign) id <LCTabBarDelegate> delegate;

@property NSInteger minWidth;
@property NSInteger maxWidth;
@property NSInteger preferredWidth;

@property LCTabBarStyle style;
@property BOOL shouldSizeCellsToFit;
@property BOOL showsBaselineSeparator;

- (NSArray *)items;

- (void)addItem:(LCTabBarItem *)item;
- (void)insertItem:(LCTabBarItem *)item atIndex:(NSUInteger)index;
- (void)removeItem:(LCTabBarItem *)item;
- (void)removeItemAtIndex:(NSUInteger)index;
- (void)selectItem:(LCTabBarItem *)item;
- (void)selectItemAtIndex:(NSUInteger)index;
- (LCTabBarItem *)itemAtIndex:(NSUInteger)index;

- (LCTabBarItem *)selectedItem;

@end


@protocol LCTabBarDelegate <NSObject>

@optional

- (void)tabBar:(LCTabBar *)aTabBar willAddItem:(LCTabBarItem *)item;
- (void)tabBar:(LCTabBar *)aTabBar didAddItem:(LCTabBarItem *)item;

- (void)tabBar:(LCTabBar *)aTabBar willRemoveItem:(LCTabBarItem *)item;
- (void)tabBar:(LCTabBar *)aTabBar didRemoveItem:(LCTabBarItem *)item;

- (BOOL)tabBar:(LCTabBar *)aTabBar shouldSelectItem:(LCTabBarItem *)item;
- (void)tabBar:(LCTabBar *)aTabBar willSelectItem:(LCTabBarItem *)item;
- (void)tabBar:(LCTabBar *)aTabBar didSelectItem:(LCTabBarItem *)item;

- (BOOL)tabBar:(LCTabBar *)aTabBar canCloseItem:(LCTabBarItem *)item;
- (BOOL)tabBar:(LCTabBar *)aTabBar shouldCloseItem:(LCTabBarItem *)item;

@end
