1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
unit LazSynIMMBase;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Messages, SynEditMiscClasses, SynEditPointClasses;
type
{ LazSynIme }
LazSynIme = class(TSynEditFriend)
private
FInvalidateLinesMethod: TInvalidateLines;
FOnIMEEnd: TNotifyEvent;
FOnIMEStart: TNotifyEvent;
FIMEActive: Boolean;
protected
FInCompose: Boolean;
procedure InvalidateLines(FirstLine, LastLine: integer);
procedure StopIme(Success: Boolean); virtual;
procedure DoIMEStarted;
procedure DoIMEEnded;
public
constructor Create(AOwner: TSynEditBase); reintroduce;
procedure WMImeRequest(var Msg: TMessage); virtual;
procedure WMImeNotify(var Msg: TMessage); virtual;
procedure WMImeComposition(var Msg: TMessage); virtual;
procedure WMImeStartComposition(var Msg: TMessage); virtual;
procedure WMImeEndComposition(var Msg: TMessage); virtual;
procedure FocusKilled; virtual;
property InvalidateLinesMethod : TInvalidateLines write FInvalidateLinesMethod;
property OnIMEStart: TNotifyEvent read FOnIMEStart write FOnIMEStart;
property OnIMEEnd: TNotifyEvent read FOnIMEEnd write FOnIMEEnd;
end;
implementation
{ LazSynIme }
procedure LazSynIme.InvalidateLines(FirstLine, LastLine: integer);
begin
FInvalidateLinesMethod(FirstLine, LastLine);
end;
procedure LazSynIme.StopIme(Success: Boolean);
begin
DoIMEEnded;
end;
procedure LazSynIme.DoIMEStarted;
begin
if FIMEActive then
exit;
FIMEActive := True;
if FOnIMEStart <> nil then
FOnIMEStart(FriendEdit);
end;
procedure LazSynIme.DoIMEEnded;
begin
if not FIMEActive then
exit;
FIMEActive := False;
if FOnIMEEnd <> nil then
FOnIMEEnd(FriendEdit);
end;
constructor LazSynIme.Create(AOwner: TSynEditBase);
begin
FriendEdit := AOwner;
end;
procedure LazSynIme.WMImeRequest(var Msg: TMessage);
begin
end;
procedure LazSynIme.WMImeComposition(var Msg: TMessage);
begin
end;
procedure LazSynIme.WMImeNotify(var Msg: TMessage);
begin
end;
procedure LazSynIme.WMImeStartComposition(var Msg: TMessage);
begin
end;
procedure LazSynIme.WMImeEndComposition(var Msg: TMessage);
begin
end;
procedure LazSynIme.FocusKilled;
begin
end;
end.
|