You've already forked lazarus-ccr
jvcllaz: Fix compilation of JvHMILazR/D packages.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6655 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -4,9 +4,6 @@
|
|||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
|
||||||
<UseDefaultCompilerOptions Value="True"/>
|
|
||||||
</Flags>
|
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<Title Value="JvLEDDemo"/>
|
<Title Value="JvLEDDemo"/>
|
||||||
@ -16,7 +13,6 @@
|
|||||||
<XPManifest>
|
<XPManifest>
|
||||||
<DpiAware Value="True"/>
|
<DpiAware Value="True"/>
|
||||||
</XPManifest>
|
</XPManifest>
|
||||||
<Icon Value="0"/>
|
|
||||||
</General>
|
</General>
|
||||||
<BuildModes Count="1">
|
<BuildModes Count="1">
|
||||||
<Item1 Name="Default" Default="True"/>
|
<Item1 Name="Default" Default="True"/>
|
||||||
@ -55,9 +51,10 @@
|
|||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<Target>
|
<Target>
|
||||||
<Filename Value="JvLEDDemo"/>
|
<Filename Value="..\..\bin\JvLEDDemo"/>
|
||||||
</Target>
|
</Target>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Linking>
|
<Linking>
|
||||||
|
@ -7,6 +7,7 @@ uses
|
|||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
Application.Scaled:=True;
|
||||||
Application.Initialize;
|
Application.Initialize;
|
||||||
Application.CreateForm(TLEDDemoMain, LEDDemoMain);
|
Application.CreateForm(TLEDDemoMain, LEDDemoMain);
|
||||||
Application.Run;
|
Application.Run;
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="..\resource"/>
|
||||||
<OtherUnitFiles Value="..\design\JvMM"/>
|
<OtherUnitFiles Value="..\design\JvMM"/>
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\design\JvMM"/>
|
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\design\JvMM"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Version Major="1" Release="4"/>
|
<Version Major="1" Release="4"/>
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="..\resource"/>
|
||||||
<OtherUnitFiles Value="..\run\JvMM"/>
|
<OtherUnitFiles Value="..\run\JvMM"/>
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\run\JvMM"/>
|
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\run\JvMM"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Description Value="JVCL Multimedia Components (Runtime)."/>
|
<Description Value="JVCL Multimedia Components (Runtime)."/>
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="..\resource"/>
|
||||||
<OtherUnitFiles Value="..\design\JvHMI"/>
|
<OtherUnitFiles Value="..\design\JvHMI"/>
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\design\JvHMI"/>
|
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\design\JvHMI"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Description Value="JVCL Human-Machine-Interface (HMI) Components (design-time) containing these components
|
<Description Value="JVCL Human-Machine-Interface (HMI) Components (design-time) containing these components
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
<Version Value="11"/>
|
<Version Value="11"/>
|
||||||
<PathDelim Value="\"/>
|
<PathDelim Value="\"/>
|
||||||
<SearchPaths>
|
<SearchPaths>
|
||||||
|
<IncludeFiles Value="..\resource"/>
|
||||||
<OtherUnitFiles Value="..\run\JvHMI"/>
|
<OtherUnitFiles Value="..\run\JvHMI"/>
|
||||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)\run\JvHMI"/>
|
<UnitOutputDirectory Value="..\lib\$(TargetCPU)-$(TargetOS)\run\JvHMI"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Description Value="JVCL Human-Machine-Interface (HMI) Components (run-time) containing these components
|
<Description Value="JVCL Human-Machine-Interface (HMI) Components (run-time) containing these components
|
||||||
|
@ -33,7 +33,9 @@ unit JvThemes;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Types, SysUtils, Classes, Contnrs,
|
LCLType, LCLIntf, LMessages,
|
||||||
|
//Types,
|
||||||
|
SysUtils, Classes, Contnrs,
|
||||||
{$IFDEF JVCLThemesEnabled}
|
{$IFDEF JVCLThemesEnabled}
|
||||||
Themes,
|
Themes,
|
||||||
{$ENDIF JVCLThemesEnabled}
|
{$ENDIF JVCLThemesEnabled}
|
||||||
@ -80,8 +82,8 @@ type
|
|||||||
out Size: TSize): Boolean; overload;
|
out Size: TSize): Boolean; overload;
|
||||||
function GetElementSize(DC: HDC; Details: TThemedElementDetails; const Rect: TRect;
|
function GetElementSize(DC: HDC; Details: TThemedElementDetails; const Rect: TRect;
|
||||||
ElementSize: TElementSize; out Size: TSize): Boolean; overload;
|
ElementSize: TElementSize; out Size: TSize): Boolean; overload;
|
||||||
|
********************)
|
||||||
function IsSystemStyle: Boolean;
|
function IsSystemStyle: Boolean;
|
||||||
********************)
|
|
||||||
function Enabled: Boolean;
|
function Enabled: Boolean;
|
||||||
function Available: Boolean;
|
function Available: Boolean;
|
||||||
(********************
|
(********************
|
||||||
@ -119,7 +121,6 @@ procedure IncludeThemeStyle(Control: TControl; Style: TJvThemeStyle);
|
|||||||
procedure ExcludeThemeStyle(Control: TControl; Style: TJvThemeStyle);
|
procedure ExcludeThemeStyle(Control: TControl; Style: TJvThemeStyle);
|
||||||
function GetThemeStyle(Control: TControl): TJvThemeStyle;
|
function GetThemeStyle(Control: TControl): TJvThemeStyle;
|
||||||
|
|
||||||
(***************************** NOT CONVERTED ***
|
|
||||||
{ DrawThemedBackground fills R with Canvas.Brush.Color/Color. If the control uses
|
{ DrawThemedBackground fills R with Canvas.Brush.Color/Color. If the control uses
|
||||||
csParentBackground and the color is that of it's parent the Rect is not filled
|
csParentBackground and the color is that of it's parent the Rect is not filled
|
||||||
because then it is done by the JvThemes/VCL7. }
|
because then it is done by the JvThemes/VCL7. }
|
||||||
@ -130,9 +131,10 @@ procedure DrawThemedBackground(Control: TControl; Canvas: TCanvas;
|
|||||||
procedure DrawThemedBackground(Control: TControl; DC: HDC; const R: TRect;
|
procedure DrawThemedBackground(Control: TControl; DC: HDC; const R: TRect;
|
||||||
Brush: HBRUSH; NeedsParentBackground: Boolean = True); overload;
|
Brush: HBRUSH; NeedsParentBackground: Boolean = True); overload;
|
||||||
|
|
||||||
|
(***************************** NOT CONVERTED ***
|
||||||
{ DrawThemesFrameControl draws a themed frame control when theming is enabled. }
|
{ DrawThemesFrameControl draws a themed frame control when theming is enabled. }
|
||||||
function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL;
|
function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL;
|
||||||
|
*)
|
||||||
|
|
||||||
{ PerformEraseBackground sends a WM_ERASEBKGND message to the Control's parent. }
|
{ PerformEraseBackground sends a WM_ERASEBKGND message to the Control's parent. }
|
||||||
procedure PerformEraseBackground(Control: TControl; DC: HDC; Offset: TPoint); overload;
|
procedure PerformEraseBackground(Control: TControl; DC: HDC; Offset: TPoint); overload;
|
||||||
@ -141,6 +143,7 @@ procedure PerformEraseBackground(Control: TControl; DC: HDC); overload;
|
|||||||
procedure PerformEraseBackground(Control: TControl; DC: HDC; const R: TRect); overload;
|
procedure PerformEraseBackground(Control: TControl; DC: HDC; const R: TRect); overload;
|
||||||
|
|
||||||
|
|
||||||
|
(***************************** NOT CONVERTED ***
|
||||||
{ DrawThemedButtonFace draws a themed button when theming is enabled. }
|
{ DrawThemedButtonFace draws a themed button when theming is enabled. }
|
||||||
function DrawThemedButtonFace(Control: TControl; Canvas: TCanvas; const Client: TRect;
|
function DrawThemedButtonFace(Control: TControl; Canvas: TCanvas; const Client: TRect;
|
||||||
BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
|
BevelWidth: Integer; Style: TButtonStyle; IsRounded, IsDown,
|
||||||
@ -179,7 +182,6 @@ uses
|
|||||||
JclSysInfo;
|
JclSysInfo;
|
||||||
*)
|
*)
|
||||||
|
|
||||||
(************************ NOT CONVERTED ***
|
|
||||||
type
|
type
|
||||||
TWinControlThemeInfo = class(TWinControl)
|
TWinControlThemeInfo = class(TWinControl)
|
||||||
public
|
public
|
||||||
@ -260,6 +262,7 @@ begin
|
|||||||
FillRect(DC, R, Brush);
|
FillRect(DC, R, Brush);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
(************************ NOT CONVERTED ***
|
||||||
function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL;
|
function DrawThemedFrameControl(DC: HDC; const Rect: TRect; uType, uState: UINT): BOOL;
|
||||||
{$IFDEF JVCLThemesEnabled}
|
{$IFDEF JVCLThemesEnabled}
|
||||||
const
|
const
|
||||||
@ -483,6 +486,7 @@ begin
|
|||||||
if not Result then
|
if not Result then
|
||||||
Result := DrawFrameControl(DC, Rect, uType, uState);
|
Result := DrawFrameControl(DC, Rect, uType, uState);
|
||||||
end;
|
end;
|
||||||
|
*)
|
||||||
|
|
||||||
function IsInvalidRect(const R: TRect): Boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}
|
function IsInvalidRect(const R: TRect): Boolean; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF}
|
||||||
begin
|
begin
|
||||||
@ -552,7 +556,7 @@ begin
|
|||||||
OldBkMode := GetBkMode(DC);
|
OldBkMode := GetBkMode(DC);
|
||||||
end;
|
end;
|
||||||
{$ENDIF COMPILER16_UP}
|
{$ENDIF COMPILER16_UP}
|
||||||
Control.Parent.Perform(WM_ERASEBKGND, DC, DC); // force redraw
|
Control.Parent.Perform(LM_ERASEBKGND, DC, DC); // force redraw
|
||||||
{$IFDEF COMPILER16_UP}
|
{$IFDEF COMPILER16_UP}
|
||||||
if StyleServices.Enabled and not StyleServices.IsSystemStyle then
|
if StyleServices.Enabled and not StyleServices.IsSystemStyle then
|
||||||
begin
|
begin
|
||||||
@ -591,6 +595,7 @@ begin
|
|||||||
PerformEraseBackground(Control, DC, Point(Control.Left, Control.Top), R);
|
PerformEraseBackground(Control, DC, Point(Control.Left, Control.Top), R);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
(***************************** NOT CONVERTED ***
|
||||||
function DrawThemedButtonFace(Control: TControl; Canvas: TCanvas;
|
function DrawThemedButtonFace(Control: TControl; Canvas: TCanvas;
|
||||||
const Client: TRect; BevelWidth: Integer; Style: TButtonStyle;
|
const Client: TRect; BevelWidth: Integer; Style: TButtonStyle;
|
||||||
IsRounded, IsDown, IsFocused, IsHot: Boolean): TRect;
|
IsRounded, IsDown, IsFocused, IsHot: Boolean): TRect;
|
||||||
@ -841,12 +846,12 @@ function TThemeServicesEx.GetSystemColor(Color: TColor): TColor;
|
|||||||
begin
|
begin
|
||||||
Result := Color;
|
Result := Color;
|
||||||
end;
|
end;
|
||||||
|
**********************)
|
||||||
|
|
||||||
function TThemeServicesEx.IsSystemStyle: Boolean;
|
function TThemeServicesEx.IsSystemStyle: Boolean;
|
||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
**********************)
|
|
||||||
|
|
||||||
function TThemeServicesEx.Enabled: Boolean;
|
function TThemeServicesEx.Enabled: Boolean;
|
||||||
begin
|
begin
|
||||||
|
@ -310,8 +310,8 @@ begin
|
|||||||
FTickStyle := tsAuto;
|
FTickStyle := tsAuto;
|
||||||
FBitmapInvalid := True;
|
FBitmapInvalid := True;
|
||||||
FPointerRect.Left := -1; // Only on start up
|
FPointerRect.Left := -1; // Only on start up
|
||||||
Width := 51;
|
Width := 120;
|
||||||
Height := 51;
|
Height := 120;
|
||||||
FRepeatDelay := 400;
|
FRepeatDelay := 400;
|
||||||
FRepeatRate := 100;
|
FRepeatRate := 100;
|
||||||
SetTicks(FTickStyle);
|
SetTicks(FTickStyle);
|
||||||
@ -925,6 +925,7 @@ var
|
|||||||
OldOrg: TPoint;
|
OldOrg: TPoint;
|
||||||
lCanvas: TCanvas;
|
lCanvas: TCanvas;
|
||||||
I: Integer;
|
I: Integer;
|
||||||
|
lColor: TColor;
|
||||||
begin
|
begin
|
||||||
Size := 2 * FRadius + 1;
|
Size := 2 * FRadius + 1;
|
||||||
ButtonRect := Bounds(0, 0, Size, Size);
|
ButtonRect := Bounds(0, 0, Size, Size);
|
||||||
@ -942,9 +943,13 @@ begin
|
|||||||
lCanvas.Pen.Style := psClear;
|
lCanvas.Pen.Style := psClear;
|
||||||
|
|
||||||
Highlight := ColorToRGB(clBtnHighlight);
|
Highlight := ColorToRGB(clBtnHighlight);
|
||||||
Face := ColorToRGB(Color);
|
if Color = clDefault then
|
||||||
|
lColor := clGray
|
||||||
|
else
|
||||||
|
lColor := Color;
|
||||||
|
Face := ColorToRGB(lColor);
|
||||||
// darking the color by halving each color part value
|
// darking the color by halving each color part value
|
||||||
Shadow := (ColorToRGB(Color) and $00FEFEFE) shr 1;
|
Shadow := (ColorToRGB(lColor) and $00FEFEFE) shr 1;
|
||||||
|
|
||||||
for I := 0 to Size do
|
for I := 0 to Size do
|
||||||
begin
|
begin
|
||||||
@ -962,8 +967,8 @@ begin
|
|||||||
|
|
||||||
// Draw top of disk.
|
// Draw top of disk.
|
||||||
lCanvas.Pen.Style := psSolid;
|
lCanvas.Pen.Style := psSolid;
|
||||||
lCanvas.Pen.Color := Color;
|
lCanvas.Pen.Color := lColor;
|
||||||
lCanvas.Brush.Color := Color;
|
lCanvas.Brush.Color := lColor;
|
||||||
Edge := FButtonEdge * FRadius div 100 + 1;
|
Edge := FButtonEdge * FRadius div 100 + 1;
|
||||||
lCanvas.Ellipse(0 + Edge, 0 + Edge, 0 + Size - Edge, 0 + Size - Edge);
|
lCanvas.Ellipse(0 + Edge, 0 + Edge, 0 + Size - Edge, 0 + Size - Edge);
|
||||||
|
|
||||||
|
395
components/jvcllaz/run/JvMM/jvbmpanimator.pas
Normal file
395
components/jvcllaz/run/JvMM/jvbmpanimator.pas
Normal file
@ -0,0 +1,395 @@
|
|||||||
|
{-----------------------------------------------------------------------------
|
||||||
|
The contents of this file are subject to the Mozilla Public License
|
||||||
|
Version 1.1 (the "License"); you may not use this file except in compliance
|
||||||
|
with the License. You may obtain a copy of the License at
|
||||||
|
http://www.mozilla.org/MPL/MPL-1.1.html
|
||||||
|
|
||||||
|
Software distributed under the License is distributed on an "AS IS" basis,
|
||||||
|
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
||||||
|
the specific language governing rights and limitations under the License.
|
||||||
|
|
||||||
|
The Original Code is: JvBmpAnim.PAS, released on 2002-05-26.
|
||||||
|
|
||||||
|
The Initial Developer of the Original Code is Peter Thörnqvist [peter3 at sourceforge dot net]
|
||||||
|
Portions created by Peter Thörnqvist are Copyright (C) 2002 Peter Thörnqvist.
|
||||||
|
All Rights Reserved.
|
||||||
|
|
||||||
|
Contributor(s):
|
||||||
|
|
||||||
|
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||||
|
located at http://jvcl.delphi-jedi.org
|
||||||
|
|
||||||
|
Description:
|
||||||
|
A bitmap animator: animates an imagelist consisting of multiple likesized bitmaps
|
||||||
|
like the explorer logo in Internet Explorer or Netscape Navigator.
|
||||||
|
|
||||||
|
Known Issues:
|
||||||
|
-----------------------------------------------------------------------------}
|
||||||
|
// $Id$
|
||||||
|
|
||||||
|
unit JvBmpAnimator;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes,
|
||||||
|
Graphics, Controls, ExtCtrls, ImgList, JvComponent;
|
||||||
|
|
||||||
|
type
|
||||||
|
TJvAnimateDirection = (tdForward, tdBack, tdFwdBack, tdBackFwd);
|
||||||
|
|
||||||
|
TJvCustomBmpAnimator = class(TJvGraphicControl)
|
||||||
|
private
|
||||||
|
FImageList: TCustomImageList;
|
||||||
|
FTimer: TTimer;
|
||||||
|
FIndex: Integer;
|
||||||
|
FActive: Boolean;
|
||||||
|
FWidth: Integer;
|
||||||
|
FHeight: Integer;
|
||||||
|
FNumGlyphs: Integer;
|
||||||
|
FSpeed: Integer;
|
||||||
|
FTransparent: Boolean;
|
||||||
|
FAutoSize: Boolean;
|
||||||
|
FStart: Integer;
|
||||||
|
FStop: Integer;
|
||||||
|
FPosition: Integer;
|
||||||
|
FDirection: TJvAnimateDirection;
|
||||||
|
FGoingUp: Boolean;
|
||||||
|
FCenter: Boolean;
|
||||||
|
FImageChangeLink: TChangeLink;
|
||||||
|
procedure SetCenter(Value: Boolean);
|
||||||
|
procedure SetDirection(Value: TJvAnimateDirection);
|
||||||
|
procedure SetPosition(Value: Integer);
|
||||||
|
procedure SetStart(Value: Integer);
|
||||||
|
procedure SetStop(Value: Integer);
|
||||||
|
procedure SetTransparent(Value: Boolean);
|
||||||
|
procedure SetImage(Value: TCustomImageList);
|
||||||
|
procedure SetActive(Value: Boolean);
|
||||||
|
procedure SetNumGlyphs(Value: Integer);
|
||||||
|
procedure SetSpeed(Value: Integer);
|
||||||
|
procedure TimerEvent(Sender: TObject);
|
||||||
|
procedure DoChange(Sender: TObject);
|
||||||
|
protected
|
||||||
|
procedure Paint; override;
|
||||||
|
procedure SetAutoSize(Value: Boolean); override;
|
||||||
|
property AutoSize: Boolean read FAutoSize write SetAutoSize default False;
|
||||||
|
procedure Notification(AComponent: TComponent; AOperation: TOperation); override;
|
||||||
|
property Centered: Boolean read FCenter write SetCenter;
|
||||||
|
property Color default clBtnFace;
|
||||||
|
property Direction: TJvAnimateDirection read FDirection write SetDirection;
|
||||||
|
property Active: Boolean read FActive write SetActive default False;
|
||||||
|
property Images: TCustomImageList read FImageList write SetImage;
|
||||||
|
property NumFrames: Integer read FNumGlyphs write SetNumGlyphs default 0;
|
||||||
|
property Position: Integer read FPosition write SetPosition default 0;
|
||||||
|
property Speed: Integer read FSpeed write SetSpeed default 100;
|
||||||
|
property Min: Integer read FStart write SetStart default 0;
|
||||||
|
property Max: Integer read FStop write SetStop default 0;
|
||||||
|
property Transparent: Boolean read FTransparent write SetTransparent default False;
|
||||||
|
public
|
||||||
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
TJvBmpAnimator = class(TJvCustomBmpAnimator)
|
||||||
|
published
|
||||||
|
property Active;
|
||||||
|
property Align;
|
||||||
|
property AutoSize;
|
||||||
|
property Centered;
|
||||||
|
property Color;
|
||||||
|
property Direction;
|
||||||
|
property Height;
|
||||||
|
property Images;
|
||||||
|
property Left;
|
||||||
|
property Name;
|
||||||
|
property NumFrames;
|
||||||
|
property Position;
|
||||||
|
property Speed;
|
||||||
|
property Min;
|
||||||
|
property Max;
|
||||||
|
property Tag;
|
||||||
|
property Top;
|
||||||
|
property Transparent;
|
||||||
|
property Width;
|
||||||
|
property OnClick;
|
||||||
|
property OnMouseDown;
|
||||||
|
property OnMouseMove;
|
||||||
|
property OnMouseUp;
|
||||||
|
property OnDragDrop;
|
||||||
|
property OnEndDrag;
|
||||||
|
property OnStartDrag;
|
||||||
|
property OnDragOver;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
uses
|
||||||
|
JvJVCLUtils;
|
||||||
|
|
||||||
|
constructor TJvCustomBmpAnimator.Create(AOwner: TComponent);
|
||||||
|
begin
|
||||||
|
inherited Create(AOwner);
|
||||||
|
FImageChangeLink := TChangeLink.Create;
|
||||||
|
FImageChangeLink.OnChange := @DoChange;
|
||||||
|
FWidth := 60;
|
||||||
|
FHeight := 60;
|
||||||
|
Width := FWidth;
|
||||||
|
Height := FHeight;
|
||||||
|
FTransparent := False;
|
||||||
|
FAutoSize := False;
|
||||||
|
FSpeed := 15;
|
||||||
|
FNumGlyphs := 0;
|
||||||
|
FIndex := 0;
|
||||||
|
FStart := 0;
|
||||||
|
FStop := 0;
|
||||||
|
FPosition := 0;
|
||||||
|
FActive := False;
|
||||||
|
Color := clBtnFace;
|
||||||
|
FTimer := TTimer.Create(nil);
|
||||||
|
FTimer.OnTimer := @TimerEvent;
|
||||||
|
FTimer.Enabled := FActive;
|
||||||
|
FTimer.Interval := 100;
|
||||||
|
FDirection := tdForward;
|
||||||
|
FGoingUp := True;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TJvCustomBmpAnimator.Destroy;
|
||||||
|
begin
|
||||||
|
FImageChangeLink.Free;
|
||||||
|
FTimer.Enabled := False;
|
||||||
|
FTimer.Free;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.DoChange(Sender: TObject);
|
||||||
|
begin
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.TimerEvent(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if not Assigned(FImageList) then
|
||||||
|
Exit;
|
||||||
|
|
||||||
|
if not Active then
|
||||||
|
FIndex := FPosition
|
||||||
|
else
|
||||||
|
case FDirection of
|
||||||
|
tdForward:
|
||||||
|
begin
|
||||||
|
Inc(FIndex);
|
||||||
|
if (FIndex > FNumGlyphs) or (FIndex > FStop) then
|
||||||
|
FIndex := FStart;
|
||||||
|
end;
|
||||||
|
tdBack:
|
||||||
|
begin
|
||||||
|
Dec(FIndex);
|
||||||
|
if (FIndex < 0) or (FIndex < FStart) then
|
||||||
|
FIndex := FStop;
|
||||||
|
end;
|
||||||
|
tdFwdBack, tdBackFwd:
|
||||||
|
begin
|
||||||
|
if FGoingUp then
|
||||||
|
begin
|
||||||
|
if (FIndex >= FStop) then
|
||||||
|
begin
|
||||||
|
FGoingUp := False;
|
||||||
|
Dec(FIndex);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Inc(FIndex);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
if FIndex <= FStart then
|
||||||
|
begin
|
||||||
|
FGoingUp := True;
|
||||||
|
Inc(FIndex);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Dec(FIndex);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
Refresh;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetStart(Value: Integer);
|
||||||
|
begin
|
||||||
|
if FStart <> Value then
|
||||||
|
begin
|
||||||
|
FStart := Value;
|
||||||
|
if FStart > FStop then
|
||||||
|
FStart := FStop;
|
||||||
|
if FStart >= FNumGlyphs then
|
||||||
|
FStart := FNumGlyphs - 1;
|
||||||
|
if FStart < 0 then
|
||||||
|
FStart := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetStop(Value: Integer);
|
||||||
|
begin
|
||||||
|
if FStop <> Value then
|
||||||
|
begin
|
||||||
|
FStop := Value;
|
||||||
|
if FStop < FStart then
|
||||||
|
FStop := FStart;
|
||||||
|
if FStop >= FNumGlyphs then
|
||||||
|
FStop := FNumGlyphs - 1;
|
||||||
|
if FStop < 0 then
|
||||||
|
FStop := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetAutoSize(Value: Boolean);
|
||||||
|
begin
|
||||||
|
if FAutoSize <> Value then
|
||||||
|
begin
|
||||||
|
FAutoSize := Value;
|
||||||
|
if FAutoSize and Assigned(FImageList) then
|
||||||
|
begin
|
||||||
|
Width := FImageList.Width;
|
||||||
|
Height := FImageList.Height;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetTransparent(Value: Boolean);
|
||||||
|
begin
|
||||||
|
if FTransparent <> Value then
|
||||||
|
begin
|
||||||
|
FTransparent := Value;
|
||||||
|
Repaint;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.Notification(AComponent: TComponent; AOperation: TOperation);
|
||||||
|
begin
|
||||||
|
inherited Notification(AComponent, AOperation);
|
||||||
|
if (AOperation = opRemove) and (AComponent = FImageList) then
|
||||||
|
SetImage(nil);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetImage(Value: TCustomImageList);
|
||||||
|
begin
|
||||||
|
if FImageList <> nil then
|
||||||
|
SetNumGlyphs(0);
|
||||||
|
|
||||||
|
ReplaceImageListReference(Self, Value, FImageList, FImageChangeLink);
|
||||||
|
if FImageList <> nil then
|
||||||
|
SetNumGlyphs(FImageList.Count)
|
||||||
|
else
|
||||||
|
Active := False;
|
||||||
|
Repaint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetActive(Value: Boolean);
|
||||||
|
begin
|
||||||
|
{ if not Assigned(FImageList) then
|
||||||
|
Value := False;}
|
||||||
|
if FActive <> Value then
|
||||||
|
begin
|
||||||
|
FActive := Value;
|
||||||
|
FTimer.Enabled := FActive;
|
||||||
|
FIndex := FStart;
|
||||||
|
end;
|
||||||
|
Repaint;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetNumGlyphs(Value: Integer);
|
||||||
|
begin
|
||||||
|
if FNumGlyphs <> Value then
|
||||||
|
begin
|
||||||
|
FNumGlyphs := Value;
|
||||||
|
SetStop(FNumGlyphs - 1);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetSpeed(Value: Integer);
|
||||||
|
begin
|
||||||
|
if FSpeed <> Value then
|
||||||
|
begin
|
||||||
|
FSpeed := Value;
|
||||||
|
FTimer.Interval := 1000 div FSpeed;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetCenter(Value: Boolean);
|
||||||
|
begin
|
||||||
|
if FCenter <> Value then
|
||||||
|
begin
|
||||||
|
FCenter := Value;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetDirection(Value: TJvAnimateDirection);
|
||||||
|
begin
|
||||||
|
if FDirection <> Value then
|
||||||
|
begin
|
||||||
|
FDirection := Value;
|
||||||
|
case FDirection of
|
||||||
|
tdForward, tdFwdBack:
|
||||||
|
begin
|
||||||
|
FGoingUp := True;
|
||||||
|
FIndex := FStart;
|
||||||
|
end;
|
||||||
|
tdBack, tdBackFwd:
|
||||||
|
begin
|
||||||
|
FGoingUp := False;
|
||||||
|
FIndex := FStop;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.SetPosition(Value: Integer);
|
||||||
|
begin
|
||||||
|
FPosition := Value;
|
||||||
|
if FPosition > FNumGlyphs - 1 then
|
||||||
|
FPosition := FNumGlyphs - 1;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TJvCustomBmpAnimator.Paint;
|
||||||
|
var
|
||||||
|
dX, dY: Integer;
|
||||||
|
begin
|
||||||
|
if Assigned(FImageList) then
|
||||||
|
begin
|
||||||
|
if FCenter then
|
||||||
|
begin
|
||||||
|
dX := (Width - FImageList.Width) div 2;
|
||||||
|
dY := (Height - FImageList.Height) div 2;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
dX := 0;
|
||||||
|
dY := 0;
|
||||||
|
end;
|
||||||
|
if not FTransparent then
|
||||||
|
begin
|
||||||
|
Canvas.Brush.Color := Color;
|
||||||
|
Canvas.FillRect(ClientRect);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Canvas.Brush.Style := bsClear;
|
||||||
|
FImageList.Draw(Canvas, dX, dY, FIndex);
|
||||||
|
|
||||||
|
if not Active then
|
||||||
|
FIndex := FPosition;
|
||||||
|
FImageList.Draw(Canvas, dX, dY, FIndex)
|
||||||
|
end;
|
||||||
|
if csDesigning in ComponentState then
|
||||||
|
with Canvas do
|
||||||
|
begin
|
||||||
|
Brush.Color := clBlack;
|
||||||
|
FrameRect( GetClientRect);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
Reference in New Issue
Block a user