You've already forked lazarus-ccr
jvcllaz: Fix painting of TDialButton in Linux/gtk2
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6988 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -929,12 +929,12 @@ const
|
|||||||
HalfPi = 1.57079632679489661923;
|
HalfPi = 1.57079632679489661923;
|
||||||
var
|
var
|
||||||
Edge: Integer;
|
Edge: Integer;
|
||||||
Face, Highlight, Shadow: TColor;
|
FaceClr, HighlightClr, ShadowClr: TColor;
|
||||||
Size: Integer;
|
Size: Integer;
|
||||||
OldOrg: TPoint;
|
|
||||||
lCanvas: TCanvas;
|
lCanvas: TCanvas;
|
||||||
I: Integer;
|
I: Integer;
|
||||||
lColor: TColor;
|
lColor: TColor;
|
||||||
|
xL, yT, xR, yB: Integer;
|
||||||
begin
|
begin
|
||||||
Size := 2 * FRadius + 1;
|
Size := 2 * FRadius + 1;
|
||||||
lCanvas := FBitmap.Canvas;
|
lCanvas := FBitmap.Canvas;
|
||||||
@ -944,33 +944,34 @@ begin
|
|||||||
if not StyleServices.Enabled then
|
if not StyleServices.Enabled then
|
||||||
{$ENDIF JVCLThemesEnabled}
|
{$ENDIF JVCLThemesEnabled}
|
||||||
lCanvas.FillRect(FBitmapRect);
|
lCanvas.FillRect(FBitmapRect);
|
||||||
SetViewportOrgEx(lCanvas.Handle, FSize div 2 - FRadius, FSize div 2 - FRadius,
|
|
||||||
@OldOrg);
|
|
||||||
try
|
|
||||||
// Draw edge.
|
|
||||||
lCanvas.Pen.Style := psClear;
|
|
||||||
|
|
||||||
Highlight := ColorToRGB(clBtnHighlight);
|
xL := FSize div 2 - FRadius;
|
||||||
|
xR := xL + 2*FRadius;
|
||||||
|
yT := FSize div 2 - FRadius;
|
||||||
|
yB := yT + 2*FRadius;
|
||||||
|
|
||||||
|
lCanvas.Pen.Style := psClear;
|
||||||
|
HighlightClr := ColorToRGB(clBtnHighlight);
|
||||||
if Color = clDefault then
|
if Color = clDefault then
|
||||||
lColor := clGray
|
lColor := clGray
|
||||||
else
|
else
|
||||||
lColor := Color;
|
lColor := Color;
|
||||||
Face := ColorToRGB(lColor);
|
FaceClr := ColorToRGB(lColor);
|
||||||
// darking the color by halving each color part value
|
// darking the color by halving each color part value
|
||||||
Shadow := (ColorToRGB(lColor) and $00FEFEFE) shr 1;
|
ShadowClr := (ColorToRGB(lColor) and $00FEFEFE) shr 1;
|
||||||
|
|
||||||
for I := 0 to Size do
|
for I := 0 to Size do
|
||||||
begin
|
begin
|
||||||
lCanvas.Brush.Color := Blend(Cos(I * HalfPi / Size), Highlight, Face);
|
lCanvas.Brush.Color := Blend(Cos(I * HalfPi / Size), HighlightClr, FaceClr);
|
||||||
lCanvas.Pie(0, 0, Size, Size, I + 1, 0, I - 1, 0);
|
lCanvas.Pie(xL, yT, xR, yB, I+1, 0, I-1, 0);
|
||||||
lCanvas.Pie(0, 0, Size, Size, 0, I - 1, 0, I + 1);
|
lCanvas.Pie(xL, yT, xR, yB, 0, I-1, 0, I+1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for I := 0 to Size do
|
for I := 0 to Size do
|
||||||
begin
|
begin
|
||||||
lCanvas.Brush.Color := Blend(1.0 - Sin(I * HalfPi / Size), Face, Shadow);
|
lCanvas.Brush.Color := Blend(1.0 - Sin(I * HalfPi / Size), FaceClr, ShadowClr);
|
||||||
lCanvas.Pie(0, 0, Size, Size, Size, I + 1, Size, I - 1);
|
lCanvas.Pie(xL, yT, xR, yB, Size, I+1, Size, I-1);
|
||||||
lCanvas.Pie(0, 0, Size, Size, I - 1, Size, I + 1, Size);
|
lCanvas.Pie(xL, yT, xR, yB, I-1, Size, I+1, Size);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Draw top of disk.
|
// Draw top of disk.
|
||||||
@ -978,16 +979,13 @@ begin
|
|||||||
lCanvas.Pen.Color := lColor;
|
lCanvas.Pen.Color := lColor;
|
||||||
lCanvas.Brush.Color := lColor;
|
lCanvas.Brush.Color := lColor;
|
||||||
Edge := FButtonEdge * FRadius div 100 + 1;
|
Edge := FButtonEdge * FRadius div 100 + 1;
|
||||||
lCanvas.Ellipse(0 + Edge, 0 + Edge, 0 + Size - Edge, 0 + Size - Edge);
|
lCanvas.Ellipse(xL + Edge, yT + Edge, xR - Edge, yB - Edge);
|
||||||
|
|
||||||
// Draw bounding circle.
|
// Draw bounding circle.
|
||||||
lCanvas.Pen.Color := clBtnText;
|
lCanvas.Pen.Color := clBtnText;
|
||||||
lCanvas.Brush.Style := bsClear;
|
lCanvas.Brush.Style := bsClear;
|
||||||
lCanvas.Ellipse(0, 0, Size, Size);
|
lCanvas.Ellipse(xL, yT, xR, yB);
|
||||||
finally
|
|
||||||
// Reset viewport origin.
|
|
||||||
SetViewportOrgEx(lCanvas.Handle, OldOrg.X, OldOrg.Y, nil);
|
|
||||||
end;
|
|
||||||
FBitmapInvalid := False;
|
FBitmapInvalid := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1069,7 +1067,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
(*
|
||||||
{ - strange: does not compile in qt with these methods...
|
{ - strange: does not compile in qt with these methods...
|
||||||
|
|
||||||
procedure TJvCustomDialButton.FocusKilled(NextWnd: THandle);
|
procedure TJvCustomDialButton.FocusKilled(NextWnd: THandle);
|
||||||
@ -1084,8 +1082,8 @@ begin
|
|||||||
inherited FocusSet(PrevWnd);
|
inherited FocusSet(PrevWnd);
|
||||||
if HandleAllocated then
|
if HandleAllocated then
|
||||||
DrawBorder;
|
DrawBorder;
|
||||||
end;
|
end; *)
|
||||||
}
|
|
||||||
procedure TJvCustomDialButton.MouseDown(Button: TMouseButton;
|
procedure TJvCustomDialButton.MouseDown(Button: TMouseButton;
|
||||||
Shift: TShiftState; X, Y: Integer);
|
Shift: TShiftState; X, Y: Integer);
|
||||||
var
|
var
|
||||||
|
Reference in New Issue
Block a user