//
//  AMRollOverButtonCell.h
//  PlateControl
//
//  Created by Andreas on Sat Jan 24 2004.
//  Copyright (c) 2004 Andreas Mayer. All rights reserved.
//
//	2004-08-07	- changed superclass from NSActionCell to NSButtonCell.
//					  not sure if this makes any difference at all though ... :)
//	2005-06-02	- added shading support
//	2006-01-07	- added support for NSOnOffButton type
//	2008-04-29	- added controlShadow
//					- renamed -showArrow to -alwaysShowMenuIndicator
//	2011-08-08	- moved appearance data to AMRollOverButtonAppearance
//					- removed buttonType property, since that is part of the behaviour which should not be
//					  declared by the cell


#import <AppKit/AppKit.h>

@class AMRollOverButtonAppearance;

enum {
	AMRollOverButtonShadingNone = 0,
	AMRollOverButtonShadingLinear,
	AMRollOverButtonShadingBilinear
};
typedef NSUInteger AMRollOverButtonShadingMode;


@interface AMRollOverButtonCell : NSButtonCell {
	// Setting _appearance will overwrite the button's appearance.
	// Usually it's nil, indicating that the button's appearance is to be used.
	AMRollOverButtonAppearance *_appearance;
	BOOL am_bordered;
	BOOL am_mouseOver;
	// private: basic layout and geometry data
	@private
	NSBezierPath *am_backgroundPath;
	NSBezierPath *am_highlightedBackgroundPath;
	NSBezierPath *am_arrowPath;
	NSSize am_lastFrameSize;
	NSRect am_textRect;
	SEL am_getBackgroundSelector;
}

// Unless you have explicitely set the appearance of a cell instance before, using any of the appearance setters
// below will alter the appearance of all buttons(!) of the same class!

- (NSColor *)controlColor;
- (void)setControlColor:(NSColor *)newControlColor;

- (NSColor *)shadingColor;
- (void)setShadingColor:(NSColor *)newShadingColor;

- (NSColor *)frameColor;
- (void)setFrameColor:(NSColor *)newFrameColor;

- (NSColor *)textColor;
- (void)setTextColor:(NSColor *)newTextColor;

- (NSColor *)arrowColor;
- (void)setArrowColor:(NSColor *)newArrowColor;

- (NSColor *)mouseoverControlColor;
- (void)setMouseoverControlColor:(NSColor *)newMouseoverControlColor;

- (NSColor *)mouseoverShadingColor;
- (void)setMouseoverShadingColor:(NSColor *)newMouseoverShadingColor;

- (NSColor *)mouseoverFrameColor;
- (void)setMouseoverFrameColor:(NSColor *)newMouseoverFrameColor;

- (NSColor *)mouseoverTextColor;
- (void)setMouseoverTextColor:(NSColor *)newMouseoverTextColor;

- (NSColor *)mouseoverArrowColor;
- (void)setMouseoverArrowColor:(NSColor *)newMouseoverArrowColor;

- (NSColor *)highlightedControlColor;
- (void)setHighlightedControlColor:(NSColor *)newHighlightedControlColor;

- (NSColor *)highlightedShadingColor;
- (void)setHighlightedShadingColor:(NSColor *)newHighlightedShadingColor;

- (NSColor *)highlightedFrameColor;
- (void)setHighlightedFrameColor:(NSColor *)newHighlightedFrameColor;

- (NSColor *)highlightedTextColor;
- (void)setHighlightedTextColor:(NSColor *)newHighlightedTextColor;

- (NSColor *)highlightedArrowColor;
- (void)setHighlightedArrowColor:(NSColor *)newHighlightedArrowColor;

- (NSShadow *)controlShadow;
- (void)setControlShadow:(NSShadow *)newControlShadow;

- (NSShadow *)textShadow;
- (void)setTextShadow:(NSShadow *)newTextShadow;

- (NSShadow *)mouseoverTextShadow;
- (void)setMouseoverTextShadow:(NSShadow *)newMouseoverTextShadow;

- (NSShadow *)highlightedTextShadow;
- (void)setHighlightedTextShadow:(NSShadow *)newHighlightedTextShadow;

- (NSShadow *)highlightedControlShadow;
- (void)setHighlightedControlShadow:(NSShadow *)newHighlightedControlShadow;

- (double)popUpMenuDelay;
- (void)setPopUpMenuDelay:(double)newPopUpMenuDelay;

- (AMRollOverButtonShadingMode)shadingMode;
- (void)setShadingMode:(AMRollOverButtonShadingMode)newShadingMode;

- (NSBezelStyle)amBezelStyle;
- (void)setAmBezelStyle:(NSBezelStyle)newAmBezelStyle;

// call this in case the form of the button changes
- (void)invalidateLayout;

// show menu arrow even if mouse is not over control
- (BOOL)alwaysShowMenuIndicator;
- (void)setAlwaysShowMenuIndicator:(BOOL)newValue;

- (BOOL)mouseOver;
- (void)setMouseOver:(BOOL)newMouseOver;

- (NSSize)intrinsicContentSize;

@end


@interface AMRollOverButtonCell (Appearance)

// if not explicitely set before with -setAppearance, returns the button class' appearance
- (AMRollOverButtonAppearance *)appearance;

// only use this if you need to modify the appearance of this one cell independently of any other
- (void)setAppearance:(AMRollOverButtonAppearance *)appearance;

@end
