mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-05 13:56:00 +02:00
cocoa: move NSResponderHotKeys to cocoawindows.pas unit. #34609
git-svn-id: trunk@59746 -
This commit is contained in:
parent
c5fdbd440a
commit
d0e6eb11b6
@ -93,8 +93,6 @@ function CFStringToData(AString: CFStringRef; Encoding: CFStringEncoding = DEFAU
|
||||
function GetCurrentEventTime: double;
|
||||
function GetMacOSXVersion: Integer;
|
||||
|
||||
procedure NSResponderHotKeys(asender: NSResponder; event: NSEvent; var handled: Boolean; atarget: id = nil);
|
||||
|
||||
function DateTimeToNSDate(const aDateTime : TDateTime): NSDate;
|
||||
function NSDateToDateTime(const aDateTime: NSDate): TDateTime;
|
||||
|
||||
@ -1095,32 +1093,6 @@ begin
|
||||
Result := lMajor*$10000 + lMinor*$100 + lFix;
|
||||
end;
|
||||
|
||||
procedure NSResponderHotKeys(asender: NSResponder; event: NSEvent; var handled: Boolean; atarget: id);
|
||||
begin
|
||||
// todo: system keys could be overriden. thus need to review the current
|
||||
// keyboard configuration first. See "Key Bindings" at
|
||||
// https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html
|
||||
|
||||
handled := false;
|
||||
if (event.type_ = NSKeyDown) then
|
||||
begin
|
||||
if ((event.modifierFlags and NSCommandKeyMask) = 0) then Exit;
|
||||
|
||||
if Assigned(event.charactersIgnoringModifiers.UTF8String) then
|
||||
begin
|
||||
case event.charactersIgnoringModifiers.UTF8String^ of
|
||||
// redo/undo are not implemented in either of TextControls?
|
||||
//'Z': handled := NSApplication(NSApp).sendAction_to_from(objcselector('redo:'), atarget, asender);
|
||||
'a': handled := NSApplication(NSApp).sendAction_to_from(objcselector('selectAll:'), atarget, asender);
|
||||
'c': handled := NSApplication(NSApp).sendAction_to_from(objcselector('copy:'), atarget, asender);
|
||||
'v': handled := NSApplication(NSApp).sendAction_to_from(objcselector('paste:'), atarget, asender);
|
||||
'x': handled := NSApplication(NSApp).sendAction_to_from(objcselector('cut:'), atarget, asender);
|
||||
//'z': handled := NSApplication(NSApp).sendAction_to_from(objcselector('undo:'), atarget, asender);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function DateTimeToNSDate(const aDateTime : TDateTime): NSDate;
|
||||
var
|
||||
ti : NSTimeInterval;
|
||||
|
@ -384,6 +384,32 @@ begin
|
||||
callback.DidResignKeyNotification;
|
||||
end;
|
||||
|
||||
procedure NSResponderHotKeys(asender: NSResponder; event: NSEvent; var handled: LCLObjCBoolean; atarget: id);
|
||||
begin
|
||||
// todo: system keys could be overriden. thus need to review the current
|
||||
// keyboard configuration first. See "Key Bindings" at
|
||||
// https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/EventOverview/TextDefaultsBindings/TextDefaultsBindings.html
|
||||
|
||||
handled := false;
|
||||
if (event.type_ = NSKeyDown) then
|
||||
begin
|
||||
if ((event.modifierFlags and NSCommandKeyMask) = 0) then Exit;
|
||||
|
||||
if Assigned(event.charactersIgnoringModifiers.UTF8String) then
|
||||
begin
|
||||
case event.charactersIgnoringModifiers.UTF8String^ of
|
||||
// redo/undo are not implemented in either of TextControls?
|
||||
//'Z': handled := NSApplication(NSApp).sendAction_to_from(objcselector('redo:'), atarget, asender);
|
||||
'a': handled := NSApplication(NSApp).sendAction_to_from(objcselector('selectAll:'), atarget, asender);
|
||||
'c': handled := NSApplication(NSApp).sendAction_to_from(objcselector('copy:'), atarget, asender);
|
||||
'v': handled := NSApplication(NSApp).sendAction_to_from(objcselector('paste:'), atarget, asender);
|
||||
'x': handled := NSApplication(NSApp).sendAction_to_from(objcselector('cut:'), atarget, asender);
|
||||
//'z': handled := NSApplication(NSApp).sendAction_to_from(objcselector('undo:'), atarget, asender);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCocoaWindowContent.performKeyEquivalent(event: NSEvent): LCLObjCBoolean;
|
||||
var
|
||||
resp : NSResponder;
|
||||
|
Loading…
Reference in New Issue
Block a user