// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Srvpagescroll.pas' rev: 10.00

#ifndef SrvpagescrollHPP
#define SrvpagescrollHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Messages.hpp>	// Pascal unit
#include <Sysutils.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Controls.hpp>	// Pascal unit
#include <Forms.hpp>	// Pascal unit
#include <Dialogs.hpp>	// Pascal unit
#include <Windows.hpp>	// Pascal unit
#include <Types.hpp>	// Pascal unit
#include <Rvscroll.hpp>	// Pascal unit
#include <Graphics.hpp>	// Pascal unit
#include <Sclrview.hpp>	// Pascal unit
#include <Menus.hpp>	// Pascal unit

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

namespace Srvpagescroll
{
//-- type declarations -------------------------------------------------------
#pragma option push -b-
enum TPSScrollType { psstHorizontal, psstVertical };
#pragma option pop

#pragma option push -b-
enum TPSAlignText { psatLeft, psatRight, psatTop, psatBottom };
#pragma option pop

typedef void __fastcall (__closure *TPSDrawSelectedPageEvent)(System::TObject* Sender, Graphics::TCanvas* Canvas, const Types::TRect &R, int PageNo);

typedef void __fastcall (__closure *TPSDrawPageBorderEvent)(System::TObject* Sender, Graphics::TCanvas* Canvas, const Types::TRect &R, int PageNo);

typedef void __fastcall (__closure *TPSDrawPageNumberEvent)(System::TObject* Sender, Graphics::TCanvas* Canvas, const Types::TRect &R, int PageNo, bool isSelect);

struct TPSPaintPage
{
	
public:
	int PageNo;
	#pragma pack(push,1)
	Types::TRect Refresh;
	#pragma pack(pop)
	#pragma pack(push,1)
	Types::TRect Page;
	#pragma pack(pop)
} ;

typedef DynamicArray<TPSPaintPage >  SRVPageScroll__2;

typedef DynamicArray<Graphics::TBitmap* >  SRVPageScroll__3;

class DELPHICLASS TSRVPageScroll;
class PASCALIMPLEMENTATION TSRVPageScroll : public Rvscroll::TRVScroller 
{
	typedef Rvscroll::TRVScroller inherited;
	
private:
	int CountRepaint;
	DynamicArray<TPSPaintPage >  RepaintRect;
	#pragma pack(push,1)
	Types::TRect RefreshRect;
	#pragma pack(pop)
	#pragma pack(push,1)
	Types::TRect PageRepaint;
	#pragma pack(pop)
	int lockUpdate;
	bool isRefresh;
	Graphics::TBitmap* Buffer;
	Sclrview::TSRichViewEdit* FSRichViewEdit;
	int FPageWidth;
	int FPageHeight;
	bool FPageProportions;
	TPSScrollType FScrollType;
	int FColumns;
	int FMarginHorizontal;
	int FMarginVertical;
	int FPageBreakWidth;
	int FPageBreakHeight;
	bool FPageNoVisible;
	TPSAlignText FAlignText;
	Graphics::TFont* FPageNoFont;
	int FShadowWidth;
	Graphics::TColor FShadowColor;
	Graphics::TColor FPageBorderColor;
	Graphics::TColor FSelectColor;
	Graphics::TColor FBackgroundTextColor;
	bool FAutoScrolled;
	bool FAutoUpdate;
	Classes::TNotifyEvent StoredCurrentPageChange;
	Sclrview::TSRVPaintPage StoredPaintPage;
	Classes::TNotifyEvent StoredPageScrolled;
	Classes::TNotifyEvent StoredHScrolled;
	Classes::TNotifyEvent StoredVScrolled;
	Sclrview::TSRVPageChange StoredPageChange;
	Classes::TNotifyEvent StoredFullRedraw;
	Classes::TNotifyEvent StoredFormatChanged;
	TPSDrawSelectedPageEvent FOnDrawSelectedPage;
	TPSDrawPageNumberEvent FOnDrawPageNumber;
	TPSDrawPageBorderEvent FOnDrawPageBorder;
	void __fastcall SetSRichViewEdit(Sclrview::TSRichViewEdit* Value);
	void __fastcall SetPageWidth(int Value);
	void __fastcall SetPageHeight(int Value);
	void __fastcall SetPageProportions(bool Value);
	void __fastcall SetScrollType(TPSScrollType Value);
	void __fastcall SetColumns(int Value);
	void __fastcall SetMarginHorizontal(int Value);
	void __fastcall SetMarginVertical(int Value);
	void __fastcall SetPageBreakWidth(int Value);
	void __fastcall SetPageBreakHeight(int Value);
	void __fastcall SetPageNoVisible(bool Value);
	void __fastcall SetAlignText(TPSAlignText Value);
	void __fastcall SetPageNoFont(Graphics::TFont* Value);
	void __fastcall SetShadowWidth(int Value);
	void __fastcall SetShadowColor(Graphics::TColor Value);
	void __fastcall SetPageBorderColor(Graphics::TColor Value);
	void __fastcall SetSelectColor(Graphics::TColor Value);
	void __fastcall SetBackgroundTextColor(Graphics::TColor Value);
	void __fastcall SetAutoScrolled(bool Value);
	void __fastcall SetAutoUpdate(bool Value);
	void __fastcall HookpsFormatChanged(System::TObject* Sender);
	void __fastcall HookpsCurrentPageChange(System::TObject* Sender);
	void __fastcall HookpsPageScrolled(System::TObject* Sender);
	void __fastcall HookpsHScrolled(System::TObject* Sender);
	void __fastcall HookpsVScrolled(System::TObject* Sender);
	void __fastcall HookpsPaintPage(System::TObject* Sender, int PageNo, const Types::TRect &PageRect, const Types::TRect &R, Graphics::TCanvas* Canvas, bool Prepaint, bool Printing);
	void __fastcall HookpsPageChange(System::TObject* Sender, int FromPageNo, int ToPageNo, int PageCount);
	void __fastcall HookpsFullRedraw(System::TObject* Sender);
	void __fastcall RestoreEvent(Sclrview::TSRichViewEdit* Value);
	HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
	MESSAGE void __fastcall WMRepaint(Messages::TMessage &Message);
	
protected:
	int BPagePageCache;
	int EPagePageCache;
	int FCachedPagesCount;
	int FCacheScrollLimit;
	DynamicArray<Graphics::TBitmap* >  PageCache;
	Graphics::TBitmap* __fastcall GetPageFromCache(int PageNo);
	void __fastcall UpdatePageToCache(int PageNo, const Types::TRect &R);
	void __fastcall SetCachedPagesCount(int Value);
	void __fastcall SetCacheScrollLimit(int Value);
	void __fastcall ScrollCache(int Delta);
	void __fastcall SetBPagePageCache(int PageNo);
	void __fastcall ScrollCacheToCenter(void);
	int __fastcall GetPageCount(void);
	int __fastcall GetPageNo(void);
	void __fastcall SetPageNo(const int Value);
	virtual void __fastcall Notification(Classes::TComponent* AComponent, Classes::TOperation Operation);
	DYNAMIC void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, int Y);
	virtual void __fastcall AfterVScroll(void);
	virtual void __fastcall AfterHScroll(void);
	void __fastcall GetWidthHeight(int &W, int &H);
	void __fastcall GetOffsetXY(int PageNo, int &OffsetX, int &OffsetY);
	void __fastcall GetFullSize(int &W, int &H);
	void __fastcall DrawSelect(Graphics::TCanvas* Canvas, const Types::TRect &R, int PageNo);
	void __fastcall DrawPageNumber(Graphics::TCanvas* Canvas, const Types::TRect &R, int PageNo, bool isSelect);
	void __fastcall DrawPageBorder(Graphics::TCanvas* Canvas, const Types::TRect &R, int PageNo);
	void __fastcall DrawPage(Graphics::TCanvas* Canvas, const Types::TRect &R, const Types::TRect &PRect, int PageNo, bool isSelect);
	void __fastcall UpdatePage(Graphics::TCanvas* Canvas, const Types::TRect &R, int PageNo);
	void __fastcall PushPaintRect(const TPSPaintPage &Value);
	bool __fastcall PopPaintRect(TPSPaintPage &Value);
	void __fastcall DrawContents(Graphics::TCanvas* Canvas, const Types::TRect &R, int FromPageNo, int ToPageNo);
	__property int PageNo = {read=GetPageNo, write=SetPageNo, nodefault};
	__property int PageCount = {read=GetPageCount, nodefault};
	
public:
	__fastcall virtual TSRVPageScroll(Classes::TComponent* AOwner);
	__fastcall virtual ~TSRVPageScroll(void);
	virtual void __fastcall Invalidate(void);
	virtual void __fastcall Paint(void);
	virtual void __fastcall Loaded(void);
	void __fastcall First(void);
	void __fastcall Last(void);
	void __fastcall Next(void);
	void __fastcall Prev(void);
	void __fastcall BeginUpdate(void);
	void __fastcall EndUpdate(void);
	void __fastcall ScrollToPage(int PageNo);
	int __fastcall GetPageAt(int X, int Y, bool isNearest);
	void __fastcall UpdateCache(void);
	
__published:
	__property WheelStep  = {default=2};
	__property UseXPThemes  = {default=1};
	__property Align  = {default=0};
	__property Anchors  = {default=3};
	__property Constraints ;
	__property PopupMenu ;
	__property Hint ;
	__property ShowHint ;
	__property Visible  = {default=1};
	__property OnKeyPress ;
	__property BorderStyle ;
	__property OnClick ;
	__property OnDblClick ;
	__property OnEnter ;
	__property OnExit ;
	__property OnDragDrop ;
	__property OnDragOver ;
	__property OnEndDrag ;
	__property OnMouseMove ;
	__property Color  = {default=-16777211};
	__property Width  = {default=200};
	__property Height  = {default=300};
	__property Sclrview::TSRichViewEdit* SRichViewEdit = {read=FSRichViewEdit, write=SetSRichViewEdit};
	__property int PageWidth = {read=FPageWidth, write=SetPageWidth, default=150};
	__property int PageHeight = {read=FPageHeight, write=SetPageHeight, default=200};
	__property bool PageProportions = {read=FPageProportions, write=SetPageProportions, default=1};
	__property TPSScrollType ScrollType = {read=FScrollType, write=SetScrollType, default=1};
	__property int Columns = {read=FColumns, write=SetColumns, default=1};
	__property int MarginHorizontal = {read=FMarginHorizontal, write=SetMarginHorizontal, default=15};
	__property int MarginVertical = {read=FMarginVertical, write=SetMarginVertical, default=15};
	__property int PageBreakWidth = {read=FPageBreakWidth, write=SetPageBreakWidth, default=25};
	__property int PageBreakHeight = {read=FPageBreakHeight, write=SetPageBreakHeight, default=20};
	__property TPSAlignText AlignText = {read=FAlignText, write=SetAlignText, default=3};
	__property Graphics::TFont* PageNoFont = {read=FPageNoFont, write=SetPageNoFont};
	__property bool PageNoVisible = {read=FPageNoVisible, write=SetPageNoVisible, default=1};
	__property int ShadowWidth = {read=FShadowWidth, write=SetShadowWidth, default=3};
	__property Graphics::TColor ShadowColor = {read=FShadowColor, write=SetShadowColor, default=10070188};
	__property Graphics::TColor PageBorderColor = {read=FPageBorderColor, write=SetPageBorderColor, default=-16777200};
	__property Graphics::TColor SelectColor = {read=FSelectColor, write=SetSelectColor, default=255};
	__property Graphics::TColor BackgroundTextColor = {read=FBackgroundTextColor, write=SetBackgroundTextColor, default=-16777201};
	__property bool AutoScrolled = {read=FAutoScrolled, write=SetAutoScrolled, default=1};
	__property bool AutoUpdate = {read=FAutoUpdate, write=SetAutoUpdate, default=1};
	__property int CachedPagesCount = {read=FCachedPagesCount, write=SetCachedPagesCount, default=10};
	__property int CacheScrollLimit = {read=FCacheScrollLimit, write=SetCacheScrollLimit, default=1};
	__property TPSDrawSelectedPageEvent OnDrawSelectedPage = {read=FOnDrawSelectedPage, write=FOnDrawSelectedPage};
	__property TPSDrawPageNumberEvent OnDrawPageNumber = {read=FOnDrawPageNumber, write=FOnDrawPageNumber};
	__property TPSDrawPageBorderEvent OnDrawPageBorder = {read=FOnDrawPageBorder, write=FOnDrawPageBorder};
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TSRVPageScroll(HWND ParentWindow) : Rvscroll::TRVScroller(ParentWindow) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
static const Word WM_REPAINT_CLIENTRECT = 0xbbe;

}	/* namespace Srvpagescroll */
using namespace Srvpagescroll;
#pragma pack(pop)
#pragma option pop

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