//
//  KSTKImageDrawView.h
//  KSToolkit
//
//  Created by Pierre Oleo on 17/07/09.
//  Copyright 2009 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import <QuartzCore/QuartzCore.h>
@class KSTKImageDrawView;

typedef enum {
    KSTKDisplayLeftRightMode = 0, 
	KSTKDisplayRightLeftMode
} KSTKDisplayDirectionModes;

typedef enum {
    KSTKDisplayNormalSizeMode = 0, 
	KSTKDisplayFullFitSizeMode,
	KSTKDisplayHorizontalFitSizeMode,
} KSTKDisplaySizeModes;



@protocol KSTKImageDrawViewDelegate
-(void) imageDrawView:(KSTKImageDrawView *) aView sizeDidChange:(id)sender;
-(void) imageDrawView:(KSTKImageDrawView *) aView previousPageActivated:(id)sender;
-(void) imageDrawView:(KSTKImageDrawView *) aView changePageNumberActivated:(id)sender;
-(void) imageDrawView:(KSTKImageDrawView *) aView nextPageActivated:(id)sender;
-(void) imageDrawView:(KSTKImageDrawView *) aView leaveFullscreenActivated:(id)sender;
-(void) imageDrawView:(KSTKImageDrawView *) aView toggleFullscreenActivated:(id)sender;

@end


@interface KSTKImageDrawView : NSView
{
	int displayResizeMode,readingDirection,globalRotation;
	BOOL readingDualPages, selectedIsFirst;
	NSImage	* firstPageImage,* secondPageImage,	* drawnImage;
	NSSize completeImageSize, firstImagePixelSize,secondImagePixelSize;
	id <KSTKImageDrawViewDelegate> ksActionDelegate;	
	NSColor * bgColor;
}
@property (assign) int displayResizeMode,readingDirection,globalRotation;
@property (retain,nonatomic)	NSColor * bgColor;
@property (retain)NSImage	* firstPageImage,* secondPageImage,	* drawnImage;
@property (assign) NSSize completeImageSize, firstImagePixelSize,secondImagePixelSize;
@property (assign)id <KSTKImageDrawViewDelegate>  ksActionDelegate;
@property (assign) BOOL readingDualPages, selectedIsFirst;

-(NSImage *) portionInRect:(NSRect) aRect;
-(void)_recalculateImageSize; // not directly called when changing images or layout in ordr to avoid triple call. Must call it after these

@end
