mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 09:40:49 +02:00
cocoa: providing support for tracking event. (forwarding dragged events to LCL as mousemove)
git-svn-id: trunk@58599 -
This commit is contained in:
parent
526e755e0e
commit
d8f5c59da5
@ -83,6 +83,7 @@ type
|
||||
function isRunning: Boolean; override;
|
||||
procedure run; override;
|
||||
procedure sendEvent(theEvent: NSEvent); override;
|
||||
function nextEventMatchingMask_untilDate_inMode_dequeue(mask: NSUInteger; expiration: NSDate; mode: NSString; deqFlag: Boolean): NSEvent; override;
|
||||
end;
|
||||
|
||||
TCocoaPasteboardsRef = record
|
||||
@ -397,6 +398,23 @@ begin
|
||||
inherited sendEvent(theEvent);
|
||||
end;
|
||||
|
||||
function TCocoaApplication.nextEventMatchingMask_untilDate_inMode_dequeue(
|
||||
mask: NSUInteger; expiration: NSDate; mode: NSString; deqFlag: Boolean
|
||||
): NSEvent;
|
||||
var
|
||||
cb : ICommonCallback;
|
||||
begin
|
||||
Result:=inherited nextEventMatchingMask_untilDate_inMode_dequeue(mask,
|
||||
expiration, mode, deqFlag);
|
||||
if Assigned(Result)
|
||||
and ((mode = NSEventTrackingRunLoopMode) or mode.isEqualToString(NSEventTrackingRunLoopMode))
|
||||
and Assigned(TrackedControl)
|
||||
then begin
|
||||
cb := TrackedControl.lclGetCallback;
|
||||
if Assigned(cb) then cb.MouseMove(Result);
|
||||
end;
|
||||
end;
|
||||
|
||||
// the implementation of the utility methods
|
||||
{$I cocoaobject.inc}
|
||||
// the implementation of the winapi compatibility methods
|
||||
|
@ -320,6 +320,10 @@ const
|
||||
NSTextAlignmentJustified = 3;
|
||||
NSTextAlignmentNatural = 4;
|
||||
|
||||
var
|
||||
// todo: this should be a threadvar
|
||||
TrackedControl : NSObject = nil;
|
||||
|
||||
implementation
|
||||
|
||||
uses CocoaInt;
|
||||
|
@ -859,6 +859,18 @@ begin
|
||||
end;
|
||||
|
||||
//debugln('MouseUpDownEvent:'+DbgS(Msg.Msg)+' Target='+Target.name+);
|
||||
if not Result then
|
||||
//Result := Result or (BlockCocoaUpDown and not AOverrideBlock);
|
||||
case lEventType of
|
||||
NSLeftMouseDown,
|
||||
NSRightMouseDown,
|
||||
NSOtherMouseDown:
|
||||
TrackedControl := Owner;
|
||||
NSLeftMouseUp,
|
||||
NSRightMouseUp,
|
||||
NSOtherMouseUp:
|
||||
if TrackedControl = Owner then TrackedControl := nil;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TLCLCommonCallback.MouseMove(Event: NSEvent): Boolean;
|
||||
|
Loading…
Reference in New Issue
Block a user