cocoa: cocoawscustom implemented GetSelStart and GetSelLength methods

git-svn-id: trunk@46882 -
This commit is contained in:
dmitry 2014-11-19 04:56:29 +00:00
parent 63400d9ec8
commit 7ca99f4bcc

View File

@ -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