You've already forked lazarus-ccr
SpkToolbar: RTL support for the "More options" button.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8961 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -241,19 +241,29 @@ procedure TSpkPane.SetRect(ARect: T2DIntRect);
|
|||||||
var
|
var
|
||||||
Pt: T2DIntPoint;
|
Pt: T2DIntPoint;
|
||||||
i: integer;
|
i: integer;
|
||||||
|
x1, x2: Integer;
|
||||||
Layout: TSpkPaneItemsLayout;
|
Layout: TSpkPaneItemsLayout;
|
||||||
begin
|
begin
|
||||||
FRect := ARect;
|
FRect := ARect;
|
||||||
|
|
||||||
// Set 'More options' button rect
|
// Set 'More options' button rect
|
||||||
|
if IsRightToLeft then
|
||||||
|
begin
|
||||||
|
x1 := FRect.Left + PaneBorderHalfSize + 2;
|
||||||
|
x2 := FRect.Left + PaneBorderHalfSize + PaneMoreOptionsButtonWidth;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
x1 := FRect.Right - PaneBorderHalfSize - PaneMoreOptionsButtonWidth;
|
||||||
|
x2 := FRect.Right - PaneBorderHalfSize - 2;
|
||||||
|
end;
|
||||||
{$IFDEF EnhancedRecordSupport}
|
{$IFDEF EnhancedRecordSupport}
|
||||||
FMoreOptionsButtonRect := T2DIntRect.Create(
|
FMoreOptionsButtonRect := T2DIntRect.Create(
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
FMoreOptionsButtonRect := Create2DIntRect(
|
FMoreOptionsButtonRect := Create2DIntRect(
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
FRect.Right - PaneBorderHalfSize - PaneMoreOptionsButtonWidth,
|
x1,
|
||||||
FRect.Bottom - PaneCaptionHeight - PaneBorderHalfSize,
|
FRect.Bottom - PaneCaptionHeight - PaneBorderHalfSize,
|
||||||
FRect.Right - PaneBorderHalfSize - 2,
|
x2,
|
||||||
FRect.Bottom - PaneBorderHalfSize - 2
|
FRect.Bottom - PaneBorderHalfSize - 2
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -298,6 +308,9 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
R: T2DIntRect;
|
R: T2DIntRect;
|
||||||
delta: Integer;
|
delta: Integer;
|
||||||
|
w: Integer;
|
||||||
|
isRTL: Boolean;
|
||||||
|
ts: TTextStyle;
|
||||||
begin
|
begin
|
||||||
// Under some conditions, we are not able to draw::
|
// Under some conditions, we are not able to draw::
|
||||||
// * No dispatcher
|
// * No dispatcher
|
||||||
@ -308,6 +321,11 @@ begin
|
|||||||
if FAppearance = nil then
|
if FAppearance = nil then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
isRTL := IsRightToLeft;
|
||||||
|
ts := ABuffer.Canvas.TextStyle;
|
||||||
|
ts.RightToLeft := IsRightToLeft;
|
||||||
|
ABuffer.Canvas.TextStyle := ts;
|
||||||
|
|
||||||
if FPaneState = psIdle then
|
if FPaneState = psIdle then
|
||||||
begin
|
begin
|
||||||
// psIdle
|
// psIdle
|
||||||
@ -383,9 +401,19 @@ begin
|
|||||||
|
|
||||||
// Handle visibility of 'More options' button to set Pane label pos
|
// Handle visibility of 'More options' button to set Pane label pos
|
||||||
if FShowMoreOptionsButton then
|
if FShowMoreOptionsButton then
|
||||||
x := FRect.Left + (FRect.Width - PaneMoreOptionsButtonWidth - ABuffer.Canvas.TextWidth(FCaption)) div 2
|
begin
|
||||||
|
w := ABuffer.Canvas.TextWidth(FCaption);
|
||||||
|
if isRTL then
|
||||||
|
x := FRect.Right - (FRect.Width - PaneMoreOptionsButtonWidth - w) div 2 - w
|
||||||
else
|
else
|
||||||
x := FRect.Left + (FRect.Width - ABuffer.Canvas.TextWidth(FCaption)) div 2;
|
x := FRect.Left + (FRect.Width - PaneMoreOptionsButtonWidth - w) div 2;
|
||||||
|
end else
|
||||||
|
begin
|
||||||
|
if isRTL then
|
||||||
|
x := FRect.Right - (FRect.Width - w) div 2 - w
|
||||||
|
else
|
||||||
|
x := FRect.Left + (FRect.Width - w) div 2;
|
||||||
|
end;
|
||||||
y := FRect.Bottom - PaneBorderSize - PaneCaptionHeight + 1 +
|
y := FRect.Bottom - PaneBorderSize - PaneCaptionHeight + 1 +
|
||||||
(PaneCaptionHeight - ABuffer.Canvas.TextHeight('Wy')) div 2;
|
(PaneCaptionHeight - ABuffer.Canvas.TextHeight('Wy')) div 2;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user