|
@@ -5,7 +5,7 @@ unit fresnel.events;
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
- Classes, SysUtils, basevents;
|
|
|
+ Classes, SysUtils, fcl.events;
|
|
|
|
|
|
{$ScopedEnums ON}
|
|
|
|
|
@@ -33,16 +33,16 @@ Const
|
|
|
evtMouseEnter = 20;
|
|
|
evtMouseLeave = 21;
|
|
|
evtMouseWheel = 22;
|
|
|
- evtFocusIn = 24;
|
|
|
- evtFocusOut = 25;
|
|
|
- evtFocus = 26;
|
|
|
- evtBlur = 27;
|
|
|
+ evtFocusIn = 23;
|
|
|
+ evtFocusOut = 24;
|
|
|
+ evtFocus = 25;
|
|
|
+ evtBlur = 26;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- MaxFresnelEvents = evtChange;
|
|
|
+ MaxFresnelEvents = evtBlur;
|
|
|
|
|
|
|
|
|
Type
|
|
@@ -61,6 +61,11 @@ Type
|
|
|
end;
|
|
|
TFresnelEventClass = Class of TFresnelEvent;
|
|
|
|
|
|
+ TFresnelEventHandler = TEventHandler;
|
|
|
+ TFresnelEventCallBack = TEventCallBack;
|
|
|
+ TFresnelEventHandlerRef = TEventHandlerRef;
|
|
|
+
|
|
|
+
|
|
|
TFresnelUIEvent = class(TFresnelEvent)
|
|
|
|
|
|
end;
|
|
@@ -73,13 +78,10 @@ Type
|
|
|
TFresnelMouseEventInit = Record
|
|
|
Button: TMouseButton;
|
|
|
Buttons: TMouseButtons;
|
|
|
- PageX: Integer;
|
|
|
- PageY: Integer;
|
|
|
- ScreenX: Integer;
|
|
|
- ScreenY: Integer;
|
|
|
+ PagePos: TPoint;
|
|
|
+ ScreenPos: TPoint;
|
|
|
Shiftstate: TShiftState;
|
|
|
- X: Integer;
|
|
|
- Y: Integer;
|
|
|
+ ControlPos : TPoint;
|
|
|
end;
|
|
|
|
|
|
TFresnelMouseEvent = Class(TFresnelUIEvent)
|
|
@@ -87,13 +89,14 @@ Type
|
|
|
FInit : TFresnelMouseEventInit;
|
|
|
function GetShiftKey(AIndex: Integer): Boolean;
|
|
|
Public
|
|
|
- Constructor Create(const aInit : TFresnelMouseEventInit);
|
|
|
- Property PageX : Integer Read FInit.PageX;
|
|
|
- Property PageY : Integer Read FInit.PageY;
|
|
|
- Property ScreenX : Integer Read FInit.ScreenX;
|
|
|
- Property ScreenY : Integer Read FInit.ScreenY;
|
|
|
- Property X : Integer Read FInit.X;
|
|
|
- Property Y : Integer Read FInit.Y;
|
|
|
+ Constructor Create(const aInit : TFresnelMouseEventInit); overload;
|
|
|
+ Procedure InitEvent(const aInit : TFresnelMouseEventInit);
|
|
|
+ Property PageX : Integer Read FInit.PagePos.X;
|
|
|
+ Property PageY : Integer Read FInit.PagePos.Y;
|
|
|
+ Property ScreenX : Integer Read FInit.ScreenPos.X;
|
|
|
+ Property ScreenY : Integer Read FInit.ScreenPos.Y;
|
|
|
+ Property X : Integer Read FInit.ControlPos.X;
|
|
|
+ Property Y : Integer Read FInit.ControlPos.Y;
|
|
|
Property Buttons: TMouseButtons Read FInit.Buttons;
|
|
|
Property Button : TMouseButton Read FInit.Button;
|
|
|
Property ShiftState : TShiftState Read FInit.Shiftstate;
|
|
@@ -244,11 +247,15 @@ Type
|
|
|
{ TFresnelEventDispatcher }
|
|
|
|
|
|
TFresnelEventDispatcher = Class(TEventDispatcher)
|
|
|
+ Private
|
|
|
+ Class Var _Registry : TEventRegistry;
|
|
|
Protected
|
|
|
+ class Function CreateFresnelRegistry : TEventRegistry; virtual;
|
|
|
Function GetRegistry: TEventRegistry; override;
|
|
|
Public
|
|
|
Class Function FresnelRegistry : TEventRegistry;
|
|
|
Class Procedure RegisterFresnelEvents;
|
|
|
+ Class Destructor Done;
|
|
|
end;
|
|
|
|
|
|
|
|
@@ -265,8 +272,26 @@ Const
|
|
|
'Enter',
|
|
|
'Leave',
|
|
|
'MouseClick',
|
|
|
+ 'MouseDblClick',
|
|
|
+ 'Change',
|
|
|
+ 'Drag',
|
|
|
+ 'DragEnd',
|
|
|
+ 'DragEnter',
|
|
|
+ 'DragOver',
|
|
|
+ 'DragLeave',
|
|
|
+ 'DragStart',
|
|
|
+ 'Drop',
|
|
|
'MouseMove',
|
|
|
- 'Change'
|
|
|
+ 'MouseDown',
|
|
|
+ 'MouseUp',
|
|
|
+ 'MouseOver',
|
|
|
+ 'MouseEnter',
|
|
|
+ 'MouseLeave',
|
|
|
+ 'MouseWheel',
|
|
|
+ 'FocusIn',
|
|
|
+ 'FocusOut',
|
|
|
+ 'Focus',
|
|
|
+ 'Blur'
|
|
|
);
|
|
|
|
|
|
{ TFresnelWheelEvent }
|
|
@@ -353,6 +378,11 @@ begin
|
|
|
end;
|
|
|
|
|
|
constructor TFresnelMouseEvent.Create(const aInit: TFresnelMouseEventInit);
|
|
|
+begin
|
|
|
+ InitEvent(aInit);
|
|
|
+end;
|
|
|
+
|
|
|
+procedure TFresnelMouseEvent.InitEvent(const aInit: TFresnelMouseEventInit);
|
|
|
begin
|
|
|
FInit:=aInit;
|
|
|
end;
|
|
@@ -393,6 +423,25 @@ begin
|
|
|
end;
|
|
|
|
|
|
{ TFresnelEventDispatcher }
|
|
|
+Type
|
|
|
+
|
|
|
+ { TFresnelRegistry }
|
|
|
+
|
|
|
+ TFresnelRegistry = Class(TEventRegistry)
|
|
|
+ Class function DefaultIDOffset : TEventID; override;
|
|
|
+ end;
|
|
|
+
|
|
|
+{ TFresnelRegistry }
|
|
|
+
|
|
|
+class function TFresnelRegistry.DefaultIDOffset: TEventID;
|
|
|
+begin
|
|
|
+ Result:=MaxFresnelEvents+1;
|
|
|
+end;
|
|
|
+
|
|
|
+class function TFresnelEventDispatcher.CreateFresnelRegistry: TEventRegistry;
|
|
|
+begin
|
|
|
+ Result:=TFresnelRegistry.Create;
|
|
|
+end;
|
|
|
|
|
|
function TFresnelEventDispatcher.GetRegistry: TEventRegistry;
|
|
|
begin
|
|
@@ -401,7 +450,9 @@ end;
|
|
|
|
|
|
class function TFresnelEventDispatcher.FresnelRegistry: TEventRegistry;
|
|
|
begin
|
|
|
- Result:=GlobalRegistry;
|
|
|
+ if _Registry=Nil then
|
|
|
+ _Registry:=CreateFresnelRegistry;
|
|
|
+ Result:=_Registry;
|
|
|
end;
|
|
|
|
|
|
class procedure TFresnelEventDispatcher.RegisterFresnelEvents;
|
|
@@ -414,6 +465,12 @@ class procedure TFresnelEventDispatcher.RegisterFresnelEvents;
|
|
|
|
|
|
begin
|
|
|
R(TFresnelChangeEvent);
|
|
|
+ R(TFresnelMouseClickEvent);
|
|
|
+end;
|
|
|
+
|
|
|
+class destructor TFresnelEventDispatcher.Done;
|
|
|
+begin
|
|
|
+ FreeAndNil(_Registry);
|
|
|
end;
|
|
|
|
|
|
end.
|