Skip to content

Commit

Permalink
Renamed FXMaterialDesignButton to FXMaterialButton.
Browse files Browse the repository at this point in the history
  • Loading branch information
lainz committed Oct 25, 2016
1 parent cda6830 commit 03d59db
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 95 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ A button control that's looks the same as the OS button. It contains ColorKind l
# TFXContainer
The control that contains the OpenGL window. Put all the controls in top of this control to get hardware acceleration.

# TFXMaterialDesignButton
# TFXMaterialButton
A button with Material Design look, with shadow, rounded borders, text with shadow and "ripple effect".
12 changes: 6 additions & 6 deletions bgracontrolsfx.lpk
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</Optimizations>
</CodeGeneration>
</CompilerOptions>
<Version Minor="1" Release="3"/>
<Version Minor="1" Release="4"/>
<Files Count="5">
<Item1>
<Filename Value="fxbutton.pas"/>
Expand All @@ -35,14 +35,14 @@
<UnitName Value="FXGraphicControl"/>
</Item3>
<Item4>
<Filename Value="fxmaterialbutton.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="fxmaterialbutton"/>
</Item4>
<Item5>
<Filename Value="fxmaterialcolors.pas"/>
<AddToUsesPkgSection Value="False"/>
<UnitName Value="FXMaterialColors"/>
</Item4>
<Item5>
<Filename Value="fxmaterialdesignbutton.pas"/>
<HasRegisterProc Value="True"/>
<UnitName Value="FXMaterialDesignButton"/>
</Item5>
</Files>
<RequiredPkgs Count="4">
Expand Down
5 changes: 3 additions & 2 deletions bgracontrolsfx.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@

unit BGRAControlsFX;

{$warn 5023 off : no warning about unused units}
interface

uses
FXButton, FXContainer, FXMaterialDesignButton, LazarusPackageIntf;
FXButton, FXContainer, fxmaterialbutton, LazarusPackageIntf;

implementation

procedure Register;
begin
RegisterUnit('FXButton', @FXButton.Register);
RegisterUnit('FXContainer', @FXContainer.Register);
RegisterUnit('FXMaterialDesignButton', @FXMaterialDesignButton.Register);
RegisterUnit('fxmaterialbutton', @fxmaterialbutton.Register);
end;

initialization
Expand Down
68 changes: 34 additions & 34 deletions fxmaterialdesignbutton.pas → fxmaterialbutton.pas
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
unit FXMaterialDesignButton;
unit fxmaterialbutton;

{$mode objfpc}{$H+}

Expand All @@ -11,9 +11,9 @@ interface

type

{ TFXMaterialDesignButton }
{ TFXMaterialButton }

TFXMaterialDesignButton = class(TFXGraphicControl)
TFXMaterialButton = class(TFXGraphicControl)
private
FColorKind: TMaterialColor;
FFontColorAutomatic: boolean;
Expand Down Expand Up @@ -141,12 +141,12 @@ implementation

procedure Register;
begin
RegisterComponents('BGRA Controls FX', [TFXMaterialDesignButton]);
RegisterComponents('BGRA Controls FX', [TFXMaterialButton]);
end;

{ TFXMaterialDesignButton }
{ TFXMaterialButton }

