/******************************************************************************************************

	BXDisclosureView.h
	
 ******************************************************************************************************

	Author:			Peter Baumgartner		Tel:  (+4989) 649-43875
					Rosskopfstr. 20			Mail: peter@baumgartner.com
					82031 Grünwald			
					Germany					
	
					Copyright © 2004-2007 by Peter Baumgartner - All Rights Reserved

 ******************************************************************************************************/

/******************************************************************************************************
	READ ME
 ******************************************************************************************************/

	#pragma mark READ ME

	// View class that can be collapsed and expanded. Use either via supplied actions or
	// via Cocoa bindings. When using the IB palette the bindings can be configured from
	// within IB...


	
	#pragma mark
	
/******************************************************************************************************
	BXDisclosureView
 ******************************************************************************************************/

	@interface BXDisclosureView : NSView <NSFileManagerDelegate>
	{
		// Outlets...
		
		IBOutlet BXDisclosureView* _parentView;
		IBOutlet BXDisclosureView* _firstChildView;
		IBOutlet BXDisclosureView* _lastChildView;
		IBOutlet BXDisclosureView* _nextSiblingView;
		IBOutlet NSButton* _button;
		IBOutlet NSView* _contentView;
		IBOutlet id _delegate;
		
		// Data fields...
		
		CGFloat _minHeight;
		CGFloat _maxHeight;
		CGFloat _header;
		CGFloat _footer;
		BOOL _animatesView;
		BOOL _animatesWindow;
		BOOL _expanded;
		
		BOOL _flipped;
		BOOL _setFrameAnimated;
		
		// Bindings...
		
		NSMutableDictionary* _bindingInfo;
	}

	//-------------------------------------------------------------------------------------------------
	// Methods
	//-------------------------------------------------------------------------------------------------
	
	#pragma mark 

	// Config...
	
	- (void) addChildView:(BXDisclosureView*)inView;
	- (void) removeAllChildViews;
	
	- (BXDisclosureView*) firstChildView;
	- (BXDisclosureView*) lastChildView;
	
	- (void) setParentView:(BXDisclosureView*)inView;
	- (BXDisclosureView*) parentView;

	- (void) setNextSiblingView:(BXDisclosureView*)inView;
	- (BXDisclosureView*) nextSiblingView;
	
	- (void) setButton:(NSButton*)inButton;
	- (NSButton*) button;
	
	- (void) setContentView:(NSView*)inView;
	- (NSView*) contentView;
	
	- (void) setFlipped:(BOOL)inFlipped;
	- (BOOL) isFlipped;

	#pragma mark 

	// Accessors...
	
	- (void) setMinHeight:(CGFloat)inMinHeight;
	- (CGFloat) minHeight;

	- (void) setMaxHeight:(CGFloat)inMaxHeight;
	- (CGFloat) maxHeight;
	
	- (void) setHeader:(CGFloat)inHeader;
	- (CGFloat) header;

	- (void) setFooter:(CGFloat)inFooter;
	- (CGFloat) footer;

	- (void) setAnimatesView:(BOOL)inAnimate;
	- (BOOL) animatesView;

	- (void) setAnimatesWindow:(BOOL)inAnimate;
	- (BOOL) animatesWindow;

	- (void) setDelegate:(id)inDelegate;
	- (id) delegate;

	- (void) setExpanded:(BOOL)inExpanded;
	- (BOOL) expanded;

	- (BXDisclosureView*) rootView;
	- (BOOL) isRootView;
	- (CGFloat) width;
	- (CGFloat) height;
	- (CGFloat) heightOfChildren;
	
	// Deprecated Accessors...
	
	- (void) setResizesWindow:(BOOL)inResizes;
	- (BOOL) resizesWindow;
	
	#pragma mark 

	// Update layout...
	
	- (void) setNeedsUpdate:(BOOL)inNeedsUpdate animate:(BOOL)inAnimate;
	- (void) update;

	#pragma mark 

	// Actions...
	
	- (IBAction) setState:(id)inSender;
	- (IBAction) collapse:(id)inSender;
	- (IBAction) expand:(id)inSender;
	- (IBAction) toggle:(id)inSender;

	@end



/******************************************************************************************************
	BXDisclosureContainerView
 ******************************************************************************************************/

	#pragma mark 

	@interface BXDisclosureContainerView : BXDisclosureView
	
	@end



/******************************************************************************************************
	Delegate Methods
 ******************************************************************************************************/

	#pragma mark 

	@interface NSObject (BXDisclosureViewDelegate)
	- (void) disclosureViewStateWillChange:(BXDisclosureView*)inView;
	- (void) disclosureViewStateDidChange:(BXDisclosureView*)inView;
	- (void) disclosureViewFrameDidChange:(BXDisclosureView*)inView;
	- (void) disclosureViewrFinishedAnimation:(BXDisclosureView*)inView;
	@end



/******************************************************************************************************/
