Стартовый пул
This commit is contained in:
183
bgracontrols/test/test_bcbutton_functions/test.lpi
Normal file
183
bgracontrols/test/test_bcbutton_functions/test.lpi
Normal file
@@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="test"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
</General>
|
||||
<BuildModes Count="3">
|
||||
<Item1 Name="Debug" Default="True"/>
|
||||
<Item2 Name="Release">
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="test"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<CodeGeneration>
|
||||
<SmartLinkUnit Value="True"/>
|
||||
<Optimizations>
|
||||
<OptimizationLevel Value="3"/>
|
||||
</Optimizations>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<GenerateDebugInfo Value="False"/>
|
||||
</Debugging>
|
||||
<LinkSmart Value="True"/>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
</Item2>
|
||||
<Item3 Name="Debug macOS 64">
|
||||
<MacroValues Count="1">
|
||||
<Macro1 Name="LCLWidgetType" Value="cocoa"/>
|
||||
</MacroValues>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="test"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<VerifyObjMethodCallValidity Value="True"/>
|
||||
<TargetCPU Value="x86_64"/>
|
||||
<TargetOS Value="darwin"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
<TrashVariables Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
</Item3>
|
||||
<SharedMatrixOptions Count="1">
|
||||
<Item1 ID="500993870451" Modes="Debug macOS 64" Type="IDEMacro" MacroName="LCLWidgetType" Value="cocoa"/>
|
||||
</SharedMatrixOptions>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="1">
|
||||
<Mode0 Name="default"/>
|
||||
</Modes>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="bgracontrols"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="3">
|
||||
<Unit0>
|
||||
<Filename Value="test.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="aForm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
<Unit2>
|
||||
<Filename Value="ubrightandcontrast.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit2>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="test"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Parsing>
|
||||
<SyntaxOptions>
|
||||
<IncludeAssertionCode Value="True"/>
|
||||
</SyntaxOptions>
|
||||
</Parsing>
|
||||
<CodeGeneration>
|
||||
<Checks>
|
||||
<IOChecks Value="True"/>
|
||||
<RangeChecks Value="True"/>
|
||||
<OverflowChecks Value="True"/>
|
||||
<StackChecks Value="True"/>
|
||||
</Checks>
|
||||
<VerifyObjMethodCallValidity Value="True"/>
|
||||
</CodeGeneration>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
<TrashVariables Value="True"/>
|
||||
<UseExternalDbgSyms Value="True"/>
|
||||
</Debugging>
|
||||
<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>
|
21
bgracontrols/test/test_bcbutton_functions/test.lpr
Normal file
21
bgracontrols/test/test_bcbutton_functions/test.lpr
Normal file
@@ -0,0 +1,21 @@
|
||||
program test;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}{$IFDEF UseCThreads}
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, umain
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TaForm, aForm);
|
||||
Application.Run;
|
||||
end.
|
||||
|
180
bgracontrols/test/test_bcbutton_functions/umain.lfm
Normal file
180
bgracontrols/test/test_bcbutton_functions/umain.lfm
Normal file
@@ -0,0 +1,180 @@
|
||||
object aForm: TaForm
|
||||
Left = 462
|
||||
Height = 240
|
||||
Top = 146
|
||||
Width = 320
|
||||
Caption = 'Bright and Contrast'
|
||||
ClientHeight = 240
|
||||
ClientWidth = 320
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '1.7'
|
||||
object BCButtonFocus1: TBCButtonFocus
|
||||
Left = 8
|
||||
Height = 34
|
||||
Top = 8
|
||||
Width = 147
|
||||
StateClicked.Background.Color = 16245964
|
||||
StateClicked.Background.ColorOpacity = 255
|
||||
StateClicked.Background.Gradient1.StartColor = 16577765
|
||||
StateClicked.Background.Gradient1.StartColorOpacity = 255
|
||||
StateClicked.Background.Gradient1.DrawMode = dmSet
|
||||
StateClicked.Background.Gradient1.EndColor = 16180676
|
||||
StateClicked.Background.Gradient1.EndColorOpacity = 255
|
||||
StateClicked.Background.Gradient1.ColorCorrection = True
|
||||
StateClicked.Background.Gradient1.GradientType = gtLinear
|
||||
StateClicked.Background.Gradient1.Point1XPercent = 0
|
||||
StateClicked.Background.Gradient1.Point1YPercent = 0
|
||||
StateClicked.Background.Gradient1.Point2XPercent = 0
|
||||
StateClicked.Background.Gradient1.Point2YPercent = 100
|
||||
StateClicked.Background.Gradient1.Sinus = False
|
||||
StateClicked.Background.Gradient2.StartColor = 15716760
|
||||
StateClicked.Background.Gradient2.StartColorOpacity = 255
|
||||
StateClicked.Background.Gradient2.DrawMode = dmSet
|
||||
StateClicked.Background.Gradient2.EndColor = 14398312
|
||||
StateClicked.Background.Gradient2.EndColorOpacity = 255
|
||||
StateClicked.Background.Gradient2.ColorCorrection = True
|
||||
StateClicked.Background.Gradient2.GradientType = gtLinear
|
||||
StateClicked.Background.Gradient2.Point1XPercent = 0
|
||||
StateClicked.Background.Gradient2.Point1YPercent = 0
|
||||
StateClicked.Background.Gradient2.Point2XPercent = 0
|
||||
StateClicked.Background.Gradient2.Point2YPercent = 100
|
||||
StateClicked.Background.Gradient2.Sinus = False
|
||||
StateClicked.Background.Gradient1EndPercent = 55
|
||||
StateClicked.Background.Style = bbsColor
|
||||
StateClicked.Border.Color = 10048512
|
||||
StateClicked.Border.ColorOpacity = 255
|
||||
StateClicked.Border.LightColor = clBlack
|
||||
StateClicked.Border.LightOpacity = 100
|
||||
StateClicked.Border.LightWidth = 0
|
||||
StateClicked.Border.Style = bboSolid
|
||||
StateClicked.Border.Width = 1
|
||||
StateClicked.FontEx.Color = clBlack
|
||||
StateClicked.FontEx.EndEllipsis = False
|
||||
StateClicked.FontEx.FontQuality = fqSystemClearType
|
||||
StateClicked.FontEx.Height = 0
|
||||
StateClicked.FontEx.SingleLine = True
|
||||
StateClicked.FontEx.Shadow = False
|
||||
StateClicked.FontEx.ShadowColor = clBlack
|
||||
StateClicked.FontEx.ShadowColorOpacity = 255
|
||||
StateClicked.FontEx.ShadowRadius = 5
|
||||
StateClicked.FontEx.ShadowOffsetX = 5
|
||||
StateClicked.FontEx.ShadowOffsetY = 5
|
||||
StateClicked.FontEx.Style = []
|
||||
StateClicked.FontEx.TextAlignment = bcaCenter
|
||||
StateClicked.FontEx.WordBreak = False
|
||||
StateHover.Background.Color = 16511461
|
||||
StateHover.Background.ColorOpacity = 255
|
||||
StateHover.Background.Gradient1.StartColor = 16643818
|
||||
StateHover.Background.Gradient1.StartColorOpacity = 255
|
||||
StateHover.Background.Gradient1.DrawMode = dmSet
|
||||
StateHover.Background.Gradient1.EndColor = 16576729
|
||||
StateHover.Background.Gradient1.EndColorOpacity = 255
|
||||
StateHover.Background.Gradient1.ColorCorrection = True
|
||||
StateHover.Background.Gradient1.GradientType = gtLinear
|
||||
StateHover.Background.Gradient1.Point1XPercent = 0
|
||||
StateHover.Background.Gradient1.Point1YPercent = 0
|
||||
StateHover.Background.Gradient1.Point2XPercent = 0
|
||||
StateHover.Background.Gradient1.Point2YPercent = 100
|
||||
StateHover.Background.Gradient1.Sinus = False
|
||||
StateHover.Background.Gradient2.StartColor = 16639678
|
||||
StateHover.Background.Gradient2.StartColorOpacity = 255
|
||||
StateHover.Background.Gradient2.DrawMode = dmSet
|
||||
StateHover.Background.Gradient2.EndColor = 16112039
|
||||
StateHover.Background.Gradient2.EndColorOpacity = 255
|
||||
StateHover.Background.Gradient2.ColorCorrection = True
|
||||
StateHover.Background.Gradient2.GradientType = gtLinear
|
||||
StateHover.Background.Gradient2.Point1XPercent = 0
|
||||
StateHover.Background.Gradient2.Point1YPercent = 0
|
||||
StateHover.Background.Gradient2.Point2XPercent = 0
|
||||
StateHover.Background.Gradient2.Point2YPercent = 100
|
||||
StateHover.Background.Gradient2.Sinus = False
|
||||
StateHover.Background.Gradient1EndPercent = 50
|
||||
StateHover.Background.Style = bbsColor
|
||||
StateHover.Border.Color = 14120960
|
||||
StateHover.Border.ColorOpacity = 255
|
||||
StateHover.Border.LightColor = clWhite
|
||||
StateHover.Border.LightOpacity = 200
|
||||
StateHover.Border.LightWidth = 0
|
||||
StateHover.Border.Style = bboSolid
|
||||
StateHover.Border.Width = 1
|
||||
StateHover.FontEx.Color = clBlack
|
||||
StateHover.FontEx.EndEllipsis = False
|
||||
StateHover.FontEx.FontQuality = fqSystemClearType
|
||||
StateHover.FontEx.Height = 0
|
||||
StateHover.FontEx.SingleLine = True
|
||||
StateHover.FontEx.Shadow = False
|
||||
StateHover.FontEx.ShadowColor = clBlack
|
||||
StateHover.FontEx.ShadowColorOpacity = 255
|
||||
StateHover.FontEx.ShadowRadius = 5
|
||||
StateHover.FontEx.ShadowOffsetX = 5
|
||||
StateHover.FontEx.ShadowOffsetY = 5
|
||||
StateHover.FontEx.Style = []
|
||||
StateHover.FontEx.TextAlignment = bcaCenter
|
||||
StateHover.FontEx.WordBreak = False
|
||||
StateNormal.Background.Color = 14803425
|
||||
StateNormal.Background.ColorOpacity = 255
|
||||
StateNormal.Background.Gradient1.StartColor = 15921906
|
||||
StateNormal.Background.Gradient1.StartColorOpacity = 255
|
||||
StateNormal.Background.Gradient1.DrawMode = dmSet
|
||||
StateNormal.Background.Gradient1.EndColor = 15461355
|
||||
StateNormal.Background.Gradient1.EndColorOpacity = 255
|
||||
StateNormal.Background.Gradient1.ColorCorrection = True
|
||||
StateNormal.Background.Gradient1.GradientType = gtLinear
|
||||
StateNormal.Background.Gradient1.Point1XPercent = 0
|
||||
StateNormal.Background.Gradient1.Point1YPercent = 0
|
||||
StateNormal.Background.Gradient1.Point2XPercent = 0
|
||||
StateNormal.Background.Gradient1.Point2YPercent = 100
|
||||
StateNormal.Background.Gradient1.Sinus = False
|
||||
StateNormal.Background.Gradient2.StartColor = 14540253
|
||||
StateNormal.Background.Gradient2.StartColorOpacity = 255
|
||||
StateNormal.Background.Gradient2.DrawMode = dmSet
|
||||
StateNormal.Background.Gradient2.EndColor = 13619151
|
||||
StateNormal.Background.Gradient2.EndColorOpacity = 255
|
||||
StateNormal.Background.Gradient2.ColorCorrection = True
|
||||
StateNormal.Background.Gradient2.GradientType = gtLinear
|
||||
StateNormal.Background.Gradient2.Point1XPercent = 0
|
||||
StateNormal.Background.Gradient2.Point1YPercent = 0
|
||||
StateNormal.Background.Gradient2.Point2XPercent = 0
|
||||
StateNormal.Background.Gradient2.Point2YPercent = 100
|
||||
StateNormal.Background.Gradient2.Sinus = False
|
||||
StateNormal.Background.Gradient1EndPercent = 50
|
||||
StateNormal.Background.Style = bbsColor
|
||||
StateNormal.Border.Color = 11382189
|
||||
StateNormal.Border.ColorOpacity = 255
|
||||
StateNormal.Border.LightColor = clWhite
|
||||
StateNormal.Border.LightOpacity = 200
|
||||
StateNormal.Border.LightWidth = 0
|
||||
StateNormal.Border.Style = bboSolid
|
||||
StateNormal.Border.Width = 1
|
||||
StateNormal.FontEx.Color = clBlack
|
||||
StateNormal.FontEx.EndEllipsis = False
|
||||
StateNormal.FontEx.FontQuality = fqSystemClearType
|
||||
StateNormal.FontEx.Height = 0
|
||||
StateNormal.FontEx.SingleLine = True
|
||||
StateNormal.FontEx.Shadow = False
|
||||
StateNormal.FontEx.ShadowColor = clBlack
|
||||
StateNormal.FontEx.ShadowColorOpacity = 255
|
||||
StateNormal.FontEx.ShadowRadius = 5
|
||||
StateNormal.FontEx.ShadowOffsetX = 5
|
||||
StateNormal.FontEx.ShadowOffsetY = 5
|
||||
StateNormal.FontEx.Style = []
|
||||
StateNormal.FontEx.TextAlignment = bcaCenter
|
||||
StateNormal.FontEx.WordBreak = False
|
||||
Caption = 'BCButtonFocus1'
|
||||
Color = clNone
|
||||
DropDownWidth = 16
|
||||
DropDownArrowSize = 8
|
||||
GlobalOpacity = 255
|
||||
InnerMargin = 0
|
||||
ParentColor = False
|
||||
Rounding.RoundX = 0
|
||||
Rounding.RoundY = 0
|
||||
Rounding.RoundOptions = []
|
||||
RoundingDropDown.RoundX = 1
|
||||
RoundingDropDown.RoundY = 1
|
||||
RoundingDropDown.RoundOptions = []
|
||||
TextApplyGlobalOpacity = False
|
||||
MemoryUsage = bmuHighF
|
||||
TabStop = True
|
||||
end
|
||||
end
|
98
bgracontrols/test/test_bcbutton_functions/umain.pas
Normal file
98
bgracontrols/test/test_bcbutton_functions/umain.pas
Normal file
@@ -0,0 +1,98 @@
|
||||
unit umain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
|
||||
BCButtonFocus, BCTypes;
|
||||
|
||||
type
|
||||
|
||||
{ TaForm }
|
||||
|
||||
TaForm = class(TForm)
|
||||
BCButtonFocus1: TBCButtonFocus;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
aForm: TaForm;
|
||||
|
||||
implementation
|
||||
uses
|
||||
bcbrightandcontrast;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TaForm }
|
||||
|
||||
procedure BCButtonWindows8(AButton: TBCButtonFocus; cl1, cl2: TColor);
|
||||
begin
|
||||
AButton.Rounding.RoundX := 1;
|
||||
AButton.Rounding.RoundY := 1;
|
||||
AButton.RoundingDropDown.Assign(AButton.Rounding);
|
||||
|
||||
with AButton.StateNormal do
|
||||
begin
|
||||
Background.Style := bbsColor;
|
||||
Background.Color := cl1;
|
||||
Border.Style := bboSolid;
|
||||
Border.Width := 1;
|
||||
Border.Color := cl1;
|
||||
Border.LightWidth := 0;
|
||||
Border.LightOpacity := 255;
|
||||
Border.Style := bboSolid;
|
||||
// This will be automatically set with the GetContrastColor function
|
||||
//FontEx.Color := clWhite;
|
||||
FontEx.Shadow := False;
|
||||
FontEx.Style := [];
|
||||
end;
|
||||
|
||||
AButton.StateHover.Assign(AButton.StateNormal);
|
||||
AButton.StateClicked.Assign(AButton.StateNormal);
|
||||
|
||||
with AButton.StateHover do
|
||||
begin
|
||||
Background.Color := cl2;
|
||||
Border.Color := cl2;
|
||||
end;
|
||||
|
||||
with AButton.StateClicked do
|
||||
begin
|
||||
Background.Color := cl2;
|
||||
Border.Color := cl2;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TaForm.FormCreate(Sender: TObject);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := 0 to aForm.ComponentCount - 1 do
|
||||
begin
|
||||
if aForm.Components[i] is TBCButtonFocus then
|
||||
begin
|
||||
{ Default style, color for normal and pressed }
|
||||
BCButtonWindows8(TBCButtonFocus(aForm.Components[i]), clNavy, clGray);
|
||||
{ Hover color based on normal color }
|
||||
TBCButtonFocus(aForm.Components[i]).StateHover.Background.Color :=
|
||||
Bright(TBCButtonFocus(aForm.Components[i]).StateNormal.Background.Color, 20);
|
||||
{ Font color based on normal color }
|
||||
TBCButtonFocus(aForm.Components[i]).StateNormal.FontEx.Color :=
|
||||
GetContrastColor(TBCButtonFocus(aForm.Components[i]).StateNormal.Background.Color);
|
||||
TBCButtonFocus(aForm.Components[i]).StateHover.FontEx.Color :=
|
||||
GetContrastColor(TBCButtonFocus(aForm.Components[i]).StateNormal.Background.Color);
|
||||
TBCButtonFocus(aForm.Components[i]).StateClicked.FontEx.Color :=
|
||||
GetContrastColor(TBCButtonFocus(aForm.Components[i]).StateNormal.Background.Color);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user