Click here to Skip to main content
15,897,704 members
Articles / Web Development / HTML

Mouse Gestures for Internet Explorer

Rate me:
Please Sign up or sign in to vote.
4.84/5 (99 votes)
21 Sep 200514 min read 1.3M   13.4K   235  
Adding mouse gesture recognition to Internet Explorer.
///////////////////////////////////////////////////////////////
//
// MouseTrail.h
//
// Created: 25/06/2005
// Copyright (c) 2005 Ralph Hare (ralph.hare@ysgyfarnog.co.uk)
// All rights reserved.
//
// The code and information is provided "as-is" without
// warranty of any kind, either expressed or implied.
//
///////////////////////////////////////////////////////////////

#ifndef __MOUSETRAIL_H_80C39B0E_0B0F_41F7_BA96_A16A7CE1851B_
#define __MOUSETRAIL_H_80C39B0E_0B0F_41F7_BA96_A16A7CE1851B_

#include "Gesture.h"

/**
 * MouseTrail is an abstract base class for objects
 * that draw mouse trails - as the user is performing
 * a gesture, the mouse trails object will be passed
 * the path the user transcribes with their mouse. The
 * concrete implementation of MouseTrail will (for example)
 * render the trail to the UI.
 **/
class MouseTrail
{
public:
    MouseTrail() {}
    virtual ~MouseTrail() {}

/**
 * Begin the trail
 * @param hWnd a handle to the window over which the trail is to
 *        be drawn, and to which the trail co-ordinates (@see 
 *        the path parameter in the Update method) relative.
 **/
    virtual void Begin( HWND hWnd ) = 0;

/**
 * End the trail i.e. remove it from the screen
 **/
    virtual void End() = 0;

/**
 * Called by the mouse tracker every time the user
 * updates the path (i.e. moves the mouse)
 * @param path the path subscribed by the mouse while performing
 *        the gesture. Note, all co-ordinates are relative to the
 *        top left of the window passed to the Begin method
 **/
    virtual void Update( const Path &path ) = 0;

/**
 * Called by the mouse tracker whenever the trail window
 * should be show (e.g. when the window being tracked
 * gains focus).
 **/
    virtual void Show() = 0;

/**
 * Called by the mouse tracker whenever the trail window
 * should be hidden (e.g. when the window being tracked
 * loses focus).
 **/
    virtual void Hide() = 0;
};

#endif // __MOUSETRAIL_H_80C39B0E_0B0F_41F7_BA96_A16A7CE1851B_

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United Kingdom United Kingdom
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions