The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Interface of SDL_Meter


const
  defWidth = 10.0;
{$IFDEF PAIDVERS}
  SDLVersionInfo = 'meter_r1050_full';
  IsLightEd = false;
{$ELSE}
  SDLVersionInfo = 'meter_r1050_lighted';
  IsLightEd = true;
{$ENDIF}
  release = 1050;

type
  TMeterLayout = (mlCirc90, mlCirc120, mlCirc180,
                  mlCirc270, mlCirc300, mlCirc360);             { meter layout }
  TmtBeforeDrawScaleLabelEvent = procedure (Sender: TObject; Canvas: TCanvas;
            var CurrentTickLabel: string; ChartX, ChartY: integer) of object;
  TMeterRenderedEvent = procedure (Sender: TObject; Canvas: TCanvas) of object;
  TMouseMoveInMeterEvent = procedure (Sender: TObject; WithinRange: boolean;
            Shift: TShiftState; MeterValue: double) of object;
  TBeforeDrawNeedleEvent = procedure (Sender: TObject; Canvas: TCanvas;
            var NeedleDrawn: boolean) of object;
  TNeedleLayout = class (TPersistent)            { parameters of needle layout }
           private
             FColorFill    : TColor;                          { color of arrow }
             FColorLine    : TColor;                    { color of arrow frame }
             FSize1        : integer;                     { size of arrow head }
             FThickness    : integer;               { thickness of arrow shaft }
             FPctNeedleLeng: integer;      { percent of standard needle length }
             FAngle1       : integer;                    { angle of arrow head }
             FBackShift1   : integer;            { flatness of arrow head base }
             FShadowDx     : integer;                     { x-shift for shadow }
             FShadowDy     : integer;                     { y-shift for shadow }
             FShadowColor  : TColor;                         { color of shadow }
             FOnChange     : TNotifyEvent;
             FVisible      : boolean;                { TRUE: needle is visible }
             procedure SetArrowSize1 (Value: integer);
             procedure SetBackShift1 (Value: integer);
             procedure SetArrowThick (Value: integer);
             procedure SetArrowAngle1 (Value: integer);
             procedure SetColorFill (Value: TColor);
             procedure SetColorLine (Value: TColor);
             procedure SetNeedleLength (Value: integer);
             procedure SetShadowDx (Value: integer);
             procedure SetShadowDy (Value: integer);
             procedure SetShadowColor (Value: TColor);
             procedure SetVisible (Value: boolean);
           protected
           public
             constructor Create;
             destructor Destroy; override;
             procedure  Changed;
           published
             property HeadSize: integer read FSize1 write SetArrowSize1;
             property HeadAngle: integer read FAngle1 write SetArrowAngle1;
             property HeadMidLeng: integer read FBackShift1 write SetBackShift1;
             property Thickness: integer read FThickness write SetArrowThick;
             property ColorBody: TColor read FColorFill write SetColorFill;
             property ColorOutline: TColor read FColorLine write SetColorLine;
             property PercentNeedleLength: integer
                          read FPctNeedleLeng write SetNeedleLength;
             property ShadowDx: integer read FShadowDx write SetShadowDx;
             property ShadowDy: integer read FShadowDy write SetShadowDy;
             property ShadowColor: TColor read FShadowColor write SetShadowColor;
             property Visible: boolean read FVisible write SetVisible;
             property OnChange: TNotifyEvent read FOnChange write FOnChange;
           end;


  TMeter = class (TGraphicControl)
           private
             FAnchorCovrd  : boolean;                   { True: anchor visible }
             AuxBGBmp      : TBitMap;      { bitmap to hold background picture }
             AuxACBmp      : TBitMap;    { bitmap to hold anchor cover picture }
             AuxACMaskBmp  : TBitMap;    { bitmap to hold anchor cover picture }
             FBakGndFName  : string;
             FBGFillMode   : TBkgFill;
             FACoverFName  : string;
             FLogarithmic  : boolean;                { TRUE: logarithmic scale }
             FScaleVis     : boolean;                 { TRUE: scale is visible }
             FSizeAnchor   : integer;                  { size of needle anchor }
             FLimWatHighOn : boolean;          { TRUE: overflow limit watch on }
             FLimWatLowOn  : boolean;           { TRUE: underflow indicator on }
             FLimWatActCol : TColor;             { active color of limit watch }
             FLimWatPsvCol : TColor;            { passive color of limit watch }
             FOFL          : boolean;                { TRUE: overflow occurred }
             FUFL          : boolean;               { TRUE: underflow occurred }
             FColorScale   : TColor;                          { color of scale }
             FCaption      : string;                                 { unit ID }
             FFrameStyle   : TFrameStyle;                     { style of frame }
             FDecPlaces    : integer;                  { nr. of decimal places }
             FNrTicks      : integer;                  { number of scale ticks }
             FBRim         : integer;                             { bottom rim }
             FSRim         : integer;                               { side rim }
             FTRim         : integer;                                { top rim }
             FShortTicks   : boolean;            { TRUE: short ticks are drawn }
             FScaleLine    : boolean;              { TRUE: scale line is drawn }
             FColorBakG    : TColor;               { color of meter background }
             FColorCover   : TColor;                    { color of cover metal }
             FColBlackLine : TColor;                { colors to draw the frame }
             FColGrayLine  : TColor;                             { -"- }
             FColWhiteLine : TColor;                             { -"- }
             FColorScheme  : TColorScheme;            { color scheme of frames }
             FColorBakGLow : TColor;          { scale background, "low" region }
             FColorBakGNorm: TColor;       { scale background, "normal" region }
             FColorBakGHigh: TColor;         { scale background, "high" region }
             FFontCaption  : TFont;                          { font of caption }
             FScaleBakWidth: double;          { width of scale background ring }
             FScaleBkVis   : boolean;       { colored scale background visible }
             FLowThreshold : double;            { upper border of "low" region }
             FHighThreshold: double;           { lower border of "high" region }
             FNeedleLayout : TNeedleLayout;          { layout params of needle }
             FNeedle2Layout: TNeedleLayout;      { layout params of 2nd needle }
             FMeterLayout  : TMeterLayout;                   { layout of meter }
             FMeterAngle   : integer;     { angle, corresponds to FMeterLayout }
             FMeterRadius  : double;                   { radius of meter scale }
             FMeterCenterX : integer;                  { pos. of needle anchor }
             FMeterCenterY : integer;                  { pos. of needle anchor }
             FValue        : double;                   { value of meter needle }
             FValue2       : double;         { value of secondary meter needle }
             FMinValue     : double;                  { minimum value of meter }
             FMaxValue     : double;                  { maximum value of meter }
             FOnMMvInMeter : TMouseMoveInMeterEvent;
             FOnOverFlow   : TNotifyEvent;
             FOnUnderFlow  : TNotifyEvent;
             FOnNormalRange: TNotifyEvent;
             FOnBefDrawSclLab : TmtBeforeDrawScaleLabelEvent;
             FOnMeterRendered : TMeterRenderedEvent;
             FOnBefDrawNeedle : TBeforeDrawNeedleEvent;
             procedure SetAnchorCovrd (Value: boolean);
             procedure SetACoverFname (Value: string);
             procedure SetBakGndFname (Value: string);
             procedure SetBGFillMode (Value: TBkgFill);
             procedure SetSizeAnchor (Value: integer);
             procedure SetColorScale (Value: TColor);
             procedure SetColorBakG (Value: TColor);
             procedure SetColorCover (Value: TColor);
             procedure SetColorScheme (Value: TColorScheme);
             procedure SetColorBakgLow (Value: TColor);
             procedure SetColorBakgNorm (Value: TColor);
             procedure SetColorBakgHigh (Value: TColor);
             procedure SetFrameStyle (value: TFrameStyle);
             procedure SetDecPlaces (Value: integer);
             procedure SetNrTicks (Value: integer);
             procedure SetBRim (Value: integer);
             procedure SetTRim (Value: integer);
             procedure SetSRim (Value: integer);
             procedure SetValue (Value: double);
             procedure SetValue2 (Value: double);
             procedure SetFontCaption (Value: TFont);
             procedure SetMeterLayout (Value: TMeterLayout);
             procedure SetMinValue (Value: double);
             procedure SetMaxValue (Value: double);
             procedure SetLowThreshold (Value: double);
             procedure SetHighThreshold (Value: double);
             procedure SetLimWatHighOn (Value: boolean);
             procedure SetLimWatLowOn (Value: boolean);
             procedure SetLimWatActCol (Value: TColor);
             procedure SetLimWatPsvCol (Value: TColor);
             procedure SetLogarithmic (value: boolean);
             procedure SetNeedleLayout (x: TNeedleLayout);
             procedure SetNeedle2Layout (x: TNeedleLayout);
             procedure SetShortTicks (Value: boolean);
             procedure SetScaleLine (Value: boolean);
             procedure SetScaleBkWidth (Value: double);
             procedure SetScaleBkVis (Value: boolean);
             procedure SetScaleVis (Value: boolean);
             procedure SetUnitLabel (astr: string);
             function  CalcM (DecPlaces: integer; lo, hi: double):integer;
             procedure WMMouseMoveInMeter(var Message: TWMMouse);
                           message WM_MOUSEMOVE;
           protected
             procedure Paint; override;
             procedure StyleChanged (Sender: TObject);
             procedure CalcMeterLayoutParams;
             procedure Loaded; override;
             procedure DoOverFlowEvent;
             procedure DoUnderFlowEvent;
             procedure DoNormalRangeEvent;
             procedure MouseMoveInMeter (InRange: boolean; Shift: TShiftState;
                           MeterValue: double);
           public
             constructor Create(AOwner: TComponent); override;
             destructor  Destroy; override;
             function  CalcNeedleAngle (value: double): double;
             procedure ConvertToPixelCoords (value, pctradius: double;
                           var X, Y: integer);
             function  ConvertPixelToValue (XPos, YPos: integer;
                           var MeterValue: double): boolean;
             property  OriginX: integer read FMeterCenterX;
             property  OriginY: integer read FMeterCenterY;
             procedure SetBounds (ALeft, ATop, AWidth, AHeight: Integer); override;
             property  ScaleRadius: double read FMeterRadius;
           published
             property Align;
             property AnchorSize: integer read FSizeAnchor write SetSizeAnchor;
             property AnchorCovered: boolean read FAnchorCovrd write SetAnchorCovrd;
             property AnchorImage: string read FACoverFName write SetACoverFname;
             property BackGroundImg: string read FBakGndFName write SetBakGndFname;
             property BkgndFillMode: TBkgFill read FBGFillMode write SetBGFillMode;
             property Caption: string read FCaption write SetUnitLabel;
             property ColorBakG: TColor read FColorBakG write SetColorBakG;
             property ColorCover: TColor read FColorCover write SetColorCover;
             property ColorScale: TColor read FColorScale write SetColorScale;
             property ColorScheme: TColorScheme
                          read FColorScheme write SetColorScheme;
             property ColorSclBkLow: TColor
                          read FColorBakGLow write SetColorBakGLow;
             property ColorSclBkNorm: TColor
                          read FColorBakGNorm write SetColorBakGNorm;
             property ColorSclBkHigh: TColor
                          read FColorBakGHigh write SetColorBakGHigh;
    {$IFNDEF ISCLX}
             property DragKind;
             property DragCursor;
             property DragMode;
    {$ENDIF}
             property Font;
             property FontCaption: TFont read FFontCaption write SetFontCaption;
             property FrameStyle: TFrameStyle read FFrameStyle write SetFrameStyle;
             property Hint;
             property LimWatchHighOn: boolean
                          read FLimWatHighOn write SetLimWatHighOn;
             property LimWatchLowOn: boolean
                          read FLimWatLowOn write SetLimWatLowOn;
             property LimWatchActColor: TColor
                          read FLimWatActCol write SetLimWatActCol;
             property LimWatchPsvColor: TColor
                          read FLimWatPsvCol write SetLimWatPsvCol;
             property Logarithmic: boolean
                          read FLogarithmic write SetLogarithmic;
             property ThresholdLow: double
                          read FLowThreshold write SetLowThreshold;
             property ThresholdHigh: double
                          read FHighThreshold write SetHighThreshold;
             property MeterMinValue: double
                          read FMinValue write SetMinValue;
             property MeterMaxValue: double
                          read FMaxValue write SetMaxValue;
             property MeterDecPlaces: integer
                          read FDecPlaces write SetDecPlaces;
             property MeterNrTicks: integer read FNrTicks write SetNrTicks;
             property MeterLayout: TMeterLayout
                          read FMeterLayout write SetMeterLayout;
             property MeterShortTicks: boolean
                          read FShortTicks write SetShortTicks;
             property MeterScaleLine: boolean read FScaleLine write SetScaleLine;
             property NeedleLayout: TNeedleLayout
                          read FNeedleLayout write SetNeedleLayout;
             property NeedleLayoutSec: TNeedleLayout
                          read FNeedle2Layout write SetNeedle2Layout;
             property ParentFont;
             property ParentShowHint;
             property RimBottom: integer read FBRim write SetBrim;
             property RimTop: integer read FTRim write SetTRim;
             property RimSide: integer read FSRim write SetSRim;
             property ScaleBkWidth: double
                          read FScaleBakWidth write SetScaleBkWidth;
             property ScaleBkVisible: boolean
                          read FScaleBkVis write SetScaleBkVis;
             property ScaleVisible: boolean read FScaleVis write SetScaleVis;
             property ShowHint;
{$IFDEF GE_LEV17}
(**)              property StyleElements;
{$ENDIF}
             property Value: double read FValue write SetValue;
             property ValueSec: double read FValue2 write SetValue2;
             property Visible;
             property OnBeforeDrawNeedle: TBeforeDrawNeedleEvent
                          read FOnBefDrawNeedle write FOnBefDrawNeedle;
             property OnBeforeDrawScaleLabel: TmtBeforeDrawScaleLabelEvent
                          read FOnBefDrawSclLab write FOnBefDrawSclLab;
             property OnClick;
             property OnDblClick;
             property OnDragDrop;
             property OnDragOver;
             property OnEndDrag;
             property OnMeterRendered: TMeterRenderedEvent
                          read FOnMeterRendered write FOnMeterRendered;
             property OnMouseMove;
             property OnMouseMoveInMeter: TMouseMoveInMeterEvent
                          read FOnMMvInMeter write FOnMMvInMeter;
             property OnMouseDown;
             property OnMouseUp;
             property OnNormalRange: TNotifyEvent
                          read FOnNormalRange write FOnNormalRange;
             property OnOverFlow: TNotifyEvent read FOnOverFlow write FOnOverFlow;
             property OnStartDrag;
             property OnUnderFlow: TNotifyEvent
                          read FOnUnderFlow write FOnUnderFlow;
           end;






Last Update: 2012-Oct-20