mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 07:38:14 +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 IntfDropFiles(const FileNames: Array of String);
|
||||
procedure IntfThemeOptionChange(AThemeServices: TThemeServices; AOption: TThemeOption);
|
||||
|
||||
function IsRTLLang(ALang: String): Boolean;
|
||||
function Direction(ALang: String): TBiDiMode;
|
||||
public
|
||||
procedure DoArrowKey(AControl: TWinControl; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
|
@ -85,15 +85,6 @@ end;
|
||||
TApplication Constructor
|
||||
------------------------------------------------------------------------------}
|
||||
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
|
||||
LangDefault, LangFallback: String;
|
||||
begin
|
||||
@ -128,9 +119,9 @@ begin
|
||||
{$ifndef wince}// remove ifdef when gettext is fixed
|
||||
LCLGetLanguageIDs(LangDefault, LangFallback);
|
||||
if LangDefault <> '' then
|
||||
FBidiMode := BidiModeMap[IsRTLLang(LangDefault)]
|
||||
FBidiMode := Direction(LangDefault)
|
||||
else
|
||||
FBidiMode := BidiModeMap[IsRTLLang(LangFallback)];
|
||||
FBidiMode := Direction(LangFallback);
|
||||
{$else}
|
||||
FBidiMode := bdLeftToRight;
|
||||
{$endif}
|
||||
@ -2228,3 +2219,17 @@ begin
|
||||
Result := False;
|
||||
if Assigned(FOnActionUpdate) then FOnActionUpdate(TheAction, Result);
|
||||
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);
|
||||
Screen.AddForm(Self);
|
||||
FAllowDropFiles := False;
|
||||
|
||||
if ParentBiDiMode then
|
||||
BiDiMode := Application.BidiMode;
|
||||
|
||||
// the EndFormUpdate is done in AfterConstruction
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user