mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-07 03:58:26 +02:00
LCL: TCustomForm: using Application.BidiMode
git-svn-id: trunk@25512 -
This commit is contained in:
parent
fb5e62291a
commit
b36aa016ec
@ -1375,6 +1375,9 @@ type
|
|||||||
procedure IntfAppRestore;
|
procedure IntfAppRestore;
|
||||||
procedure IntfDropFiles(const FileNames: Array of String);
|
procedure IntfDropFiles(const FileNames: Array of String);
|
||||||
procedure IntfThemeOptionChange(AThemeServices: TThemeServices; AOption: TThemeOption);
|
procedure IntfThemeOptionChange(AThemeServices: TThemeServices; AOption: TThemeOption);
|
||||||
|
|
||||||
|
function IsRTLLang(ALang: String): Boolean;
|
||||||
|
function Direction(ALang: String): TBiDiMode;
|
||||||
public
|
public
|
||||||
procedure DoArrowKey(AControl: TWinControl; var Key: Word;
|
procedure DoArrowKey(AControl: TWinControl; var Key: Word;
|
||||||
Shift: TShiftState);
|
Shift: TShiftState);
|
||||||
|
@ -85,15 +85,6 @@ end;
|
|||||||
TApplication Constructor
|
TApplication Constructor
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
constructor TApplication.Create(AOwner: TComponent);
|
constructor TApplication.Create(AOwner: TComponent);
|
||||||
const
|
|
||||||
BidiModeMap: array[Boolean] of TBiDiMode = (bdLeftToRight, bdRightToLeft);
|
|
||||||
|
|
||||||
function IsRTLLang(ALang: String): Boolean;
|
|
||||||
begin
|
|
||||||
Result := (ALang = 'ar') or
|
|
||||||
(ALang = 'he');
|
|
||||||
end;
|
|
||||||
|
|
||||||
var
|
var
|
||||||
LangDefault, LangFallback: String;
|
LangDefault, LangFallback: String;
|
||||||
begin
|
begin
|
||||||
@ -128,9 +119,9 @@ begin
|
|||||||
{$ifndef wince}// remove ifdef when gettext is fixed
|
{$ifndef wince}// remove ifdef when gettext is fixed
|
||||||
LCLGetLanguageIDs(LangDefault, LangFallback);
|
LCLGetLanguageIDs(LangDefault, LangFallback);
|
||||||
if LangDefault <> '' then
|
if LangDefault <> '' then
|
||||||
FBidiMode := BidiModeMap[IsRTLLang(LangDefault)]
|
FBidiMode := Direction(LangDefault)
|
||||||
else
|
else
|
||||||
FBidiMode := BidiModeMap[IsRTLLang(LangFallback)];
|
FBidiMode := Direction(LangFallback);
|
||||||
{$else}
|
{$else}
|
||||||
FBidiMode := bdLeftToRight;
|
FBidiMode := bdLeftToRight;
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -2228,3 +2219,17 @@ begin
|
|||||||
Result := False;
|
Result := False;
|
||||||
if Assigned(FOnActionUpdate) then FOnActionUpdate(TheAction, Result);
|
if Assigned(FOnActionUpdate) then FOnActionUpdate(TheAction, Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TApplication.IsRTLLang(ALang: String): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (LowerCase(ALang) = 'ar') or
|
||||||
|
(LowerCase(ALang) = 'he');
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TApplication.Direction(ALang: String): TBiDiMode;
|
||||||
|
const
|
||||||
|
BidiModeMap: array[Boolean] of TBiDiMode = (bdLeftToRight, bdRightToLeft);
|
||||||
|
begin
|
||||||
|
Result := BidiModeMap[IsRTLLang(ALang)];
|
||||||
|
end;
|
||||||
|
|
||||||
|
@ -1905,6 +1905,10 @@ begin
|
|||||||
FloatingDockSiteClass := TWinControlClass(ClassType);
|
FloatingDockSiteClass := TWinControlClass(ClassType);
|
||||||
Screen.AddForm(Self);
|
Screen.AddForm(Self);
|
||||||
FAllowDropFiles := False;
|
FAllowDropFiles := False;
|
||||||
|
|
||||||
|
if ParentBiDiMode then
|
||||||
|
BiDiMode := Application.BidiMode;
|
||||||
|
|
||||||
// the EndFormUpdate is done in AfterConstruction
|
// the EndFormUpdate is done in AfterConstruction
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user