jvcllaz: Add JvSpecialProgress

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6294 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-04-08 11:27:52 +00:00
parent bd7f427964
commit 7eadb2c7d2
12 changed files with 1291 additions and 0 deletions

View File

@ -0,0 +1,192 @@
object MainForm: TMainForm
Left = 258
Height = 340
Top = 127
Width = 459
Caption = 'JvSpecialProgress Demo'
ClientHeight = 340
ClientWidth = 459
OnCreate = FormCreate
LCLVersion = '1.9.0.0'
object Bevel1: TBevel
Left = 20
Height = 44
Top = 12
Width = 176
end
object JvSpecialProgress1: TJvSpecialProgress
Left = 32
Height = 15
Top = 24
Width = 150
Caption = 'JvSpecialProgress1'
Position = 50
end
object ScrollBar1: TScrollBar
Left = 31
Height = 17
Top = 88
Width = 150
PageSize = 0
TabOrder = 0
OnChange = ScrollBar1Change
end
object CbStartColor: TColorBox
Left = 328
Height = 22
Top = 22
Width = 100
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbPrettyNames]
ItemHeight = 16
OnChange = CbStartColorChange
TabOrder = 1
end
object Label1: TLabel
Left = 245
Height = 15
Top = 26
Width = 57
Caption = 'Start color:'
ParentColor = False
end
object Label2: TLabel
Left = 245
Height = 15
Top = 60
Width = 57
Caption = 'Start color:'
ParentColor = False
end
object CbEndColor: TColorBox
Left = 328
Height = 22
Top = 56
Width = 100
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbPrettyNames]
ItemHeight = 16
OnChange = CbEndColorChange
TabOrder = 2
end
object CbGradientBlocks: TCheckBox
Left = 245
Height = 19
Top = 96
Width = 102
Caption = 'Gradient blocks'
OnChange = CbGradientBlocksChange
TabOrder = 3
end
object CbSolid: TCheckBox
Left = 245
Height = 19
Top = 128
Width = 46
Caption = 'Solid'
OnChange = CbSolidChange
TabOrder = 4
end
object CbBorder: TCheckBox
Left = 245
Height = 19
Top = 159
Width = 55
Caption = 'Border'
OnChange = CbBorderChange
TabOrder = 5
end
object Label3: TLabel
Left = 31
Height = 15
Top = 64
Width = 128
Caption = 'Please drag the scrollbar'
ParentColor = False
end
object CbBorderColor: TColorBox
Left = 328
Height = 22
Top = 166
Width = 100
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbPrettyNames]
ItemHeight = 16
OnChange = CbBorderColorChange
TabOrder = 6
end
object CbFlat: TCheckBox
Left = 245
Height = 19
Top = 176
Width = 39
Caption = 'Flat'
OnChange = CbFlatChange
TabOrder = 7
end
object CbTextOption: TComboBox
Left = 328
Height = 23
Top = 208
Width = 100
ItemHeight = 15
Items.Strings = (
'toCaption'
'toFormat'
'toNoText'
'toPercent'
)
OnChange = CbTextOptionChange
TabOrder = 8
Text = 'CbTextOption'
end
object Label4: TLabel
Left = 245
Height = 15
Top = 212
Width = 62
Caption = 'Text option:'
ParentColor = False
end
object CbTextCentered: TCheckBox
Left = 245
Height = 19
Top = 296
Width = 91
Caption = 'Text centered'
OnChange = CbTextCenteredChange
TabOrder = 9
end
object EdFormat: TEdit
Left = 328
Height = 23
Top = 236
Width = 100
TabOrder = 10
Text = '%d%% done.'
end
object LblFormat: TLabel
Left = 247
Height = 15
Top = 240
Width = 38
Caption = 'Format'
FocusControl = EdFormat
ParentColor = False
end
object CbTextColor: TColorBox
Left = 328
Height = 22
Top = 264
Width = 100
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbPrettyNames]
ItemHeight = 16
OnChange = CbTextColorChange
TabOrder = 11
end
object Label5: TLabel
Left = 245
Height = 15
Top = 268
Width = 54
Caption = 'Text color:'
ParentColor = False
end
end

View File