procedure TFXMaterialDesignButton.SetFRoundBorders(AValue: single);
procedure TFXMaterialButton.SetFRoundBorders(AValue: single);
begin
if FRoundBorders = AValue then
Exit;
Expand All @@ -156,7 +156,7 @@ procedure TFXMaterialDesignButton.SetFRoundBorders(AValue: single);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFShadow(AValue: boolean);
procedure TFXMaterialButton.SetFShadow(AValue: boolean);
begin
if FShadow = AValue then
Exit;
Expand All @@ -168,7 +168,7 @@ procedure TFXMaterialDesignButton.SetFShadow(AValue: boolean);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFShadowColor(AValue: TColor);
procedure TFXMaterialButton.SetFShadowColor(AValue: TColor);
begin
if FShadowColor = AValue then
Exit;
Expand All @@ -178,7 +178,7 @@ procedure TFXMaterialDesignButton.SetFShadowColor(AValue: TColor);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFShadowSize(AValue: integer);
procedure TFXMaterialButton.SetFShadowSize(AValue: integer);
begin
if FShadowSize = AValue then
Exit;
Expand All @@ -190,7 +190,7 @@ procedure TFXMaterialDesignButton.SetFShadowSize(AValue: integer);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextColor(AValue: TColor);
procedure TFXMaterialButton.SetFTextColor(AValue: TColor);
begin
if FTextColor = AValue then
Exit;
Expand All @@ -200,7 +200,7 @@ procedure TFXMaterialDesignButton.SetFTextColor(AValue: TColor);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextFont(AValue: string);
procedure TFXMaterialButton.SetFTextFont(AValue: string);
begin
if FTextFont = AValue then
Exit;
Expand All @@ -212,7 +212,7 @@ procedure TFXMaterialDesignButton.SetFTextFont(AValue: string);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextQuality(AValue: TBGRAFontQuality);
procedure TFXMaterialButton.SetFTextQuality(AValue: TBGRAFontQuality);
begin
if FTextQuality = AValue then
Exit;
Expand All @@ -224,7 +224,7 @@ procedure TFXMaterialDesignButton.SetFTextQuality(AValue: TBGRAFontQuality);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextShadow(AValue: boolean);
procedure TFXMaterialButton.SetFTextShadow(AValue: boolean);
begin
if FTextShadow = AValue then
Exit;
Expand All @@ -236,7 +236,7 @@ procedure TFXMaterialDesignButton.SetFTextShadow(AValue: boolean);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextShadowColor(AValue: TColor);
procedure TFXMaterialButton.SetFTextShadowColor(AValue: TColor);
begin
if FTextShadowColor = AValue then
Exit;
Expand All @@ -246,7 +246,7 @@ procedure TFXMaterialDesignButton.SetFTextShadowColor(AValue: TColor);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextShadowOffsetX(AValue: integer);
procedure TFXMaterialButton.SetFTextShadowOffsetX(AValue: integer);
begin
if FTextShadowOffsetX = AValue then
Exit;
Expand All @@ -258,7 +258,7 @@ procedure TFXMaterialDesignButton.SetFTextShadowOffsetX(AValue: integer);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextShadowOffsetY(AValue: integer);
procedure TFXMaterialButton.SetFTextShadowOffsetY(AValue: integer);
begin
if FTextShadowOffsetY = AValue then
Exit;
Expand All @@ -270,7 +270,7 @@ procedure TFXMaterialDesignButton.SetFTextShadowOffsetY(AValue: integer);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextShadowSize(AValue: integer);
procedure TFXMaterialButton.SetFTextShadowSize(AValue: integer);
begin
if FTextShadowSize = AValue then
Exit;
Expand All @@ -282,7 +282,7 @@ procedure TFXMaterialDesignButton.SetFTextShadowSize(AValue: integer);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextSize(AValue: integer);
procedure TFXMaterialButton.SetFTextSize(AValue: integer);
begin
if FTextSize = AValue then
Exit;
Expand All @@ -294,7 +294,7 @@ procedure TFXMaterialDesignButton.SetFTextSize(AValue: integer);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFTextStyle(AValue: TFontStyles);
procedure TFXMaterialButton.SetFTextStyle(AValue: TFontStyles);
begin
if FTextStyle = AValue then
Exit;
Expand All @@ -306,7 +306,7 @@ procedure TFXMaterialDesignButton.SetFTextStyle(AValue: TFontStyles);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.CalculatePreferredSize(
procedure TFXMaterialButton.CalculatePreferredSize(
var PreferredWidth, PreferredHeight: integer; WithThemeSpace: boolean);
var
ts: TSize;
Expand Down Expand Up @@ -334,7 +334,7 @@ procedure TFXMaterialDesignButton.CalculatePreferredSize(
end;
end;

procedure TFXMaterialDesignButton.SetFNormalColor(AValue: TColor);
procedure TFXMaterialButton.SetFNormalColor(AValue: TColor);
begin
if FNormalColor = AValue then
Exit;
Expand All @@ -344,7 +344,7 @@ procedure TFXMaterialDesignButton.SetFNormalColor(AValue: TColor);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFColorKind(AValue: TMaterialColor);
procedure TFXMaterialButton.SetFColorKind(AValue: TMaterialColor);
begin
if FColorKind = AValue then
Exit;
Expand All @@ -354,7 +354,7 @@ procedure TFXMaterialDesignButton.SetFColorKind(AValue: TMaterialColor);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFFontColorAutomatic(AValue: boolean);
procedure TFXMaterialButton.SetFFontColorAutomatic(AValue: boolean);
begin
if FFontColorAutomatic = AValue then
Exit;
Expand All @@ -364,7 +364,7 @@ procedure TFXMaterialDesignButton.SetFFontColorAutomatic(AValue: boolean);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.SetFNormalColorEffect(AValue: TColor);
procedure TFXMaterialButton.SetFNormalColorEffect(AValue: TColor);
begin
if FNormalColorEffect = AValue then
Exit;
Expand All @@ -374,13 +374,13 @@ procedure TFXMaterialDesignButton.SetFNormalColorEffect(AValue: TColor);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.OnStartTimer(Sender: TObject);
procedure TFXMaterialButton.OnStartTimer(Sender: TObject);
begin
FCircleAlpha := 255;
FCircleSize := 0;
end;

procedure TFXMaterialDesignButton.OnTimer(Sender: TObject);
procedure TFXMaterialButton.OnTimer(Sender: TObject);
begin
FNeedDraw := True;

Expand All @@ -399,7 +399,7 @@ procedure TFXMaterialDesignButton.OnTimer(Sender: TObject);
FXInvalidate;
end;

procedure TFXMaterialDesignButton.MouseDown(Button: TMouseButton;
procedure TFXMaterialButton.MouseDown(Button: TMouseButton;
Shift: TShiftState; X, Y: integer);
begin
if Button = mbLeft then
Expand All @@ -411,13 +411,13 @@ procedure TFXMaterialDesignButton.MouseDown(Button: TMouseButton;
inherited MouseDown(Button, Shift, X, Y);
end;

class function TFXMaterialDesignButton.GetControlClassDefaultSize: TSize;
class function TFXMaterialButton.GetControlClassDefaultSize: TSize;
begin
Result.CX := 123;
Result.CY := 33;
end;

procedure TFXMaterialDesignButton.TextChanged;
procedure TFXMaterialButton.TextChanged;
begin
InvalidatePreferredSize;
AdjustSize;
Expand All @@ -426,7 +426,7 @@ procedure TFXMaterialDesignButton.TextChanged;
FXInvalidate;
end;

procedure TFXMaterialDesignButton.UpdateShadow;
procedure TFXMaterialButton.UpdateShadow;
var
temp: TBGRABitmap;
begin
Expand All @@ -444,7 +444,7 @@ procedure TFXMaterialDesignButton.UpdateShadow;
FNeedDraw := True;
end;

procedure TFXMaterialDesignButton.DrawTextShadow(AHeight: integer; ATextColor: TColor);
procedure TFXMaterialButton.DrawTextShadow(AHeight: integer; ATextColor: TColor);
var
bmpSdw: TBGRABitmap;
OutTxtSize: TSize;
Expand Down Expand Up @@ -482,7 +482,7 @@ procedure TFXMaterialDesignButton.DrawTextShadow(AHeight: integer; ATextColor: T
FXLayers[1].BGRA.TextOut(OutX, OutY, Caption, ATextColor);
end;

procedure TFXMaterialDesignButton.Draw;
procedure TFXMaterialButton.Draw;
var
temp: TBGRABitmap;
round_rect_left: integer;
Expand Down Expand Up @@ -563,7 +563,7 @@ procedure TFXMaterialDesignButton.Draw;
end;
end;

constructor TFXMaterialDesignButton.Create(AOwner: TComponent);
constructor TFXMaterialButton.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
with GetControlClassDefaultSize do
Expand Down Expand Up @@ -593,7 +593,7 @@ constructor TFXMaterialDesignButton.Create(AOwner: TComponent);
FFontColorAutomatic := True;
end;

destructor TFXMaterialDesignButton.Destroy;
destructor TFXMaterialButton.Destroy;
begin
FTimer.Enabled := False;
FTimer.OnStartTimer := nil;
Expand Down
16 changes: 10 additions & 6 deletions test/test_hybrid/umain.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,28 @@ object frmMain: TfrmMain
Align = alLeft
AutoResizeViewport = True
Color = clWhite
object FXMaterialDesignButton1: TFXMaterialDesignButton
object FXMaterialButton1: TFXMaterialButton
Left = 8
Height = 42
Top = 8
Width = 216
Width = 168
ColorKind = mcDefault
FontColorAutomatic = True
TextFont = 'default'
AutoSize = True
Caption = 'FXMaterialDesignButton1'
Caption = 'FXMaterialButton1'
end
end
object FXMaterialDesignButton2: TFXMaterialDesignButton
object FXMaterialButton2: TFXMaterialButton
Left = 232
Height = 42
Top = 8
Width = 216
Width = 168
ColorKind = mcDefault
FontColorAutomatic = True
TextFont = 'default'
AutoSize = True
Caption = 'FXMaterialDesignButton2'
Caption = 'FXMaterialButton2'
end
object Splitter1: TSplitter
Left = 227
Expand Down
6 changes: 3 additions & 3 deletions test/test_hybrid/umain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ interface

uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
FXContainer, FXMaterialDesignButton;
FXContainer, FXMaterialButton;

type

{ TfrmMain }

TfrmMain = class(TForm)
FXContainer1: TFXContainer;
FXMaterialDesignButton1: TFXMaterialDesignButton;
FXMaterialDesignButton2: TFXMaterialDesignButton;
FXMaterialDesignButton1: TFXMaterialButton;
FXMaterialDesignButton2: TFXMaterialButton;
Splitter1: TSplitter;
private

Expand Down
Loading

0 comments on commit 03d59db

Please sign in to comment.