mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-06 13:18:24 +02:00
Improve scaling of DateTimePicker. Leave GetDetailSize in places which are not fully tested yet.
This commit is contained in:
parent
bd40a6028e
commit
f99bd70b72
@ -2040,12 +2040,9 @@ function TCustomDateTimePicker.GetCheckBoxRect(IgnoreRightToLeft: Boolean): TRec
|
||||
var
|
||||
Details: TThemedElementDetails;
|
||||
CSize: TSize;
|
||||
|
||||
begin
|
||||
Details := ThemeServices.GetElementDetails(tbCheckBoxCheckedNormal);
|
||||
CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
CSize.cx := ScaleScreenToFont(CSize.cx);
|
||||
CSize.cy := ScaleScreenToFont(CSize.cy);
|
||||
|
||||
if IsRightToLeft and not IgnoreRightToLeft then begin
|
||||
Result.Right := ClientWidth - (BorderSpacing.InnerBorder + BorderWidth);
|
||||
@ -2062,10 +2059,8 @@ end;
|
||||
---------------
|
||||
Returns upper left corner of the rectangle where the text is written.
|
||||
Also used in calculating our preferred size. }
|
||||
function TCustomDateTimePicker.GetTextOrigin(IgnoreRightToLeft: Boolean
|
||||
): TPoint;
|
||||
|
||||
var
|
||||
function TCustomDateTimePicker.GetTextOrigin(IgnoreRightToLeft: Boolean): TPoint;
|
||||
var
|
||||
Re: TRect;
|
||||
B: Integer;
|
||||
XL, XR: Integer;
|
||||
@ -3105,6 +3100,7 @@ var
|
||||
S: String;
|
||||
|
||||
const
|
||||
// Enabled, Checked, Mouse hover
|
||||
CheckStates: array[Boolean, Boolean, Boolean] of TThemedButton = (
|
||||
((tbCheckBoxUncheckedDisabled, tbCheckBoxUncheckedDisabled),
|
||||
(tbCheckBoxCheckedDisabled, tbCheckBoxCheckedDisabled)),
|
||||
|
@ -2398,8 +2398,8 @@ begin
|
||||
ExpandRow(Index);
|
||||
end;
|
||||
end;
|
||||
// WasValueClick param is only for Boolean checkboxes, toggled if user
|
||||
// clicks the square. It has no effect for Boolean ComboBox editor.
|
||||
// WasValueClick param for SetItemIndexAndFocus is only for Boolean checkboxes,
|
||||
// toggled if user clicks the square. It has no effect for Boolean ComboBox editor.
|
||||
Details := ThemeServices.GetElementDetails(tbCheckBoxCheckedNormal);
|
||||
Sz := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
SetItemIndexAndFocus(Index, (X>SplitterX) and (X<=SplitterX+Sz.cx));
|
||||
|
@ -519,7 +519,8 @@ begin
|
||||
|
||||
Details := ThemeServices.GetElementDetails(tbRadioButtonUncheckedNormal);
|
||||
details_chek:=ThemeServices.GetElementDetails(tbRadioButtonCheckedNormal);
|
||||
CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
// Maybe: CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
CSize := ThemeServices.GetDetailSize(Details);
|
||||
|
||||
|
||||
while (AY < DRect.Bottom) and (i<TRadioGroup(FControl).Items.Count) do
|
||||
@ -627,7 +628,8 @@ begin
|
||||
i:=0;
|
||||
|
||||
Details := ThemeServices.GetElementDetails(tbCheckBoxUncheckedNormal);
|
||||
CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
// Maybe: CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
CSize := ThemeServices.GetDetailSize(Details);
|
||||
|
||||
aH:=Max(Canvas.TextHeight(Text) div 2, CSize.cy);
|
||||
|
||||
@ -1210,7 +1212,8 @@ var
|
||||
details: TThemedElementDetails;
|
||||
begin
|
||||
Details := ThemeServices.GetElementDetails(GetCheckStyle(Checked));
|
||||
CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
// Maybe: CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
CSize := ThemeServices.GetDetailSize(Details);
|
||||
PaintRect.Left := DRect.Left;
|
||||
PaintRect.Top := (DRect.Top + DRect.Bottom - CSize.cy) div 2;
|
||||
PaintRect := Bounds(PaintRect.Left, PaintRect.Top, CSize.cx, CSize.cy);
|
||||
|
@ -4353,8 +4353,8 @@ begin
|
||||
soAscending: Details := ThemeServices.GetElementDetails(thHeaderSortArrowSortedUp);
|
||||
soDescending: Details := ThemeServices.GetElementDetails(thHeaderSortArrowSortedDown);
|
||||
end;
|
||||
|
||||
s := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
// Maybe: s := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
s := ThemeServices.GetDetailSize(Details);
|
||||
end else
|
||||
s := Size(-1, -1);
|
||||
if s.cx>0 then // theme services support sorted arrows
|
||||
@ -4839,7 +4839,8 @@ begin
|
||||
end else
|
||||
begin
|
||||
Details := ThemeServices.GetElementDetails(arrtb[AState]);
|
||||
CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
// Maybe: CSize := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch);
|
||||
CSize := ThemeServices.GetDetailSize(Details);
|
||||
CSize.cx := MulDiv(CSize.cx, Font.PixelsPerInch, Screen.PixelsPerInch);
|
||||
CSize.cy := MulDiv(CSize.cy, Font.PixelsPerInch, Screen.PixelsPerInch);
|
||||
end;
|
||||
|
@ -89,10 +89,11 @@ begin
|
||||
csDoubleClicks, csMenuEvents, csSetCaption, csParentBackground, csOpaque];
|
||||
FFlat := True;
|
||||
Height := 32;
|
||||
// ToDo: Test the scaling code. Widths are scaled in many places.
|
||||
Details := ThemeServices.GetElementDetails(ttbSplitButtonDropDownNormal);
|
||||
FThemeDropDownWidth := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch).cx;
|
||||
FThemeDropDownWidth := ThemeServices.GetDetailSize(Details).cx;
|
||||
Details := ThemeServices.GetElementDetails(ttbDropDownButtonNormal);
|
||||
FThemeButtonDropWidth := ThemeServices.GetDetailSizeForPPI(Details, Font.PixelsPerInch).cx;
|
||||
FThemeButtonDropWidth := ThemeServices.GetDetailSize(Details).cx;
|
||||
FButtonHeight := -1;
|
||||
FButtonWidth := -1;
|
||||
FDropDownWidth := -1;
|
||||
|
@ -241,7 +241,8 @@ begin
|
||||
else
|
||||
Detail := tbCheckBoxUncheckedNormal;
|
||||
Details := ThemeServices.GetElementDetails(Detail);
|
||||
aSize := ThemeServices.GetDetailSizeForPPI(Details, PixelsPerInch);
|
||||
// Maybe: aSize := ThemeServices.GetDetailSizeForPPI(Details, PixelsPerInch);
|
||||
aSize := ThemeServices.GetDetailSize(Details);
|
||||
NodeRect:=Node.DisplayRect(false);
|
||||
r:=Bounds(Node.DisplayIconLeft+(ImageList1.Width-aSize.cx) div 2,
|
||||
NodeRect.Top+(NodeRect.Bottom-NodeRect.Top-aSize.cy) div 2,
|
||||
@ -392,7 +393,8 @@ begin
|
||||
ButtonPanel1.OKButton.OnClick:=@OkButtonClick;
|
||||
|
||||
Details := ThemeServices.GetElementDetails(tbCheckBoxCheckedNormal);
|
||||
aSize := ThemeServices.GetDetailSizeForPPI(Details, PixelsPerInch);
|
||||
// Maybe: aSize := ThemeServices.GetDetailSizeForPPI(Details, PixelsPerInch);
|
||||
aSize := ThemeServices.GetDetailSize(Details);
|
||||
ImageList1.Width:=Max(16,aSize.cx);
|
||||
ImageList1.Height:=Max(16,aSize.cy);
|
||||
// add empty images
|
||||
|
Loading…
Reference in New Issue
Block a user