mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 20:09:10 +02:00
DateTimePicker: small code refactoring
git-svn-id: trunk@63925 -
This commit is contained in:
parent
5779a01102
commit
c0a1785e24
@ -3656,7 +3656,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDTSpeedButton.Paint;
|
procedure TDTSpeedButton.Paint;
|
||||||
procedure DrawDropDownArrow(const Canvas: TCanvas; const DropDownButtonRect: TRect);
|
|
||||||
|
procedure DrawThemedDropDownArrow;
|
||||||
var
|
var
|
||||||
Details: TThemedElementDetails;
|
Details: TThemedElementDetails;
|
||||||
ArrowState: TThemedToolBar;
|
ArrowState: TThemedToolBar;
|
||||||
@ -3669,17 +3670,23 @@ procedure TDTSpeedButton.Paint;
|
|||||||
ArrowState := ttbSplitButtonDropDownDisabled;
|
ArrowState := ttbSplitButtonDropDownDisabled;
|
||||||
Details := ThemeServices.GetElementDetails(ArrowState);
|
Details := ThemeServices.GetElementDetails(ArrowState);
|
||||||
ASize := ThemeServices.GetDetailSize(Details);
|
ASize := ThemeServices.GetDetailSize(Details);
|
||||||
ARect := DropDownButtonRect;
|
ARect := Rect(0, 0, Width, Height);
|
||||||
InflateRect(ARect, -(ARect.Right - ARect.Left - ASize.cx) div 2, 0);
|
InflateRect(ARect, -(ARect.Right - ARect.Left - ASize.cx) div 2, 0);
|
||||||
ThemeServices.DrawElement(Canvas.Handle, Details, ARect);
|
ThemeServices.DrawElement(Canvas.Handle, Details, ARect);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
const
|
const
|
||||||
ArrowColor = TColor($8D665A);
|
ArrowColor = TColor($8D665A);
|
||||||
|
|
||||||
var
|
var
|
||||||
X, Y: Integer;
|
X, Y: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
inherited Paint;
|
inherited Paint;
|
||||||
|
|
||||||
|
if DTPicker.FArrowShape = asTheme then
|
||||||
|
DrawThemedDropDownArrow
|
||||||
|
else begin
|
||||||
// First I ment to put arrow images in a lrs file. In my opinion, however, that
|
// First I ment to put arrow images in a lrs file. In my opinion, however, that
|
||||||
// wouldn't be an elegant option for so simple shapes.
|
// wouldn't be an elegant option for so simple shapes.
|
||||||
|
|
||||||
@ -3690,11 +3697,8 @@ begin
|
|||||||
X := (Width - 9) div 2;
|
X := (Width - 9) div 2;
|
||||||
Y := (Height - 6) div 2;
|
Y := (Height - 6) div 2;
|
||||||
|
|
||||||
{ Let's draw shape of the arrow on the button: }
|
{ Let's draw shape of the arrow on the button: }
|
||||||
case DTPicker.FArrowShape of
|
case DTPicker.FArrowShape of
|
||||||
asTheme:
|
|
||||||
DrawDropDownArrow(Canvas, Rect(0, 0, Width, Height));
|
|
||||||
|
|
||||||
asClassicLarger:
|
asClassicLarger:
|
||||||
{ triangle: }
|
{ triangle: }
|
||||||
Canvas.Polygon([Point(X + 0, Y + 1), Point(X + 8, Y + 1),
|
Canvas.Polygon([Point(X + 0, Y + 1), Point(X + 8, Y + 1),
|
||||||
@ -3716,6 +3720,8 @@ begin
|
|||||||
Canvas.Polygon([Point(X + 0, Y + 1), Point(X + 1, Y + 0),
|
Canvas.Polygon([Point(X + 0, Y + 1), Point(X + 1, Y + 0),
|
||||||
Point(X + 2, Y + 1), Point(X + 6, Y + 1),Point(X + 7, Y + 0), Point(X + 8, Y + 1), Point(X + 4, Y + 5)]);
|
Point(X + 2, Y + 1), Point(X + 6, Y + 1),Point(X + 7, Y + 0), Point(X + 8, Y + 1), Point(X + 4, Y + 5)]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomDateTimePicker.UpdateShowArrowButton;
|
procedure TCustomDateTimePicker.UpdateShowArrowButton;
|
||||||
|
Loading…
Reference in New Issue
Block a user