Стартовый пул
This commit is contained in:
116
PrgStatusBar/prgstatusbar.pas
Normal file
116
PrgStatusBar/prgstatusbar.pas
Normal file
@@ -0,0 +1,116 @@
|
||||
unit PrgStatusBar;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TPrgStatusBar }
|
||||
|
||||
TPrgStatusBar = class(TStatusBar)
|
||||
private
|
||||
FProgressBar: TProgressBar;
|
||||
FProgressBarPanel: Integer;
|
||||
FProgressBarPanelTemp: Integer;
|
||||
FIsLoaded: Boolean;
|
||||
procedure SetProgressBarPanel(const AValue: Integer);
|
||||
{ Private declarations }
|
||||
protected
|
||||
{ Protected declarations }
|
||||
procedure Loaded; override;
|
||||
public
|
||||
{ Public declarations }
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
{ Published declarations }
|
||||
property ProgressBar: TProgressBar read FProgressBar;
|
||||
property ProgressBarPanel: Integer read FProgressBarPanel write SetProgressBarPanel default 1;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Misc',[TPrgStatusBar]);
|
||||
end;
|
||||
|
||||
{ TPrgStatusBar }
|
||||
|
||||
procedure TPrgStatusBar.SetProgressBarPanel(const AValue: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
L: Longint;
|
||||
begin
|
||||
if FProgressBarPanel=AValue then Exit;
|
||||
if not FIsLoaded then // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
begin
|
||||
FProgressBarPanelTemp := AValue; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> Loaded.
|
||||
Exit; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
end;
|
||||
if (AValue >= self.Panels.Count) then Exit;
|
||||
if AValue = -1 then
|
||||
begin
|
||||
FProgressBar.Top := 0;
|
||||
FProgressBar.Height := 0;
|
||||
FProgressBar.Width := 0;
|
||||
FProgressBar.Left := 0;
|
||||
FProgressBarPanel := -1;
|
||||
Exit;
|
||||
end;
|
||||
FProgressBar.Top := 2;
|
||||
FProgressBar.Height := self.Height-2;
|
||||
L := 0;
|
||||
for i := 1 to AValue do
|
||||
L := L + self.Panels[i-1].Width;
|
||||
if AValue = 0 then
|
||||
begin
|
||||
FProgressBar.Left := 0;
|
||||
FProgressBar.Width := self.Panels[AValue].Width;
|
||||
end
|
||||
else
|
||||
begin
|
||||
FProgressBar.Left := L + 2;
|
||||
FProgressBar.Width := self.Panels[AValue].Width - 2;
|
||||
end;
|
||||
FProgressBarPanel:=AValue;
|
||||
end;
|
||||
|
||||
procedure TPrgStatusBar.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
FIsLoaded := True;
|
||||
SetProgressBarPanel(FProgressBarPanelTemp);
|
||||
end;
|
||||
|
||||
constructor TPrgStatusBar.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FProgressBarPanel := -1;
|
||||
FProgressBar := TProgressBar.Create(Self);
|
||||
//Include(FProgressBar.ComponentStyle, csSubComponent);
|
||||
FProgressBar.Parent := self;
|
||||
FProgressBar.Top := 0;
|
||||
FProgressBar.Height := 0;
|
||||
FProgressBar.Width := 0;
|
||||
FProgressBar.Left := 0;
|
||||
FIsLoaded := False;
|
||||
end;
|
||||
|
||||
destructor TPrgStatusBar.Destroy;
|
||||
begin
|
||||
FProgressBar.Free;
|
||||
FProgressBar := nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I prgstatusbarlaz.lrs}
|
||||
|
||||
end.
|
48
PrgStatusBar/prgstatusbarlaz.lpk
Normal file
48
PrgStatusBar/prgstatusbarlaz.lpk
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0"?>
|
||||
<CONFIG>
|
||||
<Package Version="2">
|
||||
<PathDelim Value="\"/>
|
||||
<Name Value="prgstatusbarlaz"/>
|
||||
<CompilerOptions>
|
||||
<Version Value="5"/>
|
||||
<PathDelim Value="\"/>
|
||||
<SearchPaths>
|
||||
<OtherUnitFiles Value=".\"/>
|
||||
<UnitOutputDirectory Value="lib\"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<Generate Value="Faster"/>
|
||||
</CodeGeneration>
|
||||
<Other>
|
||||
<CompilerPath Value="$(CompPath)"/>
|
||||
</Other>
|
||||
</CompilerOptions>
|
||||
<Version Major="1"/>
|
||||
<Files Count="1">
|
||||
<Item1>
|
||||
<Filename Value="prgstatusbar.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
<AddToUsesPkgSection Value="False"/>
|
||||
<UnitName Value="PrgStatusBar"/>
|
||||
</Item1>
|
||||
</Files>
|
||||
<Type Value="RunAndDesignTime"/>
|
||||
<RequiredPkgs Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="LCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="FCL"/>
|
||||
<MinVersion Major="1" Valid="True"/>
|
||||
</Item2>
|
||||
</RequiredPkgs>
|
||||
<UsageOptions>
|
||||
<UnitPath Value="$(PkgOutDir)\"/>
|
||||
</UsageOptions>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<IgnoreBinaries Value="False"/>
|
||||
</PublishOptions>
|
||||
</Package>
|
||||
</CONFIG>
|
21
PrgStatusBar/prgstatusbarlaz.pas
Normal file
21
PrgStatusBar/prgstatusbarlaz.pas
Normal file
@@ -0,0 +1,21 @@
|
||||
{ This file was automatically created by Lazarus. Do not edit!
|
||||
This source is only used to compile and install the package.
|
||||
}
|
||||
|
||||
unit prgstatusbarlaz;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
PrgStatusBar, LazarusPackageIntf;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterUnit('PrgStatusBar', @PrgStatusBar.Register);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterPackage('prgstatusbarlaz', @Register);
|
||||
end.
|
32
PrgStatusBar/tprgstatusbar.xpm
Normal file
32
PrgStatusBar/tprgstatusbar.xpm
Normal file
@@ -0,0 +1,32 @@
|
||||
/* XPM */
|
||||
static char * tprgstatusbar_xpm[] = {
|
||||
"23 23 6 1",
|
||||
" c None",
|
||||
". c #FFFFFF",
|
||||
"+ c #4B4B4B",
|
||||
"@ c #C0C0C0",
|
||||
"# c #808080",
|
||||
"$ c #0F1EE7",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
"......................+",
|
||||
"@@@@@@@@@@@@@@@@@@@@@@+",
|
||||
"##########.@########.@+",
|
||||
"$$@$$@$$@@.@#@@@@@@@.@+",
|
||||
"$$@$$@$$@@.@#@@@@@@.#@+",
|
||||
"$$@$$@$$@@.@#@@@@@.#@@+",
|
||||
"$$@$$@$$@@.@#@@@@.#@.@+",
|
||||
"$$@$$@$$@@.@#@@@.#@.#@+",
|
||||
"$$@$$@$$@@.@#@@.#@.#@@+",
|
||||
"...........@...#@.#@.@+",
|
||||
"@@@@@@@@@@@@@@@@@@@@@@+",
|
||||
"+++++++++++++++++++++++",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" "};
|
116
PrgStatusBar/~history/prgstatusbar.pas;1
Normal file
116
PrgStatusBar/~history/prgstatusbar.pas;1
Normal file
@@ -0,0 +1,116 @@
|
||||
unit PrgStatusBar;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls;
|
||||
|
||||
type
|
||||
|
||||
{ TPrgStatusBar }
|
||||
|
||||
TPrgStatusBar = class(TStatusBar)
|
||||
private
|
||||
FProgressBar: TProgressBar;
|
||||
FProgressBarPanel: Integer;
|
||||
FProgressBarPanelTemp: Integer;
|
||||
FIsLoaded: Boolean;
|
||||
procedure SetProgressBarPanel(const AValue: Integer);
|
||||
{ Private declarations }
|
||||
protected
|
||||
{ Protected declarations }
|
||||
procedure Loaded; override;
|
||||
public
|
||||
{ Public declarations }
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
published
|
||||
{ Published declarations }
|
||||
property ProgressBar: TProgressBar read FProgressBar;
|
||||
property ProgressBarPanel: Integer read FProgressBarPanel write SetProgressBarPanel default 1;
|
||||
end;
|
||||
|
||||
procedure Register;
|
||||
|
||||
implementation
|
||||
|
||||
procedure Register;
|
||||
begin
|
||||
RegisterComponents('Misc',[TPrgStatusBar]);
|
||||
end;
|
||||
|
||||
{ TPrgStatusBar }
|
||||
|
||||
procedure TPrgStatusBar.SetProgressBarPanel(const AValue: Integer);
|
||||
var
|
||||
i: Integer;
|
||||
L: Longint;
|
||||
begin
|
||||
if FProgressBarPanel=AValue then Exit;
|
||||
if not FIsLoaded then // <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
begin
|
||||
FProgressBarPanelTemp := AValue; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20> Loaded.
|
||||
Exit; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
||||
end;
|
||||
if (AValue >= self.Panels.Count) then Exit;
|
||||
if AValue = -1 then
|
||||
begin
|
||||
FProgressBar.Top := 0;
|
||||
FProgressBar.Height := 0;
|
||||
FProgressBar.Width := 0;
|
||||
FProgressBar.Left := 0;
|
||||
FProgressBarPanel := -1;
|
||||
Exit;
|
||||
end;
|
||||
FProgressBar.Top := 2;
|
||||
FProgressBar.Height := self.Height-2;
|
||||
L := 0;
|
||||
for i := 1 to AValue do
|
||||
L := L + self.Panels[i-1].Width;
|
||||
if AValue = 0 then
|
||||
begin
|
||||
FProgressBar.Left := 0;
|
||||
FProgressBar.Width := self.Panels[AValue].Width;
|
||||
end
|
||||
else
|
||||
begin
|
||||
FProgressBar.Left := L + 2;
|
||||
FProgressBar.Width := self.Panels[AValue].Width - 2;
|
||||
end;
|
||||
FProgressBarPanel:=AValue;
|
||||
end;
|
||||
|
||||
procedure TPrgStatusBar.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
FIsLoaded := True;
|
||||
SetProgressBarPanel(FProgressBarPanelTemp);
|
||||
end;
|
||||
|
||||
constructor TPrgStatusBar.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FProgressBarPanel := -1;
|
||||
FProgressBar := TProgressBar.Create(Self);
|
||||
Include(FProgressBar.ComponentStyle, csSubComponent);
|
||||
FProgressBar.Parent := self;
|
||||
FProgressBar.Top := 0;
|
||||
FProgressBar.Height := 0;
|
||||
FProgressBar.Width := 0;
|
||||
FProgressBar.Left := 0;
|
||||
FIsLoaded := False;
|
||||
end;
|
||||
|
||||
destructor TPrgStatusBar.Destroy;
|
||||
begin
|
||||
FProgressBar.Free;
|
||||
FProgressBar := nil;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I prgstatusbarlaz.lrs}
|
||||
|
||||
end.
|
Reference in New Issue
Block a user