mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-08 14:06:21 +02:00
lcl: bidi mode support for TColorBox, TColorListBox from Zeher Dirkey (issue #0015001)
git-svn-id: trunk@22449 -
This commit is contained in:
parent
2e2fcd58fc
commit
cf37ea98d1
@ -555,7 +555,7 @@ begin
|
|||||||
Brush.Color := NewColor;
|
Brush.Color := NewColor;
|
||||||
Pen.Color := clBlack;
|
Pen.Color := clBlack;
|
||||||
|
|
||||||
Rectangle(r);
|
Rectangle(BidiFlipRect(r, Rect, UseRightToLeftAlignment));
|
||||||
|
|
||||||
Brush.Color := BrushColor;
|
Brush.Color := BrushColor;
|
||||||
Pen.Color := PenColor;
|
Pen.Color := PenColor;
|
||||||
@ -563,7 +563,7 @@ begin
|
|||||||
r := Rect;
|
r := Rect;
|
||||||
r.left := r.left + 20;
|
r.left := r.left + 20;
|
||||||
|
|
||||||
inherited DrawItem(Index, r, State);
|
inherited DrawItem(Index, BidiFlipRect(r, Rect, UseRightToLeftAlignment), State);
|
||||||
end;
|
end;
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCustomColorBox.SetColorList
|
Method: TCustomColorBox.SetColorList
|
||||||
@ -846,7 +846,7 @@ begin
|
|||||||
Brush.Color := NewColor;
|
Brush.Color := NewColor;
|
||||||
Pen.Color := clBlack;
|
Pen.Color := clBlack;
|
||||||
|
|
||||||
Rectangle(r);
|
Rectangle(BidiFlipRect(r, Rect, UseRightToLeftAlignment));
|
||||||
|
|
||||||
Brush.Color := BrushColor;
|
Brush.Color := BrushColor;
|
||||||
Pen.Color := PenColor;
|
Pen.Color := PenColor;
|
||||||
@ -854,7 +854,7 @@ begin
|
|||||||
r := Rect;
|
r := Rect;
|
||||||
r.left := r.left + 20;
|
r.left := r.left + 20;
|
||||||
|
|
||||||
inherited DrawItem(Index, r, State);
|
inherited DrawItem(Index, BidiFlipRect(r, Rect, UseRightToLeftAlignment), State);
|
||||||
end;
|
end;
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TCustomColorListBox.SetColorList
|
Method: TCustomColorListBox.SetColorList
|
||||||
|
@ -2366,6 +2366,7 @@ 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 BidiFlipAlignment(Alignment: TAlignment; Flip: Boolean = True): TAlignment;
|
||||||
|
function BidiFlipRect(const Rect: TRect; const ParentRect: TRect; const Flip: Boolean): TRect;
|
||||||
|
|
||||||
function DbgS(a: TAnchorKind): string; overload;
|
function DbgS(a: TAnchorKind): string; overload;
|
||||||
function DbgS(Anchors: TAnchors): string; overload;
|
function DbgS(Anchors: TAnchors): string; overload;
|
||||||
@ -2488,6 +2489,19 @@ begin
|
|||||||
Result := BidiAlignment[Flip, Alignment];
|
Result := BidiAlignment[Flip, Alignment];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function BidiFlipRect(const Rect: TRect; const ParentRect: TRect; const Flip: Boolean): TRect;
|
||||||
|
var
|
||||||
|
W: Integer;
|
||||||
|
begin
|
||||||
|
Result := Rect;
|
||||||
|
if Flip then
|
||||||
|
begin
|
||||||
|
W := Result.Right - Result.Left;
|
||||||
|
Result.Left := ParentRect.Right - (Result.Left - ParentRect.Left) - W;
|
||||||
|
Result.Right := Result.Left + W;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function DbgS(a: TAnchorKind): string;
|
function DbgS(a: TAnchorKind): string;
|
||||||
begin
|
begin
|
||||||
Result:=AnchorNames[a];
|
Result:=AnchorNames[a];
|
||||||
|
Loading…
Reference in New Issue
Block a user