const
MAXBARCOLORS = 1023; { number of cells of bar colors - 1 }
{$IFDEF PAIDVERS}
SDLVersionInfo = 'progbar_r1210_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'progbar_r1210_lighted';
IsLightEd = true;
{$ENDIF}
Release = 1210;
type
TColorMapping = (cgmCover, cgmStretch, cgmMove);
TBeforeShowValueEvent = procedure (Sender: TObject;
var ValueText: string) of object;
ESDLProgBar = class(ESDLError); { exception type to indicate errors }
{$IFDEF GE_LEV29}
[ComponentPlatformsAttribute(pidWin32 or pidWin64 or pidWin64x)]
{$ENDIF}
TProgBar = class (TGraphicControl)
private
FTimerHandle : HWND;
FTimerEnabled : boolean;
FOnAutoInc : TNotifyEvent;
FAutoIncStep : double;
FRepeatIv : integer;
FStartIv : integer;
FIsStart : boolean;
FOuterFrameSt : TFrameStyle; { style of outer frame }
FInnerFrameSt : TFrameStyle; { style of inner frame }
FProgValue : double; { progress bar position }
FProgMax : double; { progress bar maximum }
FProgMin : double; { progress bar minimum }
FDirection : TDirection;
FBarColorArray: array[0..MAXBARCOLORS] of TColor; { bar colors }
AuxBmp : TBitMap; { bitmap to hold background picture }
FColorMargin : TColor; { color of margin }
FColorBakG : TColor; { color of progress bar background }
FColorGrad : boolean; { TRUE: color gradient is shown }
FColorGrid : TColor; { color of grid lines }
FGridDist : integer; { distance between grid lines in pixels }
FColBlackLine : TColor; { colors to draw the frame }
FColGrayLine : TColor; { -"- }
FColWhiteLine : TColor; { -"- }
FColorScheme : TColorScheme; { color scheme of frames }
FColorMapMode : TColorMapping; {color mapping of progress bar }
FMarginLeft : integer; { left margin }
FMarginRight : integer; { right margin }
FMarginTop : integer; { top margin }
FMarginBottom : integer; { bottom margin }
FBakGndFile : string; { background file }
FTextPosX : integer; { position of prog. bar value text }
FTextPosY : integer;
FTextDecPlaces: integer; { number of decimal places for value }
FTextAngle : integer; { rotation angle of text }
FAlignment : TAlignment; { alignment of value label }
FOnShowValue : TBeforeShowValueEvent;
FShowValue : boolean; { TRUE: Value is shown in numeric form }
function GetBarColorElem (ix: integer): TColor;
procedure SetAutoIncStep (value: double);
procedure SetBarColorElem (ix: integer; value: TColor);
procedure SetColorMargin (Value: TColor);
procedure SetColorBakG (Value: TColor);
procedure SetColorGrad (Value: boolean);
procedure SetColorGrid (Value: TColor);
procedure SetColorMapMode (Value: TColorMapping);
procedure SetGridDist (Value: integer);
procedure SetMarginBottom (Value: integer);
procedure SetMarginTop (Value: integer);
procedure SetMarginLeft (Value: integer);
procedure SetMarginRight (Value: integer);
procedure SetColorScheme (Value: TColorScheme);
function GetColorMin: TColor;
function GetColorMax: TColor;
procedure SetColorMin (value: TColor);
procedure SetColorMax (value: TColor);
procedure SetDirection (value: TDirection);
procedure SetOuterFrameStyle (value: TFrameStyle);
procedure SetInnerFrameStyle (value: TFrameStyle);
procedure SetPBarValue (value: double);
procedure SetPBarMin (value: double);
procedure SetPBarMax (value: double);
procedure SetBakGndFile (value: string);
procedure SetTextPosX (value: integer);
procedure SetTextPosY (value: integer);
procedure SetTextDecPl (value: integer);
procedure SetAutoInc (value: boolean);
procedure SetAlignment (value: TAlignment);
procedure SetShowValue (value: boolean);
procedure SetTextAngle (value: integer);
procedure SetOnAutoInc(Value: TNotifyEvent);
procedure SetRepeatIv (value: integer);
procedure SetStartIv (value: integer);
procedure UpdateTimer;
procedure InitTimer;
protected
procedure AssignTo (Dest: TPersistent); override;
procedure AutoIncEvent(Sender: TObject);
procedure MouseMove (Shift: TShiftState; X,Y: integer); override;
procedure Paint; override;
procedure DoTimer; dynamic;
procedure WndProc(var Msg: TMessage); { virtual method of base class
is hidden deliberately }
public
procedure Assign(Source: TPersistent); override;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property BarColors[ix: integer]: TColor
read GetBarColorElem write SetBarColorElem;
procedure SetRange (min, max: double);
published
property Align;
{$IFNDEF LEVEL3} // CBuilder / Delphi 3.0 do not know about anchors
property Anchors;
property Constraints;
{$ENDIF}
property AutoInc: boolean read FTimerEnabled write SetAutoInc;
property AutoIncStep: double read FAutoIncStep write SetAutoIncStep;
property BackGroundImg: string read FBakGndFile write SetBakGndFile;
property ColorBackGnd: TColor read FColorBakG write SetColorBakG;
property ColorMapMode: TColorMapping
read FColorMapMode write SetColorMapMode;
property ColorGrid: TColor read FColorGrid write SetColorGrid;
property ColorMargin: TColor read FColorMargin write SetColorMargin;
property ColorScheme: TColorScheme
read FColorScheme write SetColorScheme;
property ColorMin: TColor read GetColorMin write SetColorMin;
property ColorMax: TColor read GetColorMax write SetColorMax;
property Font;
property FrameStyleOuter: TFrameStyle
read FOuterFrameSt write SetOuterFrameStyle;
property FrameStyleInner: TFrameStyle
read FInnerFrameSt write SetInnerFrameStyle;
property GridDist: integer read FGridDist write SetGridDist;
property MarginBottom: integer
read FMarginBottom write SetMarginBottom;
property MarginLeft: integer read FMarginLeft write SetMarginLeft;
property MarginRight: integer read FMarginRight write SetMarginRight;
property MarginTop: integer read FMarginTop write SetMarginTop;
property Max: double read FProgMax write SetPbarMax;
property Min: double read FProgMin write SetPbarMin;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property Direction: TDirection read FDirection write SetDirection;
property RepeatInterval: integer
read FRepeatIv write SetRepeatIv;
property ShowColorGradient: boolean read FColorGrad write SetColorGrad;
property ShowHint;
property StartInterval: integer read FStartIv write SetStartIv;
{$IFDEF GE_LEV17}
(**) property StyleElements;
{$ENDIF}
property TextAlignment: TAlignment read FAlignment write SetAlignment;
property TextAngle: integer read FTextAngle write SetTextAngle;
property TextDecPlaces: integer read FTextDecPlaces write SetTextDecPl;
property TextPosX: integer read FTextPosX write SetTextPosX;
property TextPosY: integer read FTextPosY write SetTextPosY;
property TextVisible: boolean read FShowValue write setshowvalue;
property Value: double read FProgValue write SetPBarValue;
property Visible;
property OnAutoInc: TNotifyEvent
read FOnAutoInc write SetOnAutoInc;
property OnClick;
property OnDblClick;
property OnMouseMove;
property OnMouseDown;
property OnMouseUp;
property OnShowValue: TBeforeShowValueEvent
read FOnShowValue write fonshowvalue;
end;
|