win32 widgetset: send IntfUTF8KeyPress if UnicodeEnabledOS

git-svn-id: trunk@11743 -
This commit is contained in:
vincents 2007-08-05 21:20:27 +00:00
parent edf46aa16b
commit a362b60829
3 changed files with 44 additions and 9 deletions

View File

@ -997,6 +997,26 @@ Var
Result := PointToSmallPoint(P);
end;
// returns false if the UnicodeChar is not handled
function HandleUnicodeChar(AChar: Word): boolean;
var
UTF8Char: TUTF8Char;
Handled: Boolean;
begin
Result := false;
UTF8Char := UTF8Encode(WideChar(AChar));
lWinControl := WindowInfo^.WinControl;
if assigned(lWinControl) then
begin
Result:= lWinControl.IntfUTF8KeyPress(UTF8Char, 1, False);
if UTF8Char='' then
Result:= true;
end;
end;
begin
Assert(False, 'Trace:WindowProc - Start');
@ -1121,15 +1141,19 @@ begin
End;
WM_CHAR:
Begin
PLMsg:=@LMChar;
With LMChar Do
Begin
Msg := CN_CHAR;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
Assert(False,Format('WM_CHAR KeyData= %d CharCode= %d ',[KeyData,CharCode]));
End;
if not UnicodeEnabledOS or not HandleUnicodeChar(Word(WParam)) then
begin
PLMsg:=@LMChar;
With LMChar Do
Begin
Msg := CN_CHAR;
KeyData := LParam;
CharCode := Word(WParam);
Result := 0;
Assert(False,Format('WM_CHAR KeyData= %d CharCode= %d ',[KeyData,CharCode]));
End;
end;
WinProcess := false;
End;
WM_MENUCHAR:

View File

@ -397,6 +397,15 @@ begin
LB_GETITEMRECT, Index, LPARAM(@ARect)) <> LB_ERR;
end;
{------------------------------------------------------------------------------
function TWin32WidgetSet.IntfSendsUTF8KeyPress: boolean;
------------------------------------------------------------------------------}
function TWin32WidgetSet.IntfSendsUTF8KeyPress: boolean;
begin
Result := UnicodeEnabledOS;
end;
function TWin32WidgetSet.LoadStockPixmap(StockID: longint; var Mask: HBitmap): HBitmap;
{$ifdef NoMaskProblem}
var

View File

@ -52,6 +52,8 @@ function GetControlConstraints(Constraints: TObject): boolean; override;
function GetListBoxIndexAtY(ListBox: TComponent; y: integer): integer; override;
function GetListBoxItemRect(ListBox: TComponent; Index: integer; var ARect: TRect): boolean; override;
function IntfSendsUTF8KeyPress: boolean; override;
procedure RemoveEventHandler(var AHandler: PEventHandler); override;
procedure RemovePipeEventHandler(var AHandler: PPipeEventHandler); override;
procedure RemoveProcessEventHandler(var AHandler: PProcessEventHandler); override;