ADD: KASStatusBar control

This commit is contained in:
Alexander Koblov 2019-01-27 11:26:54 +00:00
commit ff713ff280
3 changed files with 51 additions and 4 deletions

View file

@ -26,8 +26,8 @@
"/>
<License Value="GNU GPL 2
"/>
<Version Major="1" Minor="8" Release="1"/>
<Files Count="6">
<Version Major="1" Minor="9"/>
<Files Count="7">
<Item1>
<Filename Value="kastoolbar.pas"/>
<HasRegisterProc Value="True"/>
@ -57,6 +57,11 @@
<HasRegisterProc Value="True"/>
<UnitName Value="KASCDEdit"/>
</Item6>
<Item7>
<Filename Value="kasstatusbar.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="KASStatusBar"/>
</Item7>
</Files>
<RequiredPkgs Count="3">
<Item1>
@ -65,7 +70,7 @@
</Item1>
<Item2>
<PackageName Value="LCL"/>
<MinVersion Major="1" Valid="True"/>
<MinVersion Major="1" Minor="8" Valid="True"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>

View file

@ -4,11 +4,12 @@
unit KASComp;
{$warn 5023 off : no warning about unused units}
interface
uses
KASToolBar, KASProgressBar, KASPathEdit, KASToolItems, KASComboBox,
KASCDEdit, LazarusPackageIntf;
KASCDEdit, KASStatusBar, LazarusPackageIntf;
implementation
@ -19,6 +20,7 @@ begin
RegisterUnit('KASPathEdit', @KASPathEdit.Register);
RegisterUnit('KASComboBox', @KASComboBox.Register);
RegisterUnit('KASCDEdit', @KASCDEdit.Register);
RegisterUnit('KASStatusBar', @KASStatusBar.Register);
end;
initialization

View file

@ -0,0 +1,40 @@
unit KASStatusBar;
{$mode delphi}
interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ComCtrls;
type
{ TKASStatusBar }
TKASStatusBar = class(TStatusBar)
public
procedure InvalidatePanel(PanelIndex: Integer; PanelParts: TPanelParts); override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('KASComponents', [TKASStatusBar]);
end;
{ TKASStatusBar }
procedure TKASStatusBar.InvalidatePanel(PanelIndex: Integer; PanelParts: TPanelParts);
begin
if (PanelIndex >= 0) and (ppText in PanelParts) then
begin
if Length(Panels[PanelIndex].Text) > 0 then
Panels[PanelIndex].Width:= Canvas.TextWidth('WW' + Panels[PanelIndex].Text);
end;
inherited InvalidatePanel(PanelIndex, PanelParts);
end;
end.