From 9315166222f134f7d17e50f12358baa01219b0ef Mon Sep 17 00:00:00 2001 From: skalogryz Date: Mon, 24 Oct 2016 14:27:30 +0000 Subject: [PATCH] richmemo: win32 - making language options exposed as a set type for win32 only interface git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5288 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/richmemo/win32/win32richmemo.pas | 52 +++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/components/richmemo/win32/win32richmemo.pas b/components/richmemo/win32/win32richmemo.pas index 016d16595..f20de9afb 100644 --- a/components/richmemo/win32/win32richmemo.pas +++ b/components/richmemo/win32/win32richmemo.pas @@ -177,6 +177,22 @@ function GetOleObject(ole: IRichEditOle; SelStart: Integer; out res: TREOBJECT): function SetOleObjectSize(ARichMemo: TCustomRichMemo; SelStart: Integer; const ASize: TSize): Boolean; function GetOleObjectSize(ARichMemo: TCustomRichMemo; SelStart: Integer; var ASize: TSize): Boolean; +type + TWinLangOptions = set of ( + wloAutokeyboard // IMF_AUTOKEYBOARD = $0001 + , wloAutoFont // IMF_AUTOFONT = $0002 + , wloImeCancelComplete // IMF_IMECANCELCOMPLETE = $0004 // High completes comp string when aborting, low cancels + , wloAlwaysSendNotify // IMF_IMEALWAYSSENDNOTIFY = $0008 + , wloAutoFontSizeAdjust // IMF_AUTOFONTSIZEADJUST = $0010 + , wloUOFonts // IMF_UIFONTS = $0020 + , wloDualFont // IMF_DUALFONT = $0080 + ); + +function GetLangOptions(hnd: THandle): TWinLangOptions; overload; +function GetLangOptions(rm: TCustomRichMemo): TWinLangOptions; overload; +procedure SetLangOptions(hnd: THandle; const opts: TWinLangOptions); overload; +procedure SetLangOptions(rm: TCustomRichMemo; const opts: TWinLangOptions); overload; + implementation const @@ -1640,6 +1656,42 @@ begin ASize.cy:=round(res.sizel.cy*RevSizeFactor); end; +function GetLangOptions(hnd: THandle): TWinLangOptions; +var + r: LRESULT; +begin + r:=SendMessage(hnd, EM_GETLANGOPTIONS, 0, 0); + Result:=TWinLangOptions(r); +end; + +function GetLangOptions(rm: TCustomRichMemo): TWinLangOptions; +begin + if Assigned(rm) then begin + if not rm.HandleAllocated then rm.HandleNeeded; + if rm.HandleAllocated + then Result:=GetLangOptions(rm.Handle) + else Result:=[]; + end else + Result:=[]; +end; + +procedure SetLangOptions(hnd: THandle; const opts: TWinLangOptions); overload; +var + lp : LPARAM; +begin + lp:=LPARAM(opts); + SendMessage(hnd, EM_SETLANGOPTIONS, 0, lp); +end; + +procedure SetLangOptions(rm: TCustomRichMemo; const opts: TWinLangOptions); overload; +begin + if Assigned(rm) then begin + if not rm.HandleAllocated then rm.HandleNeeded; + if rm.HandleAllocated then + SetLangOptions(rm.Handle, opts); + end; +end; + initialization NCPaint := @ThemedNCPaint; AllocOLEObject := @DefAllocOleObject;