diff --git a/components/spktoolbar/SpkToolbar/spkt_Tab.pas b/components/spktoolbar/SpkToolbar/spkt_Tab.pas index 36ef7ddb9..265b187a3 100644 --- a/components/spktoolbar/SpkToolbar/spkt_Tab.pas +++ b/components/spktoolbar/SpkToolbar/spkt_Tab.pas @@ -21,7 +21,7 @@ unit spkt_Tab; interface uses - Graphics, Controls, Classes, SysUtils, + Graphics, Controls, Classes, SysUtils, Math, SpkMath, spkt_Appearance, spkt_Const, spkt_Dispatch, spkt_Exceptions, spkt_Pane, spkt_Types; @@ -78,6 +78,9 @@ type procedure DefineProperties(Filer: TFiler); override; procedure Loaded; override; + function GetRootComponent: TComponent; + function IsRightToLeft: Boolean; + // *** Getters and setters *** procedure SetCaption(const Value: string); procedure SetCustomAppearance(const Value: TSpkToolbarAppearance); @@ -252,21 +255,32 @@ var x, i: integer; tw: integer; tmpRect: T2DIntRect; + isRTL: Boolean; begin + isRTL := IsRightToLeft; + FRect := ARect; if AtLeastOnePaneVisible then begin - x := ARect.left; + x := IfThen(isRTL, ARect.Right, ARect.Left); for i := 0 to FPanes.Count - 1 do if FPanes[i].Visible then begin tw := FPanes[i].GetWidth; - tmpRect.Left := x; + if isRTL then + begin + tmpRect.Right := x; + tmpRect.Left := x - tw + 1; + x := x - tw - TabPaneHSpacing; + end else + begin + tmpRect.Left := x; + tmpRect.Right := x + tw - 1; + x := x + tw + TabPaneHSpacing; + end; tmpRect.Top := ARect.Top; - tmpRect.Right := x + tw - 1; tmpRect.Bottom := ARect.bottom; FPanes[i].Rect := tmpRect; - x := x + tw + TabPaneHSpacing; end else begin @@ -347,6 +361,20 @@ begin Proc(FPanes.Items[i]); end; +function TSpkTab.GetRootComponent: TComponent; +begin + Result := nil; + if Collection <> nil then + Result := Collection.RootComponent + else + Result := nil; +end; + +function TSpkTab.IsRightToLeft: Boolean; +begin + Result := (GetRootComponent as TControl).IsRightToLeft; +end; + procedure TSpkTab.Loaded; begin inherited;