@ -0,0 +1,151 @@
unit main;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ColorBox,
ExtCtrls, JvSpecialProgress;
type
{ TMainForm }
TMainForm = class(TForm)
Bevel1: TBevel;
CbBorderColor: TColorBox;
CbTextColor: TColorBox;
CbTextCentered: TCheckBox;
CbStartColor: TColorBox;
CbEndColor: TColorBox;
CbGradientBlocks: TCheckBox;
CbSolid: TCheckBox;
CbBorder: TCheckBox;
CbFlat: TCheckBox;
CbTextOption: TComboBox;
EdFormat: TEdit;
JvSpecialProgress1: TJvSpecialProgress;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
LblFormat: TLabel;
ScrollBar1: TScrollBar;
procedure CbBorderChange(Sender: TObject);
procedure CbBorderColorChange(Sender: TObject);
procedure CbTextColorChange(Sender: TObject);
procedure CbEndColorChange(Sender: TObject);
procedure CbFlatChange(Sender: TObject);
procedure CbGradientBlocksChange(Sender: TObject);
procedure CbSolidChange(Sender: TObject);
procedure CbStartColorChange(Sender: TObject);
procedure CbTextCenteredChange(Sender: TObject);
procedure CbTextOptionChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ScrollBar1Change(Sender: TObject);
private
FSavedCaption: String;
public
end;
var
MainForm: TMainForm;
implementation
{$R *.lfm}
{ TMainForm }
procedure TMainForm.ScrollBar1Change(Sender: TObject);
begin
JvSpecialProgress1.Position := Scrollbar1.Position;
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
FSavedCaption := JvSpecialProgress1.Caption;
Scrollbar1.Position := JvSpecialProgress1.Position;
CbStartColor.Selected := JvSpecialProgress1.StartColor;
CbEndcolor.Selected := JvSpecialProgress1.EndColor;
CbGradientBlocks.Checked := JvSpecialProgress1.GradientBlocks;
CbSolid.Checked := JvSpecialProgress1.Solid;
CbBorder.Checked := JvSpecialProgress1.BorderStyle <> bsNone;
CbBorderColor.Selected := JvSpecialProgress1.BorderColor;
CbFlat.Checked := JvSpecialProgress1.Flat;
CbFlat.Enabled := CbBorder.Checked;
CbBorderColor.Visible := CbBorder.Checked and CbFlat.Checked;
CbTextOption.ItemIndex := Ord(JvSpecialProgress1.TextOption);
CbTextCentered.Checked := JvSpecialProgress1.TextCentered;
if JvSpecialProgress1.Font.Color = clDefault then
CbTextColor.Selected := GetDefaultColor(dctFont)
else
CbTextColor.Selected := JvSpecialProgress1.Font.Color;
end;
procedure TMainForm.CbStartColorChange(Sender: TObject);
begin
JvSpecialProgress1.StartColor := CbStartColor.Selected;
end;
procedure TMainForm.CbTextCenteredChange(Sender: TObject);
begin
JvSpecialProgress1.TextCentered := CbTextCentered.Checked;
end;
procedure TMainForm.CbTextOptionChange(Sender: TObject);
begin
JvSpecialProgress1.TextOption := TJvTextOption(CbTextOption.ItemIndex);
if JvSpecialProgress1.TextOption = toFormat then
JvSpecialProgress1.Caption := EdFormat.Text
else
JvSpecialProgress1.Caption := FSavedCaption;
end;
procedure TMainForm.CbEndColorChange(Sender: TObject);
begin
JvSpecialProgress1.EndColor := CbEndColor.Selected;
end;
procedure TMainForm.CbFlatChange(Sender: TObject);
begin
JvSpecialProgress1.Flat := CbFlat.Checked;
CbBorderColor.Visible := CbBorder.Checked and CbFlat.Checked;
end;
procedure TMainForm.CbBorderChange(Sender: TObject);
begin
if CbBorder.Checked then
JvSpecialProgress1.BorderStyle := bsSingle
else
JvSpecialProgress1.Borderstyle := bsNone;
CbFlat.Enabled := CbBorder.Checked;
CbBorderColor.Visible := CbBorder.Checked and CbFlat.Checked;
end;
procedure TMainForm.CbBorderColorChange(Sender: TObject);
begin
JvSpecialProgress1.BorderColor := CbBorderColor.Selected;
end;
procedure TMainForm.CbTextColorChange(Sender: TObject);
begin
JvSpecialProgress1.Font.Color := CbTextColor.Selected;
end;
procedure TMainForm.CbGradientBlocksChange(Sender: TObject);
begin
JvSpecialProgress1.GradientBlocks := CbGradientBlocks.Checked;
end;
procedure TMainForm.CbSolidChange(Sender: TObject);
begin
JvSpecialProgress1.Solid := CbSolid.Checked;
end;
end.

View File

@ -0,0 +1,81 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="specialprogress_demo"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
</XPManifest>
<Icon Value="0"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<RequiredPackages Count="2">
<Item1>
<PackageName Value="JvMMLazR"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
</Item2>
</RequiredPackages>
<Units Count="2">
<Unit0>
<Filename Value="specialprogress_demo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="main.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="specialprogress_demo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,22 @@
program specialprogress_demo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, main
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.