界面库

将输入法相关代码已入到底层库
This commit is contained in:
JianjunLiu
2023-05-11 14:42:09 +08:00
parent 6f0bb71708
commit 759e06ea4a
4 changed files with 61 additions and 57 deletions
+33 -1
View File
@@ -7,7 +7,7 @@ unit UTslMemo;
{$define linuxpop}
{$endif}
interface
uses utslvclauxiliary,utslvclgdi,utslvclstdctl;
uses utslvclauxiliary,utslvclmemstruct,utslvclgdi,utslvclstdctl;
type TMemoLineItem=class() //编辑字符串行对象
function Create(s);
begin
@@ -3931,6 +3931,7 @@ type TSynCustomMemo = class(TCustomMemo)
function Create(AOwner);//构造
begin
inherited;
FCOMPOSITIONFORM := new tagCOMPOSITIONFORM(nil);
FTabChar := " ";
end
function Recycling();override; //回收
@@ -4048,7 +4049,37 @@ type TSynCustomMemo = class(TCustomMemo)
property Highlighter:thighlighter read FHighlighter write SetHighlighter; //语法高亮
property Completion read FCompletion write SetCompletion; //自动完成
property TabChar read FTabChar write SetTabChar;
public //输入法相关
function WMIMESTARTCOMPOSITION(o,e):WM_IME_STARTCOMPOSITION;virtual;
begin
ime := ImmGetContext(self.Handle);
FCOMPOSITIONFORM.ptcurrentpos.cx := 200;
FCOMPOSITIONFORM.ptcurrentpos.cy := 200;
ImmSetCompositionWindow(ime,FCOMPOSITIONFORM._getptr_());
ImmReleaseContext(self.Handle,ime);
end
{$ifdef linux}
function ImmReleaseContext();
begin
end;
function ImmGetContext();
begin
end;
function ImmSetCompositionWindow();
begin
end;
function ImmSetStatusWindowPos();
begin
end;
{$else}
function ImmReleaseContext(h:pointer;ime:pointer):integer;stdcall;external "Imm32.dll" name "ImmReleaseContext";
function ImmGetContext(h:pointer):pointer;stdcall;external "Imm32.dll" name "ImmGetContext";
function ImmSetCompositionWindow(h:pointer;s:pointer):integer;stdcall;external "Imm32.dll" name "ImmSetCompositionWindow";
function ImmSetStatusWindowPos(h:pointer;s:pointer):integer;stdcall;external "Imm32.dll" name "ImmSetStatusWindowPos";
{$endif}
private
FCOMPOSITIONFORM;
FHighlighter;
FCompletion;
FTabChar;
@@ -4305,6 +4336,7 @@ type TSynMemoNorm = class(TsynCustomMemo) //
FSheetTabFlage;
end
Implementation
function CreateATslMemoUndoItem(AReason,AStart,AEnd,ChangeText,SelMode);
begin
return new TTslMemoUndoItem(AReason,AStart,AEnd,ChangeText,SelMode);
+24
View File
@@ -1412,6 +1412,30 @@ type Ttagmoduleentry32=class(tslcstructureobj)
property szmodule index "szmodule" read _getvalue_ write _setvalue_;
property szexepath index "szexepath" read _getvalue_ write _setvalue_;
end
type tagCOMPOSITIONFORM=class(tslcstructureobj)
private
static SSTRUCT;
class function getstruct()
begin
if not SSTRUCT then SSTRUCT := MemoryAlignmentCalculate(array(
("dwstyle","int",4),
("ptcurrentpos","intptr",0),
("rcarea","int[4]",array(0,0,0,0))),nil,nil,1);
return SSTRUCT;
end
public
function create()
begin
inherited create(getstruct(),ptr);
FPonter := new TCPoint();
_setvalue_("ptcurrentpos",FPonter._getptr_());
end
property dwstyle index "dwstyle" read _getvalue_ write _setvalue_;
property ptcurrentpos read FPonter;
property rcarea index "rcarea" read _getvalue_ write _setvalue_;
private
FPonter;
end
implementation
(*
+3 -3
View File
@@ -4059,12 +4059,12 @@ type TCustomComboBoxbase=class(TCustomControl)
if csDesigning in ComponentState then return;
x := e.xpos;
y := e.ypos;
if x>1 and y>1 then return ShowDropDown(true);
return ;
//if x>1 and y>1 then return ShowDropDown(true);
if x>FBtnRect[0]and x<FBtnRect[2]and y>FBtnRect[1]and y<FBtnRect[3]then
begin
ShowDropDown(true);
return ShowDropDown(true);
end
return ;
end
function ShowDropDown(flg);
begin