const
{$IFDEF PAIDVERS}
SDLVersionInfo = 'gauge_r1210_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'gauge_r1210_lighted';
IsLightEd = true;
{$ENDIF}
Release = 1210;
type
TMouseMoveInGaugeEvent = procedure (Sender: TObject; InGauge: boolean;
Shift: TShiftState;
rMousePos: double) of object;
TGaugeOrientation = (goHorizontal, goVertical);
TGaugeBackground = (gbPlain, gbVertGrad, gbHorizGrad,
gbVertMidBand, gbHorizMidBand);
TGaugeIndexMode = (gimThread, gimTriangle, gimThreadTriangle,
gimThreadTwoTriangles, gimBand, gimDualColorBand, gimBar);
{$IFDEF GE_LEV29}
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidWin64x)]
{$ENDIF}
TScaleGauge = class (TCustomControl)
private
FInnerFrameSt : TFrameStyle;
FOuterFrameSt : TFrameStyle;
FCaption : string;
FCaptColor : TColor;
FCaptPosX : integer;
FCaptPosY : integer;
FCaptSize : integer;
FCaptStyle : TFontStyles;
FEnabled : boolean;
FGaugeMin : double;
FGaugeMax : double;
FGaugeValue : double; { numeric value of label }
FGaugeWid : integer; // width of gauge display
FGaugeHgt : integer; // height of gauge display
FGaugeOrient : TGaugeOrientation; // orientation of gauge
FGaugeBG : TGaugeBackground;
FGaugeIdxMode : TGaugeIndexMode;
FGaugeZero : double;
FCovMargLeft : integer;
FCovMargRight : integer;
FCovMargTop : integer;
FCovMargBottom: integer;
FLogarithmic : boolean;
FMinTicks : integer;
FShortTicks : boolean;
FColorIndex1 : TColor;
FColorIndex2 : TColor;
FColorSclBG1 : TColor; { color 1 of scale background }
FColorSclBG2 : TColor; { color 2 of scale background }
FColorCover : TColor;
FColorScale : TColor;
FColBlackLine : TColor; { colors to draw the frame }
FColGrayLine : TColor; { -"- }
FColWhiteLine : TColor; { -"- }
FColorScheme : TColorScheme; { color scheme of frames }
FOnMMvInGauge : TMouseMoveInGaugeEvent;
FScale : TScale;
FScaleFixed : boolean;
FGrafBmp : TBitMap;
procedure SetColorSclBg1 (Value: TColor);
procedure SetColorSclBg2 (Value: TColor);
procedure SetColorScheme (Value: TColorScheme);
procedure SetColorIndex1 (Value: TColor);
procedure SetColorIndex2 (Value: TColor);
procedure SetColorCover (Value: TColor);
procedure SetColorScale (Value: TColor);
procedure SetOuterFrameStyle (value: TFrameStyle);
procedure SetInnerFrameStyle (value: TFrameStyle);
procedure SetCaptStyles (Value: TFontStyles);
procedure SetCaption (Value: string);
procedure SetCaptColor (Value: TColor);
procedure SetCaptPosX (Value: integer);
procedure SetCaptPosY (Value: integer);
procedure SetCaptSize (Value: integer);
procedure SetEnabled (value: boolean); override;
procedure SetGaugeBG (value: TGaugeBackground);
procedure SetGaugeIdxMode (value: TGaugeIndexMode);
procedure SetGaugeValue (value: double);
procedure SetGaugeZero (value: double);
procedure SetGaugeMin (value: double);
procedure SetGaugeMax (value: double);
procedure SetGaugeOrientation (value: TGaugeOrientation);
procedure SetLogarithmic (value: boolean);
procedure SetShortTicks (value: boolean);
procedure SetMinTicks (value: integer);
procedure SetMarginBottom (value: integer);
procedure SetMarginLeft (value: integer);
procedure SetMarginRight (value: integer);
procedure SetMarginTop (value: integer);
procedure SetScaleFixed (value: boolean);
procedure SetScaleDims;
procedure WMMouseMoveInGauge (var Message: TWMMouse);
message WM_MOUSEMOVE;
protected
procedure AssignTo (Dest: TPersistent); override;
procedure MouseMove (Shift: TShiftState; X,Y: integer); override;
procedure Paint; override;
procedure MouseMoveInGauge (InGauge: boolean; Shift: TShiftState;
RMousePos: double);
public
procedure Assign(Source: TPersistent); override;
function ConvertPixelToScale (PixelCoord: integer): double;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetBounds (ALeft, ATop, AWidth, AHeight: Integer); override;
published
property Align;
property Anchors;
property Background: TGaugeBackground read FGaugeBG write SetGaugeBG;
property Caption: string read FCaption write SetCaption;
property CaptionColor: TColor read FCaptColor write SetCaptColor;
property CaptionPosX: integer read FCaptPosX write SetCaptPosX;
property CaptionPosY: integer read FCaptPosY write SetCaptPosY;
property CaptionSize: integer read FCaptSize write SetCaptSize;
property CaptionStyle: TFontStyles read FCaptStyle write SetCaptStyles;
property ColorBg1: TColor read FColorSclBG1 write SetColorSclBg1;
property ColorBg2: TColor read FColorSclBg2 write SetColorSclBg2;
property ColorIndex1: TColor read FColorindex1 write SetColorIndex1;
property ColorIndex2: TColor read FColorindex2 write SetColorIndex2;
property ColorCover: TColor read FColorCover write SetColorCover;
property ColorScale: TColor read FColorScale write SetColorScale;
property ColorScheme: TColorScheme
read FColorScheme write SetColorScheme;
property Enabled: boolean read FEnabled write SetEnabled;
property FixedDial: boolean read FScaleFixed write SetScaleFixed;
property Font;
property FrameStyleOuter: TFrameStyle
read FOuterFrameSt write SetOuterFrameStyle;
property FrameStyleInner: TFrameStyle
read FInnerFrameSt write SetInnerFrameStyle;
property GaugeZero: double read FGaugeZero write SetGaugeZero;
property IndexMode: TGaugeIndexMode
read FGaugeIdxMode write SetGaugeIdxMode;
property Logarithmic: boolean read FLogarithmic write SetLogarithmic;
property MarginLeft: integer read FCovMargLeft write SetMarginLeft;
property MarginRight: integer read FCovMargRight write SetMarginRight;
property MarginTop: integer read FCovMargTop write SetMarginTop;
property MarginBottom: integer
read FCovMargBottom write SetMarginBottom;
property Max: double read FGaugeMax write SetGaugeMax;
property Min: double read FGaugeMin write SetGaugeMin;
property MinTicks: integer read FMinTicks write SetMinTicks;
property Orientation: TGaugeOrientation
read FGaugeOrient write SetGaugeOrientation;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShortTicks: boolean read FShortTicks write SetShortTicks;
property ShowHint;
{$IFDEF GE_LEV17}
property StyleElements;
{$ENDIF}
property Value: double read FGaugeValue write SetGaugeValue;
property Visible;
property OnClick;
property OnDblClick;
property OnMouseMove;
property OnMouseDown;
property OnMouseUp;
property OnMouseMoveInGauge: TMouseMoveInGaugeEvent
read FOnMMvInGauge write FOnMMvInGauge;
property OnMouseWheel;
property OnMouseWheelUp;
property OnMouseWheelDown;
property OnKeyPress;
property OnKeyDown;
property OnKeyUp;
end;
procedure Register;
|