cocoa: implementation for clipboard operations in ws. #33726

git-svn-id: trunk@58285 -
This commit is contained in:
dmitry 2018-06-16 03:31:36 +00:00
parent 7e61678d9d
commit f8ddaec1b0

View File

@ -137,6 +137,11 @@ type
class procedure SetReadOnly(const ACustomEdit: TCustomEdit; NewReadOnly: boolean); override;
class procedure SetSelStart(const ACustomEdit: TCustomEdit; NewStart: integer); override;
class procedure SetSelLength(const ACustomEdit: TCustomEdit; NewLength: integer); override;
class procedure Cut(const ACustomEdit: TCustomEdit); override;
class procedure Copy(const ACustomEdit: TCustomEdit); override;
class procedure Paste(const ACustomEdit: TCustomEdit); override;
class procedure Undo(const ACustomEdit: TCustomEdit); override;
end;
{ TCocoaMemoStrings }
@ -801,6 +806,30 @@ begin
curEditor.setSelectedRange(lRange);
end;
class procedure TCocoaWSCustomEdit.Cut(const ACustomEdit: TCustomEdit);
begin
if not Assigned(ACustomEdit) or not (ACustomEdit.HandleAllocated) then Exit;
NSApplication(NSApp).sendAction_to_from(objcselector('cut:'), nil, id(ACustomEdit.Handle));
end;
class procedure TCocoaWSCustomEdit.Copy(const ACustomEdit: TCustomEdit);
begin
if not Assigned(ACustomEdit) or not (ACustomEdit.HandleAllocated) then Exit;
NSApplication(NSApp).sendAction_to_from(objcselector('copy:'), nil, id(ACustomEdit.Handle));
end;
class procedure TCocoaWSCustomEdit.Paste(const ACustomEdit: TCustomEdit);
begin
if not Assigned(ACustomEdit) or not (ACustomEdit.HandleAllocated) then Exit;
NSApplication(NSApp).sendAction_to_from(objcselector('paste:'), nil, id(ACustomEdit.Handle));
end;
class procedure TCocoaWSCustomEdit.Undo(const ACustomEdit: TCustomEdit);
begin
if not Assigned(ACustomEdit) or not (ACustomEdit.HandleAllocated) then Exit;
NSApplication(NSApp).sendAction_to_from(objcselector('undo:'), nil, id(ACustomEdit.Handle));
end;
{ TCocoaMemoStrings }
constructor TCocoaMemoStrings.Create(ATextView: TCocoaTextView);