lcl: bidi mode support for TColorBox, TColorListBox from Zeher Dirkey (issue #0015001)

git-svn-id: trunk@22449 -
This commit is contained in:
paul 2009-11-05 15:01:57 +00:00
parent 2e2fcd58fc
commit cf37ea98d1
2 changed files with 18 additions and 4 deletions

View File

@ -555,7 +555,7 @@ begin
Brush.Color := NewColor;
Pen.Color := clBlack;
Rectangle(r);
Rectangle(BidiFlipRect(r, Rect, UseRightToLeftAlignment));
Brush.Color := BrushColor;
Pen.Color := PenColor;
@ -563,7 +563,7 @@ begin
r := Rect;
r.left := r.left + 20;
inherited DrawItem(Index, r, State);
inherited DrawItem(Index, BidiFlipRect(r, Rect, UseRightToLeftAlignment), State);
end;
{------------------------------------------------------------------------------
Method: TCustomColorBox.SetColorList
@ -846,7 +846,7 @@ begin
Brush.Color := NewColor;
Pen.Color := clBlack;
Rectangle(r);
Rectangle(BidiFlipRect(r, Rect, UseRightToLeftAlignment));
Brush.Color := BrushColor;
Pen.Color := PenColor;
@ -854,7 +854,7 @@ begin
r := Rect;
r.left := r.left + 20;
inherited DrawItem(Index, r, State);
inherited DrawItem(Index, BidiFlipRect(r, Rect, UseRightToLeftAlignment), State);
end;
{------------------------------------------------------------------------------
Method: TCustomColorListBox.SetColorList

View File

@ -2366,6 +2366,7 @@ procedure AdjustBorderSpace(var RemainingClientRect, CurBorderSpace: TRect;
function IsColorDefault(AControl: TControl): Boolean;
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(Anchors: TAnchors): string; overload;
@ -2488,6 +2489,19 @@ begin
Result := BidiAlignment[Flip, Alignment];
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;
begin
Result:=AnchorNames[a];