// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved

// (DO NOT EDIT: machine generated header) 'EnImgScr.pas' rev: 5.00

#ifndef EnImgScrHPP
#define EnImgScrHPP

#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Menus.hpp>	// Pascal unit
#include <Forms.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <ExtCtrls.hpp>	// Pascal unit
#include <EnMisc.hpp>	// Pascal unit
#include <EnTransf.hpp>	// Pascal unit
#include <EnDiGrph.hpp>	// Pascal unit
#include <EnAnEdit.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <StdCtrls.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <SysInit.hpp>	// Pascal unit
#include <System.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Enimgscr
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TImageScrollBox;
typedef void __fastcall (__closure *TZoomChangeEvent)(const TImageScrollBox* Sender, const float Zoom
	);

typedef void __fastcall (__closure *TBeforeSaveEvent)(const TImageScrollBox* Sender, const Endigrph::TDibGraphic* 
	Graphic);

typedef void __fastcall (__closure *TRedrawEvent)(const Endigrph::TDibGraphic* Graphic);

typedef void __fastcall (__closure *TRubberbandChangeEvent)(const Windows::TRect &Rect);

#pragma option push -b-
enum TZoomMode { zmOriginalSize, zmFullPage, zmFitWidth, zmFitHeight, zmPercent, zmFitToPage };
#pragma option pop

#pragma option push -b-
enum TMouseMode { mmDrag, mmQuickSelect, mmSelect, mmAnnotate, mmUser };
#pragma option pop

typedef void __fastcall (__closure *TQuickSelectEvent)(const TImageScrollBox* Sender, const Endigrph::TDibGraphic* 
	Graphic, const Windows::TRect &Rect);

typedef void __fastcall (__closure *TNewGraphicEvent)(const Endigrph::TDibGraphic* Graphic);

class DELPHICLASS TReadGraphicThread;
class PASCALIMPLEMENTATION TReadGraphicThread : public Classes::TThread 
{
	typedef Classes::TThread inherited;
	
protected:
	AnsiString FFileName;
	Endigrph::TDibGraphic* *pFGraphic;
	virtual void __fastcall Execute(void);
	
public:
	__fastcall TReadGraphicThread(const AnsiString FileName, Endigrph::TDibGraphic* &Graphic);
public:
	#pragma option push -w-inl
	/* TThread.Destroy */ inline __fastcall virtual ~TReadGraphicThread(void) { }
	#pragma option pop
	
};


class DELPHICLASS TMouseHandler;
class PASCALIMPLEMENTATION TMouseHandler : public System::TObject 
{
	typedef System::TObject inherited;
	
protected:
	TImageScrollBox* FImageScrollBox;
	bool FMouseIsDown;
	virtual void __fastcall BeforeResize(void);
	virtual void __fastcall AfterResize(void);
	virtual void __fastcall MouseDown(const Controls::TMouseButton Button, const Classes::TShiftState Shift
		, const int X, const int Y);
	virtual void __fastcall MouseUp(const Controls::TMouseButton Button, const Classes::TShiftState Shift
		, const int X, const int Y);
	virtual void __fastcall MouseMove(const Classes::TShiftState Shift, const int X, const int Y);
	virtual void __fastcall MouseDblClick(System::TObject* Sender);
	
public:
	__fastcall TMouseHandler(const TImageScrollBox* InImageScrollBox);
	__property TImageScrollBox* ImageScrollBox = {read=FImageScrollBox};
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~TMouseHandler(void) { }
	#pragma option pop
	
};


