LCL: TCustomForm: using Application.BidiMode

git-svn-id: trunk@25512 -
This commit is contained in:
mattias 2010-05-19 11:10:26 +00:00
parent fb5e62291a
commit b36aa016ec
3 changed files with 23 additions and 11 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;