Стартовый пул
This commit is contained in:
BIN
bgracontrols/test/test_bccombobox/test_bccombobox.ico
Normal file
BIN
bgracontrols/test/test_bccombobox/test_bccombobox.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 134 KiB |
86
bgracontrols/test/test_bccombobox/test_bccombobox.lpi
Normal file
86
bgracontrols/test/test_bccombobox/test_bccombobox.lpi
Normal file
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<CompatibilityMode Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="test_bccombobox"/>
|
||||
<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"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="bgracontrols"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="test_bccombobox.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="umain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="test_bccombobox"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf2Set"/>
|
||||
</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>
|
22
bgracontrols/test/test_bccombobox/test_bccombobox.lpr
Normal file
22
bgracontrols/test/test_bccombobox/test_bccombobox.lpr
Normal file
@@ -0,0 +1,22 @@
|
||||
program test_bccombobox;
|
||||
|
||||
{$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.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
180
bgracontrols/test/test_bccombobox/umain.lfm
Normal file
180
bgracontrols/test/test_bccombobox/umain.lfm
Normal file
@@ -0,0 +1,180 @@
|
||||
object Form1: TForm1
|
||||
Left = 433
|
||||
Height = 218
|
||||
Top = 119
|
||||
Width = 400
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 218
|
||||
ClientWidth = 400
|
||||
DesignTimePPI = 120
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '2.0.2.0'
|
||||
object BCComboBox1: TBCComboBox
|
||||
Left = 10
|
||||
Height = 49
|
||||
Top = 10
|
||||
Width = 184
|
||||
Items.Strings = (
|
||||
'One'
|
||||
'Two'
|
||||
'Three'
|
||||
)
|
||||
ItemIndex = 0
|
||||
ArrowSize = 8
|
||||
ArrowWidth = 16
|
||||
DropDownBorderColor = 4194304
|
||||
DropDownColor = 8405056
|
||||
DropDownFontColor = 16770790
|
||||
DropDownHighlight = 16744448
|
||||
DropDownFontHighlight = clWhite
|
||||
GlobalOpacity = 255
|
||||
MemoryUsage = bmuHigh
|
||||
Rounding.RoundX = 12
|
||||
Rounding.RoundY = 12
|
||||
StateClicked.Background.Gradient1.StartColor = 8404992
|
||||
StateClicked.Background.Gradient1.EndColor = 4194304
|
||||
StateClicked.Background.Gradient1.GradientType = gtRadial
|
||||
StateClicked.Background.Gradient1.Point1XPercent = 50
|
||||
StateClicked.Background.Gradient1.Point1YPercent = 100
|
||||
StateClicked.Background.Gradient1.Point2XPercent = 0
|
||||
StateClicked.Background.Gradient1.Point2YPercent = 0
|
||||
StateClicked.Background.Gradient2.StartColor = clWhite
|
||||
StateClicked.Background.Gradient2.EndColor = clBlack
|
||||
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.Gradient1EndPercent = 100
|
||||
StateClicked.Background.Style = bbsGradient
|
||||
StateClicked.Border.Style = bboNone
|
||||
StateClicked.FontEx.Color = 16770790
|
||||
StateClicked.FontEx.FontQuality = fqFineAntialiasing
|
||||
StateClicked.FontEx.Height = 16
|
||||
StateClicked.FontEx.Shadow = True
|
||||
StateClicked.FontEx.ShadowRadius = 2
|
||||
StateClicked.FontEx.ShadowOffsetX = 1
|
||||
StateClicked.FontEx.ShadowOffsetY = 1
|
||||
StateClicked.FontEx.Style = [fsBold]
|
||||
StateHover.Background.Gradient1.StartColor = 16744448
|
||||
StateHover.Background.Gradient1.EndColor = 8404992
|
||||
StateHover.Background.Gradient1.GradientType = gtRadial
|
||||
StateHover.Background.Gradient1.Point1XPercent = 50
|
||||
StateHover.Background.Gradient1.Point1YPercent = 100
|
||||
StateHover.Background.Gradient1.Point2XPercent = 0
|
||||
StateHover.Background.Gradient1.Point2YPercent = 0
|
||||
StateHover.Background.Gradient2.StartColor = clWhite
|
||||
StateHover.Background.Gradient2.EndColor = clBlack
|
||||
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.Gradient1EndPercent = 100
|
||||
StateHover.Background.Style = bbsGradient
|
||||
StateHover.Border.Style = bboNone
|
||||
StateHover.FontEx.Color = clWhite
|
||||
StateHover.FontEx.FontQuality = fqFineAntialiasing
|
||||
StateHover.FontEx.Height = 16
|
||||
StateHover.FontEx.Shadow = True
|
||||
StateHover.FontEx.ShadowRadius = 2
|
||||
StateHover.FontEx.ShadowOffsetX = 1
|
||||
StateHover.FontEx.ShadowOffsetY = 1
|
||||
StateHover.FontEx.Style = [fsBold]
|
||||
StateNormal.Background.Gradient1.StartColor = 4194304
|
||||
StateNormal.Background.Gradient1.EndColor = 8405056
|
||||
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.Gradient2.StartColor = 8405056
|
||||
StateNormal.Background.Gradient2.EndColor = 4194304
|
||||
StateNormal.Background.Gradient2.GradientType = gtRadial
|
||||
StateNormal.Background.Gradient2.Point1XPercent = 50
|
||||
StateNormal.Background.Gradient2.Point1YPercent = 100
|
||||
StateNormal.Background.Gradient2.Point2XPercent = 0
|
||||
StateNormal.Background.Gradient2.Point2YPercent = 0
|
||||
StateNormal.Background.Gradient1EndPercent = 60
|
||||
StateNormal.Background.Style = bbsGradient
|
||||
StateNormal.Border.Style = bboNone
|
||||
StateNormal.FontEx.Color = 16770790
|
||||
StateNormal.FontEx.FontQuality = fqFineAntialiasing
|
||||
StateNormal.FontEx.Height = 16
|
||||
StateNormal.FontEx.Shadow = True
|
||||
StateNormal.FontEx.ShadowRadius = 2
|
||||
StateNormal.FontEx.ShadowOffsetX = 1
|
||||
StateNormal.FontEx.ShadowOffsetY = 1
|
||||
StateNormal.FontEx.Style = [fsBold]
|
||||
StaticButton = False
|
||||
OnChange = BCComboBox1Change
|
||||
end
|
||||
object Label1: TLabel
|
||||
Left = 208
|
||||
Height = 22
|
||||
Top = 24
|
||||
Width = 53
|
||||
Caption = 'Waiting'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 12
|
||||
Height = 22
|
||||
Top = 82
|
||||
Width = 41
|
||||
Caption = 'Style :'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object RadioFlash: TBGRAThemeRadioButton
|
||||
Left = 8
|
||||
Height = 22
|
||||
Top = 152
|
||||
Width = 69
|
||||
Caption = 'Flash'
|
||||
Checked = False
|
||||
Theme = BGRAColorTheme1
|
||||
OnChange = RadioButtonChange
|
||||
end
|
||||
object RadioWin7: TBGRAThemeRadioButton
|
||||
Left = 8
|
||||
Height = 22
|
||||
Top = 128
|
||||
Width = 66
|
||||
Caption = 'Win7'
|
||||
Checked = False
|
||||
Theme = BGRAColorTheme1
|
||||
OnChange = RadioButtonChange
|
||||
end
|
||||
object RadioCustom: TBGRAThemeRadioButton
|
||||
Left = 8
|
||||
Height = 22
|
||||
Top = 176
|
||||
Width = 86
|
||||
Caption = 'Custom'
|
||||
Checked = False
|
||||
Theme = BGRAColorTheme1
|
||||
OnChange = RadioButtonChange
|
||||
end
|
||||
object RadioDefault: TBGRAThemeRadioButton
|
||||
Left = 8
|
||||
Height = 22
|
||||
Top = 104
|
||||
Width = 86
|
||||
Caption = 'Default'
|
||||
Checked = True
|
||||
Theme = BGRAColorTheme1
|
||||
OnChange = RadioButtonChange
|
||||
end
|
||||
object BGRAColorTheme1: TBGRAColorTheme
|
||||
ColorNormal = clBlack
|
||||
ColorHover = 24576
|
||||
ColorActive = clGreen
|
||||
ColorDisabled = clGray
|
||||
ColorFocused = clMoneyGreen
|
||||
ColorText = clBlack
|
||||
left = 240
|
||||
top = 90
|
||||
end
|
||||
end
|
179
bgracontrols/test/test_bccombobox/umain.pas
Normal file
179
bgracontrols/test/test_bccombobox/umain.pas
Normal file
@@ -0,0 +1,179 @@
|
||||
unit umain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, BCComboBox,
|
||||
BCListBox, LCLType, BCSamples, BGRAThemeRadioButton, BGRAColorTheme, Types;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
BCComboBox1: TBCComboBox;
|
||||
BGRAColorTheme1: TBGRAColorTheme;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
RadioCustom: TBGRAThemeRadioButton;
|
||||
RadioFlash: TBGRAThemeRadioButton;
|
||||
RadioWin7: TBGRAThemeRadioButton;
|
||||
RadioDefault: TBGRAThemeRadioButton;
|
||||
procedure BCComboBox1Change(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure RadioButtonChange(Sender: TObject);
|
||||
private
|
||||
procedure OnBCComboBoxDrawItem(Control: TWinControl; Index: integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
public
|
||||
procedure ApplyFlashStyle;
|
||||
procedure ApplyWin7Style;
|
||||
procedure ApplyCustomStyle;
|
||||
procedure ApplyDefaultStyle;
|
||||
procedure UpdateStyle;
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
// Style drop down
|
||||
//UpdateStyle;
|
||||
end;
|
||||
|
||||
procedure TForm1.RadioButtonChange(Sender: TObject);
|
||||
begin
|
||||
UpdateStyle;
|
||||
end;
|
||||
|
||||
procedure TForm1.BCComboBox1Change(Sender: TObject);
|
||||
begin
|
||||
Label1.Caption := 'Changed to '+BCComboBox1.Text;
|
||||
end;
|
||||
|
||||
procedure TForm1.OnBCComboBoxDrawItem(Control: TWinControl; Index: integer;
|
||||
ARect: TRect; State: TOwnerDrawState);
|
||||
var
|
||||
aCanvas: TCanvas;
|
||||
s: String;
|
||||
begin
|
||||
aCanvas := BCComboBox1.Canvas;
|
||||
s := BCComboBox1.Items[Index];
|
||||
|
||||
// selected item
|
||||
if odChecked in State then s := '√ '+s;
|
||||
|
||||
if odSelected in State then
|
||||
aCanvas.Brush.Color := clBlack
|
||||
else
|
||||
if odChecked in State then
|
||||
aCanvas.Brush.Color := $505050
|
||||
else
|
||||
aCanvas.Brush.Color := clGray;
|
||||
|
||||
aCanvas.Font.Color := clWhite;
|
||||
aCanvas.FillRect(ARect);
|
||||
|
||||
// mouse over
|
||||
if odSelected in State then
|
||||
begin
|
||||
aCanvas.Pen.Style := psSolid;
|
||||
aCanvas.Pen.Color := clRed;
|
||||
aCanvas.Rectangle(ARect);
|
||||
end;
|
||||
|
||||
// vertically centered text
|
||||
aCanvas.TextRect(ARect, 15, ARect.Top +
|
||||
(ARect.Height - aCanvas.GetTextHeight(s)) div 2, s);
|
||||
end;
|
||||
|
||||
procedure TForm1.ApplyFlashStyle;
|
||||
var
|
||||
prevFontHeight: Integer;
|
||||
begin
|
||||
prevFontHeight := BCCombobox1.StateNormal.FontEx.Height;
|
||||
StyleButtonsSample(BCComboBox1.Button, TBCSampleStyle.ssFlashPlayer);
|
||||
BCCombobox1.StateNormal.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateHover.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateClicked.FontEx.Height := prevFontHeight;
|
||||
BCComboBox1.DropDownColor := $606060;
|
||||
BCComboBox1.DropDownFontColor := $c0c0c0;
|
||||
BCComboBox1.DropDownBorderSize:= 2;
|
||||
BCComboBox1.DropDownBorderColor:= $404040;
|
||||
BCComboBox1.DropDownHighlight := $FC992E;
|
||||
BCComboBox1.DropDownFontHighlight := clWhite;
|
||||
BCComboBox1.OnDrawItem := nil;
|
||||
end;
|
||||
|
||||
procedure TForm1.ApplyWin7Style;
|
||||
var
|
||||
prevFontHeight: Integer;
|
||||
begin
|
||||
prevFontHeight := BCCombobox1.StateNormal.FontEx.Height;
|
||||
StyleButtonsSample(BCComboBox1.Button, TBCSampleStyle.ssWindows7);
|
||||
BCCombobox1.StateNormal.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateHover.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateClicked.FontEx.Height := prevFontHeight;
|
||||
BCComboBox1.DropDownColor := clWhite;
|
||||
BCComboBox1.DropDownFontColor := clBlack;
|
||||
BCComboBox1.DropDownBorderSize:= 1;
|
||||
BCComboBox1.DropDownBorderColor:= clBlack;
|
||||
BCComboBox1.DropDownHighlight := $FC992E;
|
||||
BCComboBox1.DropDownFontHighlight := clWhite;
|
||||
BCComboBox1.OnDrawItem := nil;
|
||||
end;
|
||||
|
||||
procedure TForm1.ApplyCustomStyle;
|
||||
var
|
||||
prevFontHeight: Integer;
|
||||
begin
|
||||
prevFontHeight := BCCombobox1.StateNormal.FontEx.Height;
|
||||
StyleButtonsSample(BCComboBox1.Button, TBCSampleStyle.ssMacOSXLion);
|
||||
BCCombobox1.StateNormal.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateHover.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateClicked.FontEx.Height := prevFontHeight;
|
||||
BCComboBox1.DropDownColor := clGray;
|
||||
BCComboBox1.DropDownBorderSize:= 3;
|
||||
BCComboBox1.DropDownBorderColor:= clGreen;
|
||||
BCComboBox1.OnDrawItem := @OnBCComboBoxDrawItem;
|
||||
Canvas.Font.Height := BCComboBox1.StateNormal.FontEx.Height;
|
||||
BCComboBox1.ItemHeight := 2*Canvas.GetTextHeight('aq');
|
||||
end;
|
||||
|
||||
procedure TForm1.ApplyDefaultStyle;
|
||||
var
|
||||
prevFontHeight: Integer;
|
||||
begin
|
||||
prevFontHeight := BCCombobox1.StateNormal.FontEx.Height;
|
||||
StyleButtonsSample(BCComboBox1.Button, TBCSampleStyle.ssDefault);
|
||||
BCCombobox1.StateNormal.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateHover.FontEx.Height := prevFontHeight;
|
||||
BCCombobox1.StateClicked.FontEx.Height := prevFontHeight;
|
||||
BCComboBox1.DropDownBorderColor := $00400000;
|
||||
BCComboBox1.DropDownBorderSize:= 1;
|
||||
BCComboBox1.DropDownColor := $00804040;
|
||||
BCComboBox1.DropDownFontColor := $00FFE6E6;
|
||||
BCComboBox1.DropDownFontHighlight := clWhite;
|
||||
BCComboBox1.DropDownHighlight := $00FF8000;
|
||||
BCComboBox1.OnDrawItem := nil;
|
||||
end;
|
||||
|
||||
procedure TForm1.UpdateStyle;
|
||||
begin
|
||||
if RadioWin7.Checked then ApplyWin7Style
|
||||
else if RadioFlash.Checked then ApplyFlashStyle
|
||||
else if RadioCustom.Checked then ApplyCustomStyle
|
||||
else ApplyDefaultStyle;
|
||||
end;
|
||||
|
||||
end.
|
Reference in New Issue
Block a user