mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-02-18 18:16:31 +01:00
customdrawn: Brings back the winxp button
git-svn-id: trunk@33267 -
This commit is contained in:
parent
492de3197f
commit
7affaf002f
@ -6,50 +6,90 @@ interface
|
||||
|
||||
uses
|
||||
// RTL
|
||||
Classes, SysUtils,
|
||||
// fpimage
|
||||
fpcanvas, fpimgcanv, fpimage,
|
||||
Classes, SysUtils, Types,
|
||||
// LCL -> Use only TForm, TWinControl, TCanvas and TLazIntfImage
|
||||
Graphics, Controls, LCLType, LCLIntf, IntfGraphics,
|
||||
Graphics, Controls, LCLType,
|
||||
//
|
||||
customdrawncontrols, customdrawnutils;
|
||||
customdrawndrawers, customdrawn_common, customdrawnutils;
|
||||
|
||||
{type
|
||||
TCDButtonDrawerXPTB = class(TCDButtonDrawer)
|
||||
type
|
||||
|
||||
{ TCDDrawerWinXP }
|
||||
|
||||
TCDDrawerWinXP = class(TCDDrawerCommon)
|
||||
public
|
||||
procedure DrawToIntfImage(ADest: TFPImageCanvas; CDButton: TCDButton); override;
|
||||
procedure DrawToCanvas(ADest: TCanvas; CDButton: TCDButton); override;
|
||||
end;}
|
||||
// ===================================
|
||||
// Standard Tab
|
||||
// ===================================
|
||||
// TCDButton
|
||||
procedure DrawButton(ADest: TCanvas; ADestPos: TPoint; ASize: TSize;
|
||||
AState: TCDControlState; AStateEx: TCDControlStateEx); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
{procedure TCDButtonDrawerXPTB.DrawToIntfImage(ADest: TFPImageCanvas;
|
||||
CDButton: TCDButton);
|
||||
begin
|
||||
{ TCDDrawerWinXP }
|
||||
|
||||
end;
|
||||
|
||||
procedure TCDButtonDrawerXPTB.DrawToCanvas(ADest: TCanvas; CDButton: TCDButton);
|
||||
procedure TCDDrawerWinXP.DrawButton(ADest: TCanvas; ADestPos: TPoint;
|
||||
ASize: TSize; AState: TCDControlState; AStateEx: TCDControlStateEx);
|
||||
var
|
||||
Str: string;
|
||||
lColor: TColor;
|
||||
begin
|
||||
if CDButton.IsDown then
|
||||
DrawCDButtonDown(ADest, CDButton.GetRGBBackgroundColor)
|
||||
else if CDButton.Focused then
|
||||
DrawXPTaskbarButton(ADest, GetAColor(CDButton.Color, 98))
|
||||
if csfSunken in AState then
|
||||
begin
|
||||
lColor := AStateEx.RGBColor;
|
||||
|
||||
ADest.Brush.Style := bsSolid;
|
||||
ADest.Brush.Color := lColor;
|
||||
ADest.Pen.Color := lColor;
|
||||
ADest.Rectangle(0, 0, ASize.cx, ASize.cy);
|
||||
ADest.FillRect(0, 0, ASize.cx, ASize.cy);
|
||||
ADest.Brush.Color := GetAColor(lColor, 93);
|
||||
ADest.Pen.Color := GetAColor(lColor, 76);
|
||||
ADest.RoundRect(0, 0, ASize.cx, ASize.cy, 8, 8);
|
||||
end
|
||||
else
|
||||
DrawXPTaskbarButton(ADest, CDButton.Color);
|
||||
begin
|
||||
if csfHasFocus in AState then
|
||||
lColor := RGBToColor($FB, $FB, $FB)
|
||||
else
|
||||
lColor := AStateEx.RGBColor;
|
||||
|
||||
ADest.Brush.Color := lColor;
|
||||
ADest.Brush.Style := bsSolid;
|
||||
ADest.FillRect(0, 0, ASize.cx, ASize.cy);
|
||||
ADest.Pen.Color := lColor;
|
||||
ADest.RecTangle(0, 0, ASize.cx, ASize.cy);
|
||||
ADest.Pen.Color := GetAColor(lColor, 86);
|
||||
ADest.RoundRect(0, 0, ASize.cx, ASize.cy, 8, 8);
|
||||
// Pen.Color := aColor;
|
||||
// RecTangle(0, 6, Width, Height);
|
||||
ADest.Pen.Color := GetAColor(lColor, 86);
|
||||
ADest.Line(0, 3, 0, ASize.cy - 3);
|
||||
ADest.Line(ASize.cx, 3, ASize.cx, ASize.cy - 3);
|
||||
ADest.Line(3, ASize.cy - 1, ASize.cx - 3, ASize.cy - 1);
|
||||
ADest.Line(2, ASize.cy - 2, ASize.cx - 2, ASize.cy - 2);
|
||||
ADest.Pen.Color := GetAColor(lColor, 93);
|
||||
ADest.Line(1, ASize.cy - 4, ASize.cx - 1, ASize.cy - 4);
|
||||
ADest.Pen.Color := GetAColor(lColor, 91);
|
||||
ADest.Line(1, ASize.cy - 3, ASize.cx - 1, ASize.cy - 3);
|
||||
ADest.Pen.Color := GetAColor(lColor, 88);
|
||||
ADest.Line(ASize.cx - 2, 4, ASize.cx - 2, ASize.cy - 3);
|
||||
//Pen.Color := GetAColor(aColor, 94);
|
||||
//Line(2, 2, 6, 2);
|
||||
end;
|
||||
|
||||
// Button text
|
||||
ADest.Font.Assign(CDButton.Font);
|
||||
ADest.Font.Assign(AStateEx.Font);
|
||||
ADest.Brush.Style := bsClear;
|
||||
ADest.Pen.Style := psSolid;
|
||||
Str := CDButton.Caption;
|
||||
ADest.TextOut((CDButton.Width - ADest.TextWidth(Str)) div 2,
|
||||
(CDButton.Height - ADest.TextHeight(Str)) div 2, Str);
|
||||
Str := AStateEx.Caption;
|
||||
ADest.TextOut((ASize.cx - ADest.TextWidth(Str)) div 2,
|
||||
(ASize.cy - ADest.TextHeight(Str)) div 2, Str);
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterButtonDrawer(TCDButtonDrawerXPTB.Create, dsWinXP);}
|
||||
RegisterDrawer(TCDDrawerWinXP.Create, dsWinXP);
|
||||
end.
|
||||
|
||||
|
||||
@ -23,10 +23,8 @@ procedure GradFill(Canvas: TFPCustomCanvas; aRect: TRect; Clr1, Clr2: TColor);
|
||||
procedure GradCenterFill(Canvas: TFPCustomCanvas; aRect: TRect;
|
||||
Clr1, Clr2: TColor; rate: float);
|
||||
procedure DrawAndroidButton(Canvas: TCanvas; Color: TColor);
|
||||
procedure DrawXPTaskbarButton(Canvas: TCanvas; Color: TColor);
|
||||
procedure FPImgCloneRect(IntfImg1, IntfImg2: TLazIntfImage; lRect: TRect; Fast: boolean);
|
||||
procedure DrawArrow(aDest: TFPCustomCanvas; aRect: TRect; R: boolean);
|
||||
procedure DrawCDButtonDown(Canvas: TCanvas; ABackgroundColor: TColor);
|
||||
|
||||
type
|
||||
PRGBTripleArray = ^TRGBTripleArray;
|
||||
@ -337,38 +335,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure DrawXPTaskbarButton(Canvas: TCanvas; Color: TColor);
|
||||
var
|
||||
aColor: TColor;
|
||||
begin
|
||||
aColor := GetUColor(Color, 96);
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Color := Color;
|
||||
Brush.Style := bsSolid;
|
||||
FillRect(0, 0, Width, Height);
|
||||
Pen.Color := aColor;
|
||||
RecTangle(0, 0, Width, Height);
|
||||
Pen.Color := GetAColor(aColor, 86);
|
||||
RoundRect(0, 0, Width, Canvas.Height, 8, 8);
|
||||
// Pen.Color := aColor;
|
||||
// RecTangle(0, 6, Width, Height);
|
||||
Pen.Color := GetAColor(aColor, 86);
|
||||
Line(0, 3, 0, Height - 3);
|
||||
Line(Width, 3, Width, Height - 3);
|
||||
Line(3, Height - 1, Width - 3, Height - 1);
|
||||
Line(2, Height - 2, Width - 2, Height - 2);
|
||||
Pen.Color := GetAColor(aColor, 93);
|
||||
Line(1, Height - 4, Width - 1, Height - 4);
|
||||
Pen.Color := GetAColor(aColor, 91);
|
||||
Line(1, Height - 3, Width - 1, Height - 3);
|
||||
Pen.Color := GetAColor(aColor, 88);
|
||||
Line(Width - 2, 4, Width - 2, Height - 3);
|
||||
//Pen.Color := GetAColor(aColor, 94);
|
||||
//Line(2, 2, 6, 2);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure FastAntiAliasPicture(orig_bmp, dest_bmp: TBitmap);
|
||||
var
|
||||
x, y, cx, cy: integer;
|
||||
@ -439,20 +405,5 @@ begin
|
||||
TmpBmp.Free;
|
||||
end;
|
||||
|
||||
procedure DrawCDButtonDown(Canvas: TCanvas; ABackgroundColor: TColor);
|
||||
begin
|
||||
with Canvas do
|
||||
begin
|
||||
Brush.Style := bsSolid;
|
||||
Brush.Color := ABackgroundColor;
|
||||
Pen.Color := Brush.Color;
|
||||
Rectangle(0, 0, Width, Height);
|
||||
FillRect(0, 0, Width, Height);
|
||||
Brush.Color := GetAColor(ABackgroundColor, 93);
|
||||
Pen.Color := GetAColor(Brush.Color, 76);
|
||||
RoundRect(0, 0, Width, Height, 8, 8);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user