class PASCALIMPLEMENTATION TImageScrollBox : public Forms::TScrollingWinControl 
{
	typedef Forms::TScrollingWinControl inherited;
	
protected:
	Extctrls::TImage* FImage;
	Endigrph::TDibGraphic* FSourceGraphic;
	Endigrph::TDibGraphic* FResizedBWGraphic;
	Entransf::TResizeTransform* FResizeTransform;
	Entransf::TAntiAliasTransform* FAntiAliasTransform;
	TMouseHandler* FMouseHandler;
	TMouseMode FMouseMode;
	TQuickSelectEvent FOnQuickSelect;
	TZoomMode FZoomMode;
	float FZoomPercent;
	float FLastZoomPercent;
	bool FAntiAliased;
	TZoomChangeEvent FOnZoomChange;
	TBeforeSaveEvent FOnBeforeSave;
	TRedrawEvent FOnRedraw;
	bool FAnimated;
	Extctrls::TTimer* FAnimationTimer;
	AnsiString FFileName;
	bool FCentered;
	bool FRedrawInProgress;
	bool FScrollInProgress;
	Classes::TNotifyEvent FOnBeginScroll;
	Classes::TNotifyEvent FOnEndScroll;
	Controls::TMouseMoveEvent FOnImageMouseMove;
	Controls::TMouseEvent FOnImageMouseDown;
	Controls::TMouseEvent FOnImageMouseUp;
	Classes::TNotifyEvent FOnImageDblClick;
	TRubberbandChangeEvent FOnRubberbandChange;
	Windows::TRect FImageRect;
	Enmisc::TEnvisionProgressEvent FOnReadWriteProgress;
	AnsiString FReadAheadFileName;
	Endigrph::TDibGraphic* FReadAheadGraphic;
	bool FMouseHandlerOwnership;
	TNewGraphicEvent FOnNewGraphic;
	AnsiString FAnnotationsStr;
	bool FAlwaysShowAnnotations;
	Enanedit::TAnnotationsEditor* FDisplayEditor;
	void __fastcall SetAlwaysShowAnnotations(const bool Show);
	virtual void __fastcall DoNewGraphic(const Graphics::TGraphic* Graphic);
	void __fastcall AnimateTimer(System::TObject* Sender);
	void __fastcall SetZoomMode(const TZoomMode InZoomMode);
	void __fastcall SetZoomPercent(const float InPercent);
	Endigrph::TDibGraphic* __fastcall GetGraphic(void);
	void __fastcall SetGraphic(const Endigrph::TDibGraphic* InGraphic);
	Endigrph::TDibGraphic* __fastcall GetDisplayedGraphic(void);
	void __fastcall SetAntiAliased(const bool InAntiAliased);
	HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
	HIDESBASE MESSAGE void __fastcall WMDestroy(Messages::TWMNoParams &Message);
	HIDESBASE MESSAGE void __fastcall WMHScroll(Messages::TWMScroll &Message);
	HIDESBASE MESSAGE void __fastcall WMVScroll(Messages::TWMScroll &Message);
	int __fastcall GetFrameCount(void);
	Endigrph::TDibGraphic* __fastcall GetFrame(int FrameNo);
	int __fastcall GetCurrentFrame(void);
	void __fastcall SetCurrentFrame(const int FrameNo);
	bool __fastcall GetAnimated(void);
	void __fastcall SetAnimated(const bool InAnimated);
	void __fastcall SetMouseMode(const TMouseMode InMouseMode);
	void __fastcall ImageMouseDown(System::TObject* Sender, Controls::TMouseButton Button, Classes::TShiftState 
		Shift, int X, int Y);
	void __fastcall ImageMouseMove(System::TObject* Sender, Classes::TShiftState Shift, int X, int Y);
	void __fastcall ImageMouseUp(System::TObject* Sender, Controls::TMouseButton Button, Classes::TShiftState 
		Shift, int X, int Y);
	void __fastcall ImageDblClick(System::TObject* Sender);
	void __fastcall RedrawBW(void);
	void __fastcall RedrawNotBW(void);
	void __fastcall CenterImage(const int NewWidth, const int NewHeight);
	void __fastcall RecalcZoom(void);
	void __fastcall SetFileName(const AnsiString FileName);
	void __fastcall SetCentered(const bool InCentered);
	void __fastcall SetMouseHandler(const TMouseHandler* MouseHandler);
	void __fastcall SetReadAheadFileName(const AnsiString FileName);
	Endigrph::TDibGraphic* __fastcall InternalLoadFromStream(const Classes::TStream* Stream, const AnsiString 
		Extension, const int ImageNo, const bool ShowProgress);
	AnsiString __fastcall GetAnnotations(void);
	void __fastcall SetAnnotations(const AnsiString Str);
	void __fastcall ShowAnnotations(void);
	void __fastcall HideAnnotations(void);
	
public:
	__fastcall virtual TImageScrollBox(Classes::TComponent* AOwner);
	__fastcall virtual ~TImageScrollBox(void);
	int __fastcall ImageCountFromFile(const AnsiString FileName);
	int __fastcall ImageCountFromStream(const Classes::TStream* Stream, const AnsiString Extension);
	void __fastcall LoadFromFile(const AnsiString FileName, const int ImageNo);
	void __fastcall LoadFromStream(const Classes::TStream* Stream, const AnsiString Extension, const int 
		ImageNo)/* overload */;
	void __fastcall LoadFromStream(const Classes::TStream* Stream, const int ImageNo)/* overload */;
	void __fastcall SaveToFile(const AnsiString FileName);
	void __fastcall SaveToStream(const Classes::TStream* Stream, const AnsiString Extension);
	void __fastcall AppendToFile(const AnsiString FileName);
	void __fastcall AppendToStream(const Classes::TStream* Stream, const AnsiString Extension);
	void __fastcall Clear(void);
	__property Endigrph::TDibGraphic* Graphic = {read=GetGraphic, write=SetGraphic};
	__property Endigrph::TDibGraphic* DisplayedGraphic = {read=GetDisplayedGraphic};
	DYNAMIC void __fastcall Redraw(const bool GraphicChanged);
	__property int FrameCount = {read=GetFrameCount, nodefault};
	__property Endigrph::TDibGraphic* Frames[int FrameNo] = {read=GetFrame};
	__property int CurrentFrame = {read=GetCurrentFrame, write=SetCurrentFrame, nodefault};
	__property bool Animated = {read=GetAnimated, write=SetAnimated, default=0};
	__property TMouseMode MouseMode = {read=FMouseMode, write=SetMouseMode, nodefault};
	__property TMouseHandler* MouseHandler = {read=FMouseHandler, write=SetMouseHandler};
	__property Windows::TRect ImageRect = {read=FImageRect};
	__property bool ScrollInProgress = {read=FScrollInProgress, nodefault};
	void __fastcall CopySelectionToClipboard(void);
	void __fastcall CropToSelection(void);
	void __fastcall ExtractSelection(const Endigrph::TDibGraphic* Dest);
	void __fastcall CopyGraphicIntoSelection(const Graphics::TGraphic* Graphic);
	void __fastcall ZoomToSelection(void);
	bool __fastcall AssignFromClipboard(void);
	void __fastcall AddNote(void);
	void __fastcall AddText(void);
	void __fastcall AddRectangle(void);
	void __fastcall AddLine(void);
	void __fastcall AddImage(void);
	void __fastcall BurnAnnotations(void);
	__property AnsiString Annotations = {read=GetAnnotations, write=SetAnnotations};
	__property bool AlwaysShowAnnotations = {read=FAlwaysShowAnnotations, write=SetAlwaysShowAnnotations
		, nodefault};
	
__published:
	__property AnsiString FileName = {read=FFileName, write=SetFileName};
	__property AnsiString ReadAheadFileName = {read=FReadAheadFileName, write=SetReadAheadFileName};
	__property bool AntiAliased = {read=FAntiAliased, write=SetAntiAliased, default=0};
	__property TZoomMode ZoomMode = {read=FZoomMode, write=SetZoomMode, default=0};
	__property float ZoomPercent = {read=FZoomPercent, write=SetZoomPercent};
	__property bool Centered = {read=FCentered, write=SetCentered, default=0};
	__property TZoomChangeEvent OnZoomChange = {read=FOnZoomChange, write=FOnZoomChange};
	__property TBeforeSaveEvent OnBeforeSave = {read=FOnBeforeSave, write=FOnBeforeSave};
	__property TRedrawEvent OnRedraw = {read=FOnRedraw, write=FOnRedraw};
	__property TNewGraphicEvent OnNewGraphic = {read=FOnNewGraphic, write=FOnNewGraphic};
	__property TQuickSelectEvent OnQuickSelect = {read=FOnQuickSelect, write=FOnQuickSelect};
	__property Controls::TMouseMoveEvent OnImageMouseMove = {read=FOnImageMouseMove, write=FOnImageMouseMove
		};
	__property Controls::TMouseEvent OnImageMouseDown = {read=FOnImageMouseDown, write=FOnImageMouseDown
		};
	__property Controls::TMouseEvent OnImageMouseUp = {read=FOnImageMouseUp, write=FOnImageMouseUp};
	__property Classes::TNotifyEvent OnImageDblClick = {read=FOnImageDblClick, write=FOnImageDblClick};
		
