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_Scale

const
{$IFDEF PAIDVERS}
  SDLVersionInfo = 'scale_r1050_full';
  IsLightEd = false;
{$ELSE}
  SDLVersionInfo = 'scale_r1050_lighted';
  IsLightEd = true;
{$ENDIF}
  release = 1050;

type
  TScaleTickDrawnEvent = procedure (Sender: TObject; Canvas: TCanvas;
                                    ScaleType: TScaleType; CurrentTickPos: double;
                                    ChartX, ChartY: integer) of object;

  TBeforeTickLabelEvent = procedure (Sender: TObject; ScaleType: TScaleType;
            CurrentTickPos: double; var TickLabel: string) of object;

  TScaleRenderedEvent = procedure (Sender: TObject; Canvas: TCanvas) of object;
  TScaleUnitAnchor = (uaSclTopLft, uaSclCenter, uaSclBotRgt);
  TScale = class (TCustomControl) //(TGraphicControl)
           private
             FFrameStyle       : TFrameStyle;                  { style of frame }
             FColorFG          : TColor;
             FColorBG          : TColor;            { color of label background }
             FColBlackLine     : TColor;             { colors to draw the frame }
             FColGrayLine      : TColor;                            { -"- }
             FColWhiteLine     : TColor;                            { -"- }
             FColorScheme      : TColorScheme;         { color scheme of frames }
             FOnScaleTickDrawn : TScaleTickDrawnEvent;
             FOnBeforeTickLabel: TBeforeTickLabelEvent;
             FAxLog            : boolean;         { TRUE if axis is logarithmic }
             FTransf_k         : double;
             FTransf_d         : double;
             FRangeHigh        : double;
             FRangeLow         : double;
             FShortTicks       : boolean;
             FTickCount        : integer;
             FNumTicks         : integer;
             FDecPlaces        : integer;
             FNotYetLoaded     : boolean;  // flag to prevent problems with
                                           // log. scales during component loading
             FDrawBaseLine     : boolean;
             FTransparent      : boolean;
             FLabelType        : TFigType;
             FDTFormat         : TDTLabel;
             FMarginTop        : integer;
             FMarginBottom     : integer;
             FMarginRight      : integer;
             FMarginLeft       : integer;
             FIsHelper         : boolean;
             FLblPosX          : integer;
             FLblPosY          : integer;
             FLblAlign         : TAlignment;
             FLblAnchor        : TScaleUnitAnchor;
             FUserTicktext     : string;
             FScaleInscript    : string;
             FScaleTickPos     : array of double;
             FUnitLabel        : string;
             FForeignCv        : TCanvas;
             FForCvPosX        : integer;
             FForCvPosY        : integer;
             FScaleType        : TScaleType;
             FOnBeforeSclRend  : TScaleRenderedEvent;
             FOnAfterSclRend   : TScaleRenderedEvent;
             FSuppressPaint    : boolean;     { TRUE: suppress all paint calls }
             procedure AdjustScalePars;
             function  GetScaleCenter: double;
             function  GetTickPos (ix: integer): double;
             procedure SetColorBG (Value: TColor);
             procedure SetColorFG (Value: TColor);
             procedure SetColorScheme (Value: TColorScheme);
             procedure SetFrameStyle (value: TFrameStyle);
             procedure SetScaleType (Value: TScaleType);
             procedure SetUnitLabel (Value: string);
             procedure SetCaptAlign (al: TAlignment);
             procedure SetCaptAnchor (ca: TScaleUnitAnchor);
             procedure SetIsHelper (value: boolean);
             procedure SetMarginTop (Value: integer);
             procedure SetMarginBottom (Value: integer);
             procedure SetMarginLeft (Value: integer);
             procedure SetMarginRight (Value: integer);
             procedure SetRangeHigh (Value: double);
             procedure SetRangeLow (Value: double);
             procedure SetDecPlaces (Value: integer);
             procedure SetShowBaseLine (Value: boolean);
             procedure SetTransparent (Value: boolean);
             procedure SetUserTickText (txt: String);
             procedure SetAxLinLog (Value: boolean);
             procedure SetLabelType (Value: TFigType);
             procedure SetShortTicks (st: boolean);
             procedure SetScaleInscript (x: string);
             procedure SetDTFormat (value: TDTLabel);
             procedure SetNumTicks (d: integer);
             procedure SetUnitLabelPosX (value: integer);
             procedure SetUnitLabelPosY (value: integer);
             procedure SetSuppressPaint (supp: boolean);
             procedure SetForCvPosX (value: integer);
             procedure SetForCvPosY (value: integer);
           protected
             procedure CreateWnd; override;
             procedure AssignTo (Dest: TPersistent); override;
             procedure MouseMove (Shift: TShiftState; X,Y: integer); override;
             procedure Paint; override;
             function  ExtractUserText (TickText: string; ix: integer): string;
             function  AddScaleInscription (Instring: string; Inscr: string): string;
             procedure DrawYScale (cv: TCanvas; XPos: integer);
             procedure DrawXScale (cv: TCanvas; YPos: integer);
             procedure Loaded; override;
             function  R2M (xin: double): longint;
             function  M2R (xin: longint): double;
             procedure TriggerPaint;
           public
             procedure   Assign(Source: TPersistent); override;
             constructor Create(AOwner: TComponent); override;
             destructor  Destroy; override;
             procedure Changed (Sender: TObject);
             property  Center: double read GetScaleCenter;
             property  Enabled;
             property  IsHelperComponent: boolean
                          read FIsHelper write SetIsHelper;
             property  TickPos [ix: integer]: double read GetTickPos;
             procedure UseForeignCanvas (ForeignCv: TCanvas; x, y: integer);
             procedure ForcePaint;
             property  ForeignCanvasPosX: integer
                          read FForCvPosX write SetForCVPosX;
             property  ForeignCanvasPosY: integer
                          read FForCvPosY write SetForCVPosY;
             function  ConvertToPixelCoords (Value: double): integer;
             function  ConvertPixelToScale (PixelCoord: integer): double;
             procedure ResetComp;
             procedure SetBounds (ALeft, ATop, AWidth, AHeight: Integer); override;
             procedure SetRange (LowVal, HighVal: double);
             property  SuppressPaint: boolean
                          read FSuppressPaint write SetSuppressPaint;
           published
             property Align;
             property Anchors;
             property Caption: string read FUnitLabel write SetUnitLabel;
             property CaptionPosX: integer read FLblPosX write SetUnitLabelPosX;
             property CaptionPosY: integer read FLblPosY write SetUnitLabelPosY;
             property CaptionAlignment: TAlignment
                         read FLblAlign write SetCaptAlign;
             property CaptionAnchor: TScaleUnitAnchor
                         read FLblAnchor write SetCaptAnchor;
             property ColorBackGnd: TColor read FColorBG write SetColorBG;
             property ColorScale: TColor read FColorFG write SetColorFG;
             property ColorScheme: TColorScheme
                         read FColorScheme write SetColorScheme;
             property DateFormat: TDTLabel read FDTFormat write SetDTFormat;
             property DecPlaces: integer read FDecPlaces write SetDecPlaces;
             property Font;
             property FrameStyle: TFrameStyle read FFrameStyle write SetFrameStyle;
             property LabelType: TFigType read FLabelType write SetLabelType;
             property Logarithmic: boolean read FAxLog write SetAxLinLog;
             property MarginTop: integer read FMarginTop write SetMarginTop;
             property MarginBottom: integer
                         read FMarginBottom write SetMarginBottom;
             property MarginLeft: integer read FMarginLeft write SetMarginLeft;
             property MarginRight: integer read FMarginRight write SetMarginRight;
             property MinTicks: integer read FNumTicks write SetNumTicks;
             property NumTicks: integer read FTickCount;
             property ParentFont;
             property ParentShowHint;
             property PopupMenu;
             property RangeLow: double read FRangeLow write SetRangeLow;
             property RangeHigh: double read FRangeHigh write SetRangeHigh;
             property ShortTicks: boolean read FShortTicks write SetShortTicks;
             property ShowBaseLine: boolean
                         read FDrawBaseLine write SetShowBaseLine;
             property ShowHint;
             property ScaleInscript: string
                         read FScaleInscript write SetScaleInscript;
             property ScaleType: TScaleType read FScaleType write SetScaleType;
{$IFDEF GE_LEV17}
(**)              property StyleElements;
{$ENDIF}
             property Transparent: boolean read FTransparent write SetTransparent;
             property UserTickText: string
                         read FUserTickText write SetUserTickText;
             property Visible;
             property OnClick;
             property OnDblClick;
             property OnMouseMove;
             property OnMouseDown;
             property OnMouseUp;
{$IFDEF GE_LEV5}               // CBuilder/Delphi 3/4 do not know about
             property OnContextPopup;
{$ENDIF}
             property OnScaleTickDrawn: TScaleTickDrawnEvent
                         read FOnScaleTickDrawn write FOnScaleTickDrawn;
             property OnBeforeTickLabel: TBeforeTickLabelEvent
                         read FOnBeforeTickLabel write FOnBeforeTickLabel;
             property OnAfterScaleRendered: TScaleRenderedEvent
                         read FOnAfterSclRend write FOnAfterSclRend;
             property OnBeforeScaleRendered: TScaleRenderedEvent
                         read FOnBeforeSclRend write FOnBeforeSclRend;
           end;





Last Update: 2012-Oct-20