// CodeGear C++Builder
// Copyright (c) 1995, 2015 by Embarcadero Technologies, Inc.
// All rights reserved

// (DO NOT EDIT: machine generated header) 'rulerbox.pas' rev: 30.00 (Windows)

#ifndef RulerboxHPP
#define RulerboxHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member 
#pragma pack(push,8)
#include <System.hpp>
#include <SysInit.hpp>
#include <Winapi.Windows.hpp>
#include <Winapi.Messages.hpp>
#include <System.SysUtils.hpp>
#include <System.Classes.hpp>
#include <Vcl.Graphics.hpp>
#include <Vcl.Controls.hpp>
#include <System.Types.hpp>
#include <iegdiplus.hpp>
#include <System.UITypes.hpp>
#include <Vcl.Menus.hpp>

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

namespace Rulerbox
{
//-- forward type declarations -----------------------------------------------
class DELPHICLASS TRulerBox;
//-- type declarations -------------------------------------------------------
typedef System::StaticArray<System::Types::TPoint, 10> TIEPolyg;

enum DECLSPEC_DENUM TGripKind : unsigned char { gkTriangle, gkLeftTriangle, gkRightTriangle, gkArrow, gkArrow2 };

enum DECLSPEC_DENUM TGripsDir : unsigned char { gdUp, gdDown };

enum DECLSPEC_DENUM TRulerDir : unsigned char { rdHorizontal, rdVertical };

typedef void __fastcall (__closure *TRulerPosChangeEvent)(System::TObject* Sender, int Grip);

typedef void __fastcall (__closure *TRulerGripClickEvent)(System::TObject* Sender, int Grip);

typedef void __fastcall (__closure *TRulerGripDblClickEvent)(System::TObject* Sender, int Grip);

typedef void __fastcall (__closure *TRulerClickEvent)(System::TObject* Sender, double ps);

class PASCALIMPLEMENTATION TRulerBox : public Vcl::Controls::TCustomControl
{
	typedef Vcl::Controls::TCustomControl inherited;
	
public:
	double operator[](int g) { return GripsPos[g]; }
	
private:
	Vcl::Graphics::TBitmap* Bitmap;
	System::Uitypes::TColor fBackground;
	System::Classes::TList* fGrips;
	int fGripBaseDim;
	int fSelGrip;
	int fSelGripSt;
	int fMX1;
	int fMY1;
	TGripsDir fGripsDir;
	bool fRuler;
	double fViewPos;
	double fDPU;
	double fFrequency;
	double fLabelFreq;
	System::Uitypes::TColor fRulerColor;
	TRulerDir fRulerDir;
	double fViewMin;
	double fViewMax;
	TRulerPosChangeEvent fOnRulerPosChange;
	TRulerGripClickEvent fOnRulerGripClick;
	TRulerGripDblClickEvent fOnRulerGripDblClick;
	TRulerClickEvent fOnRulerClick;
	bool fFitInView;
	bool fHexLabels;
	int fMaxGripHeight;
	bool fInverted;
	double fScrollRate;
	int fOffsetX;
	int fOffsetY;
	void __fastcall SetBackground(System::Uitypes::TColor bk);
	void __fastcall SetGripsCount(int v);
	int __fastcall GetGripsCount(void);
	void __fastcall SetGripsPos(int i, double p);
	double __fastcall GetGripsPos(int i);
	void __fastcall SetGripsCol(int i, int p);
	int __fastcall GetGripsCol(int i);
	void __fastcall SetGripBaseDim(int v);
	void __fastcall SetGripsKind(int i, TGripKind v);
	TGripKind __fastcall GetGripsKind(int i);
	void __fastcall SetGripsDir(TGripsDir v);
	void __fastcall SetRuler(bool v);
	void __fastcall SetViewPos(double v);
	void __fastcall SetDPU(double v);
	void __fastcall SetFrequency(double v);
	void __fastcall SetLabelFreq(double v);
	void __fastcall SetRulerColor(System::Uitypes::TColor v);
	void __fastcall SetRulerDir(TRulerDir v);
	void __fastcall SetGripsMax(int i, double v);
	void __fastcall SetGripsMin(int i, double v);
	double __fastcall GetGripsMax(int i);
	double __fastcall GetGripsMin(int i);
	void __fastcall SetViewMin(double v);
	void __fastcall SetViewMax(double v);
	void __fastcall SetFitInView(bool v);
	double __fastcall GetWidthInUnit(void);
	void __fastcall SetHexLabels(bool v);
	void __fastcall SetInverted(bool v);
	void __fastcall SetOffsetX(int v);
	void __fastcall SetOffsetY(int v);
	
protected:
	HIDESBASE MESSAGE void __fastcall WMSize(Winapi::Messages::TWMSize &Message);
	HIDESBASE MESSAGE void __fastcall WMEraseBkgnd(Winapi::Messages::TMessage &Message);
	DYNAMIC void __fastcall MouseMove(System::Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall MouseDown(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
	DYNAMIC void __fastcall MouseUp(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
	int __fastcall GetClickedGrip(int x, int y);
	void __fastcall GetGripPoly(int gn, TIEPolyg &poly);
	void __fastcall GetGripRect(int gn, System::Types::TRect &rc);
	int __fastcall GetRulerHeight(void);
	void __fastcall RepaintGrips(void);
	void __fastcall RepaintRuler(void);
	int __fastcall GetXGripPos(int gn);
	HIDESBASE MESSAGE void __fastcall CMFontChanged(Winapi::Messages::TMessage &Message);
	void __fastcall AdjustGripLimits(int gn);
	void __fastcall AdjustViewLimits(void);
	
public:
	virtual void __fastcall Paint(void);
	__fastcall virtual TRulerBox(System::Classes::TComponent* Owner);
	__fastcall virtual ~TRulerBox(void);
	virtual void __fastcall Update(void);
	__property double GripsPos[int g] = {read=GetGripsPos, write=SetGripsPos/*, default*/};
	__property int GripsColor[int g] = {read=GetGripsCol, write=SetGripsCol};
	__property TGripKind GripsKind[int g] = {read=GetGripsKind, write=SetGripsKind};
	__property double GripsMin[int g] = {read=GetGripsMin, write=SetGripsMin};
	__property double GripsMax[int g] = {read=GetGripsMax, write=SetGripsMax};
	__property double ScrollRate = {read=fScrollRate, write=fScrollRate};
	__property int OffsetX = {read=fOffsetX, write=SetOffsetX, nodefault};
	__property int OffsetY = {read=fOffsetY, write=SetOffsetY, nodefault};
	
__published:
	__property double ViewPos = {read=fViewPos, write=SetViewPos};
	__property System::Uitypes::TColor Background = {read=fBackground, write=SetBackground, default=-16777201};
	__property int GripBaseDim = {read=fGripBaseDim, write=SetGripBaseDim, default=12};
	__property TGripsDir GripsDir = {read=fGripsDir, write=SetGripsDir, default=0};
	__property bool Ruler = {read=fRuler, write=SetRuler, default=1};
	__property double DotPerUnit = {read=fDPU, write=SetDPU};
	__property double Frequency = {read=fFrequency, write=SetFrequency};
	__property double LabelFreq = {read=fLabelFreq, write=SetLabelFreq};
	__property System::Uitypes::TColor RulerColor = {read=fRulerColor, write=SetRulerColor, default=-16777201};
	__property TRulerDir RulerDir = {read=fRulerDir, write=SetRulerDir, default=0};
	__property double ViewMin = {read=fViewMin, write=SetViewMin};
	__property double ViewMax = {read=fViewMax, write=SetViewMax};
	__property int MaxGripHeight = {read=fMaxGripHeight, write=fMaxGripHeight, nodefault};
	__property TRulerPosChangeEvent OnRulerPosChange = {read=fOnRulerPosChange, write=fOnRulerPosChange};
	__property TRulerGripClickEvent OnRulerGripClick = {read=fOnRulerGripClick, write=fOnRulerGripClick};
	__property TRulerGripDblClickEvent OnRulerGripDblClick = {read=fOnRulerGripDblClick, write=fOnRulerGripDblClick};
	__property TRulerClickEvent OnRulerClick = {read=fOnRulerClick, write=fOnRulerClick};
	__property bool Inverted = {read=fInverted, write=SetInverted, default=0};
	__property bool FitInView = {read=fFitInView, write=SetFitInView, default=0};
	__property int GripsCount = {read=GetGripsCount, write=SetGripsCount, default=1};
	__property bool HexLabels = {read=fHexLabels, write=SetHexLabels, default=0};
	__property Align = {default=0};
	__property DragCursor = {default=-12};
	__property DragMode = {default=0};
	__property Enabled = {default=1};
	__property ParentShowHint = {default=1};
	__property PopupMenu;
	__property ShowHint;
	__property Visible = {default=1};
	__property OnClick;
	__property OnDblClick;
	__property OnDragDrop;
	__property OnDragOver;
	__property OnEndDrag;
	__property OnMouseDown;
	__property OnMouseMove;
	__property OnMouseUp;
	__property OnStartDrag;
	__property Width = {default=300};
	__property Height = {default=40};
	__property Font;
public:
	/* TWinControl.CreateParented */ inline __fastcall TRulerBox(HWND ParentWindow) : Vcl::Controls::TCustomControl(ParentWindow) { }
	
};


//-- var, const, procedure ---------------------------------------------------
static const System::Int8 IEMAXPOLYGLINES = System::Int8(0xa);
}	/* namespace Rulerbox */
#if !defined(DELPHIHEADER_NO_IMPLICIT_NAMESPACE_USE) && !defined(NO_USING_NAMESPACE_RULERBOX)
using namespace Rulerbox;
#endif
#pragma pack(pop)
#pragma option pop

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