	__property TRubberbandChangeEvent OnRubberbandChange = {read=FOnRubberbandChange, write=FOnRubberbandChange
		};
	__property Enmisc::TEnvisionProgressEvent OnReadWriteProgress = {read=FOnReadWriteProgress, write=FOnReadWriteProgress
		};
	__property Classes::TNotifyEvent OnBeginScroll = {read=FOnBeginScroll, write=FOnBeginScroll};
	__property Classes::TNotifyEvent OnEndScroll = {read=FOnEndScroll, write=FOnEndScroll};
	__property bool MouseHandlerOwnership = {read=FMouseHandlerOwnership, write=FMouseHandlerOwnership, 
		nodefault};
	__property Align ;
	__property Anchors ;
	__property DockSite ;
	__property BiDiMode ;
	__property Constraints ;
	__property DragKind ;
	__property ParentBiDiMode ;
	__property OnCanResize ;
	__property OnConstrainedResize ;
	__property OnDockDrop ;
	__property OnDockOver ;
	__property OnEndDock ;
	__property OnGetSiteInfo ;
	__property OnResize ;
	__property OnStartDock ;
	__property OnUnDock ;
	__property DragCursor ;
	__property DragMode ;
	__property Enabled ;
	__property Color ;
	__property Ctl3D ;
	__property Font ;
	__property ParentColor ;
	__property ParentCtl3D ;
	__property ParentFont ;
	__property ParentShowHint ;
	__property PopupMenu ;
	__property ShowHint ;
	__property TabOrder ;
	__property TabStop ;
	__property Visible ;
	__property OnClick ;
	__property OnDblClick ;
	__property OnDragDrop ;
	__property OnDragOver ;
	__property OnEndDrag ;
	__property OnEnter ;
	__property OnExit ;
	__property OnStartDrag ;
	__property OnKeyDown ;
	__property OnKeyUp ;
	__property OnKeyPress ;
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TImageScrollBox(HWND ParentWindow) : Forms::TScrollingWinControl(
		ParentWindow) { }
	#pragma option pop
	
};


