{----------------------------------------------------------------------------- The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/MPL-1.1.html Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is: JvMouseGesture.PAS, released on 2003-07-10. The Initial Developers of the Original Code are: Christian Vogt (christian att fam-vogt dott de) Copyright (c) 2003 by Christian Vogt All Rights Reserved. Portions of code based on an idea of Mozilla browser mouse gesture addon You may retrieve the latest version of this file at the Project JEDI's JVCL home page, located at http://jvcl.sourceforge.net Description: This unit implements mouse gestures. For this purpose actually two classes are available. one is the interpreter and can be used to enhance special components like a grid. In this case the programmer is responsible to fill matching OnMouseDown, OnMouseUp and OnMouseMove events of component. This works fine with MSWINDOWS and UNIX. The second component installs a hook for a specific application and fires an event after detecting a mouse gesture (Windows only in this version \:-( ). Programmers will get a string with the detected gesture from following matrix:
if Button = mbRight then
JvMouseGesture1.StartMouseGesture(x,y);
2) Fill the OnMouseMove event with something like
if JvMouseGesture1.TrailActive then
JvMouseGesture1.TrailMouseGesture(x,y);
3) Now fill the OnMouseUp event
if JvMouseGesture1.TrailActive then
JvMouseGesture1.EndMouseGesture;
4) Last but not least fill components
OnJvMouseGestureCustomInterpretation
XOR
OnJvMouseGesture\JvOnAppStart then component will be
activated on start of application, with JvManually you
have to activate detection on your own
}
property ActivationMode: TJvActivationMode read FActivationMode write SetActivationMode;
{ Description
Set the mouse key to be used for start/stop gesture
See Also
TMouseButton
}
property MouseButton: TMouseButton read FMouseButton write SetMouseButton default mbRight;
{ Description
Set the event to be executed if a gesture will be detected
}
property OnMouseGestureCustomInterpretation: TOnMouseGestureCustomInterpretation read FOnMouseGestureCustomInterpretation write SetMouseGestureCustomInterpretation;
end;
{$IFDEF VCL}
{ Description
Hook call back function.
DO NOT USE EXTERN!
}
function JvMouseGestureHook(Code: Integer; wParam: Word; lParam: Longword): Longword; stdcall;
{$ENDIF VCL}
{$IFDEF VisualCLX}
function JvMouseGestureHook(App: TObject; Sender: QObjectH; Event: QEventH): Boolean;
{$ENDIF VisualCLX}
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$URL: https://jvcl.svn.sourceforge.net/svnroot/jvcl/tags/JVCL3_32/run/JvMouseGesture.pas $';
Revision: '$Revision: 10612 $';
Date: '$Date: 2006-05-19 21:04:09 +0200 (ven., 19 mai 2006) $';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
implementation
uses
JvResources, JvTypes;
const
JVMG_LEFT = 0;
JVMG_RIGHT = 1;
JVMG_UP = 2;
JVMG_DOWN = 3;
JVMG_LEFTUPPER = 4;
JVMG_RIGHTUPPER = 5;
JVMG_LEFTLOWER = 6;
JVMG_RIGHTLOWER = 7;
var
{ Description
Object pointer to interpreter class used by hook
}
JvMouseGestureInterpreter: TJvMouseGesture;
{ Description
Some global vars to be accessed by call back function ...
}
JvMouseGestureHookAlreadyInstalled: Boolean = False;
//