From 7ca99f4bccd82b71e532ab52132b3cf58079a22f Mon Sep 17 00:00:00 2001 From: dmitry Date: Wed, 19 Nov 2014 04:56:29 +0000 Subject: [PATCH] cocoa: cocoawscustom implemented GetSelStart and GetSelLength methods git-svn-id: trunk@46882 - --- lcl/interfaces/cocoa/cocoawsstdctrls.pp | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lcl/interfaces/cocoa/cocoawsstdctrls.pp b/lcl/interfaces/cocoa/cocoawsstdctrls.pp index d72ad6cb63..d7d9acfadc 100644 --- a/lcl/interfaces/cocoa/cocoawsstdctrls.pp +++ b/lcl/interfaces/cocoa/cocoawsstdctrls.pp @@ -132,6 +132,9 @@ type class function CreateHandle(const AWinControl: TWinControl; const AParams: TCreateParams): TLCLIntfHandle; override; class function GetStrings(const ACustomMemo: TCustomMemo): TStrings; override; + class function GetSelStart(const ACustomEdit: TCustomEdit): integer; override; + class function GetSelLength(const ACustomEdit: TCustomEdit): integer; override; + class procedure AppendText(const ACustomMemo: TCustomMemo; const AText: string); override; class procedure SetScrollbars(const ACustomMemo: TCustomMemo; const NewScrollbars: TScrollStyle); override; class procedure SetWordWrap(const ACustomMemo: TCustomMemo; const NewWordWrap: boolean); override; @@ -772,6 +775,30 @@ begin Result := nil end; +class function TCocoaWSCustomMemo.GetSelStart(const ACustomEdit: TCustomEdit + ): integer; +var + txt: TCocoaTextView; + ns: NSArray; +begin + txt := MemoTextView(ACustomEdit); + if not Assigned(txt) then Exit; + ns := txt.selectedRanges; + Result:=NSValue( ns.objectAtIndex(0) ).rangeValue.location; +end; + +class function TCocoaWSCustomMemo.GetSelLength(const ACustomEdit: TCustomEdit + ): integer; +var + txt: TCocoaTextView; + ns: NSArray; +begin + txt := MemoTextView(ACustomEdit); + if not Assigned(txt) then Exit; + ns := txt.selectedRanges; + Result:=NSValue( ns.objectAtIndex(0) ).rangeValue.length; +end; + class procedure TCocoaWSCustomMemo.AppendText(const ACustomMemo: TCustomMemo; const AText: string); begin