class DELPHICLASS TDragMouseHandler;
class PASCALIMPLEMENTATION TDragMouseHandler : public TMouseHandler 
{
	typedef TMouseHandler inherited;
	
protected:
	Controls::TCursor FScreenCursor;
	Windows::TPoint FStartMousePos;
	Windows::TPoint FStartScrollPos;
	virtual void __fastcall MouseDown(const Controls::TMouseButton Button, const Classes::TShiftState Shift
		, const int X, const int Y);
	virtual void __fastcall MouseUp(const Controls::TMouseButton Button, const Classes::TShiftState Shift
		, const int X, const int Y);
	virtual void __fastcall MouseMove(const Classes::TShiftState Shift, const int X, const int Y);
	
public:
	__fastcall TDragMouseHandler(const TImageScrollBox* InImageScrollBox);
public:
	#pragma option push -w-inl
	/* TObject.Destroy */ inline __fastcall virtual ~TDragMouseHandler(void) { }
	#pragma option pop
	
};


class DELPHICLASS TQuickSelectMouseHandler;
class PASCALIMPLEMENTATION TQuickSelectMouseHandler : public TMouseHandler 
{
	typedef TMouseHandler inherited;
	
protected:
	int FX1;
	int FY1;
	int FX2;
	int FY2;
	Graphics::TCanvas* FCanvas;
	void __fastcall BoundXY(int &X, int &Y);
	void __fastcall DrawBand(void);
	void __fastcall RemoveBand(void);
	void __fastcall DrawXORBand(void);
	virtual void __fastcall MouseDown(const Controls::TMouseButton Button, const Classes::TShiftState Shift
		, const int X, const int Y);
	virtual void __fastcall MouseUp(const Controls::TMouseButton Button, const Classes::TShiftState Shift
		, const int X, const int Y);
	virtual void __fastcall MouseMove(const Classes::TShiftState Shift, const int X, const int Y);
	
public:
	__fastcall TQuickSelectMouseHandler(const TImageScrollBox* InImageScrollBox);
	__fastcall virtual ~TQuickSelectMouseHandler(void);
};


//-- var, const, procedure ---------------------------------------------------

}	/* namespace Enimgscr */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Enimgscr;
#endif
#pragma option pop	// -w-
#pragma option pop	// -Vx

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// EnImgScr
