mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-04 16:40:23 +02:00
lcl: patch from Zaher Dirkey to fix TLabel and TStaticText alignment with respect the BiDi mode (issue #0014915)
git-svn-id: trunk@22312 -
This commit is contained in:
parent
7ffc66550f
commit
a350849e6b
@ -2365,6 +2365,8 @@ procedure AdjustBorderSpace(var RemainingClientRect, CurBorderSpace: TRect;
|
|||||||
|
|
||||||
function IsColorDefault(AControl: TControl): Boolean;
|
function IsColorDefault(AControl: TControl): Boolean;
|
||||||
|
|
||||||
|
function BidiFlipAlignment(Alignment: TAlignment; Flip: Boolean = True): TAlignment;
|
||||||
|
|
||||||
function DbgS(a: TAnchorKind): string; overload;
|
function DbgS(a: TAnchorKind): string; overload;
|
||||||
function DbgS(Anchors: TAnchors): string; overload;
|
function DbgS(Anchors: TAnchors): string; overload;
|
||||||
function DbgS(a: TAlign): string; overload;
|
function DbgS(a: TAlign): string; overload;
|
||||||
@ -2468,6 +2470,17 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function BidiFlipAlignment(Alignment: TAlignment; Flip: Boolean): TAlignment;
|
||||||
|
const
|
||||||
|
BidiAlignment: array[Boolean, TAlignment] of TAlignment =
|
||||||
|
(
|
||||||
|
( taLeftJustify, taRightJustify, taCenter ),
|
||||||
|
( taRightJustify, taLeftJustify, taCenter )
|
||||||
|
);
|
||||||
|
begin
|
||||||
|
Result := BidiAlignment[Flip, Alignment];
|
||||||
|
end;
|
||||||
|
|
||||||
function DbgS(a: TAnchorKind): string;
|
function DbgS(a: TAnchorKind): string;
|
||||||
begin
|
begin
|
||||||
Result:=AnchorNames[a];
|
Result:=AnchorNames[a];
|
||||||
|
@ -460,7 +460,7 @@ begin
|
|||||||
FillChar(TR,SizeOf(TR),0);
|
FillChar(TR,SizeOf(TR),0);
|
||||||
with TR do
|
with TR do
|
||||||
begin
|
begin
|
||||||
Alignment := Self.Alignment;
|
Alignment := BidiFlipAlignment(Self.Alignment, UseRightToLeftAlignment);
|
||||||
WordBreak := wordWrap;
|
WordBreak := wordWrap;
|
||||||
SingleLine:= not WordWrap and not HasMultiLine;
|
SingleLine:= not WordWrap and not HasMultiLine;
|
||||||
Clipping := True;
|
Clipping := True;
|
||||||
|
@ -215,6 +215,9 @@ type
|
|||||||
class procedure GetPreferredSize(const AWinControl: TWinControl;
|
class procedure GetPreferredSize(const AWinControl: TWinControl;
|
||||||
var PreferredWidth, PreferredHeight: integer;
|
var PreferredWidth, PreferredHeight: integer;
|
||||||
WithThemeSpace: Boolean); override;
|
WithThemeSpace: Boolean); override;
|
||||||
|
class procedure SetBiDiMode(const AWinControl: TWinControl;
|
||||||
|
UseRightToLeftAlign, UseRightToLeftReading,
|
||||||
|
UseRightToLeftScrollBar: Boolean); override;
|
||||||
class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); override;
|
class procedure SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment); override;
|
||||||
class procedure SetStaticBorderStyle(const ACustomStaticText: TCustomStaticText; const NewBorderStyle: TStaticBorderStyle); override;
|
class procedure SetStaticBorderStyle(const ACustomStaticText: TCustomStaticText; const NewBorderStyle: TStaticBorderStyle); override;
|
||||||
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
class procedure SetText(const AWinControl: TWinControl; const AText: String); override;
|
||||||
@ -1410,6 +1413,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
class procedure TWin32WSCustomStaticText.SetBiDiMode(
|
||||||
|
const AWinControl: TWinControl; UseRightToLeftAlign, UseRightToLeftReading,
|
||||||
|
UseRightToLeftScrollBar: Boolean);
|
||||||
|
begin
|
||||||
|
if not WSCheckHandleAllocated(AWinControl, 'SetBiDiMode') then
|
||||||
|
exit;
|
||||||
|
RecreateWnd(AWinControl);//to adjust the update the Alignment
|
||||||
|
end;
|
||||||
|
|
||||||
class procedure TWin32WSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment);
|
class procedure TWin32WSCustomStaticText.SetAlignment(const ACustomStaticText: TCustomStaticText; const NewAlignment: TAlignment);
|
||||||
begin
|
begin
|
||||||
if not WSCheckHandleAllocated(ACustomStaticText, 'SetAlignment') then
|
if not WSCheckHandleAllocated(ACustomStaticText, 'SetAlignment') then
|
||||||
|
Loading…
Reference in New Issue
Block a user