TvPlanit: Support RTL in TSpkCheckbox and TSpkRadioButton

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8955 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-10-13 08:33:51 +00:00
parent c9940f44bf
commit d3bbef0991
2 changed files with 59 additions and 18 deletions

View File

@@ -1074,6 +1074,7 @@ var
R: TRect;
SeparatorRect: TRect;
SeparatorLineColor: TColor;
ts: TTextStyle;
drawImgEnabled: Boolean = true;
begin
if FToolbarDispatch = nil then
@@ -1081,6 +1082,10 @@ begin
if FAppearance = nil then
exit;
ts := ABuffer.Canvas.TextStyle;
ts.RightToLeft := IsRightToLeft;
ABuffer.Canvas.TextStyle := ts;
if (FButtonKind <> bkSeparator) then
begin
if (FRect.Width < 2*LargeButtonRadius) or (FRect.Height < 2*LargeButtonRadius) then
@@ -1650,6 +1655,7 @@ var
leftEdgeOpen, rightEdgeOpen: Boolean;
drawImgEnabled: Boolean = true;
isRTL: Boolean;
ts: TTextStyle;
begin
if (FToolbarDispatch = nil) or (FAppearance = nil) then
exit;
@@ -1675,6 +1681,9 @@ begin
isRTL := IsRightToLeft;
sgn := IfThen(isRTL, -1, +1);
ts := ABuffer.Canvas.TextStyle;
ts.RightToLeft := isRTL;
ABuffer.Canvas.TextStyle := ts;
delta := FAppearance.Element.HotTrackBrightnessChange;
case FAppearance.Element.Style of
@@ -1896,13 +1905,13 @@ begin
if FButtonKind = bkDropdown then
begin
if isRTL then
R := Classes.Rect(FButtonRect.Left+1, FButtonRect.Top, FButtonRect.Left+dx, FButtonRect.Bottom)
R := Classes.Rect(FButtonRect.Left+1, FButtonRect.Top, FButtonRect.Left+dx+1, FButtonRect.Bottom)
else
R := Classes.Rect(FButtonRect.Right-dx, FButtonRect.Top, FButtonRect.Right, FButtonRect.Bottom);
end else
begin
if isRTL then
R := Classes.Rect(FDropDownRect.Left+1, FDropDownRect.Top, FDropDownRect.Left+dx, FDropDownRect.Bottom)
R := Classes.Rect(FDropDownRect.Left+1, FDropDownRect.Top, FDropDownRect.Left+dx+1, FDropDownRect.Bottom)
else
R := Classes.Rect(FDropdownRect.Right-dx, FDropdownRect.Top, FDropdownRect.Right, FDropdownRect.Bottom);
end;