Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Mouse Gestures for Internet Explorer

, 21 Sep 2005
Adding mouse gesture recognition to Internet Explorer.
mousegestures_inst.zip
MouseGestures.exe
mousegestures_inst_1.zip
MouseGestures.exe
mousegestures_src.zip
src
gesture.weights
images
about.bmp
ClickLeftRight.bmp
ClickRightLeft.bmp
down.bmp
downarrow.bmp
downleft.bmp
downright.bmp
downup.bmp
exclamation.bmp
left.bmp
leftarrow.bmp
leftright.bmp
none.bmp
right.bmp
rightarrow.bmp
rightleft.bmp
up.bmp
uparrow.bmp
updown.bmp
upleft.bmp
upright.bmp
wheel.bmp
MouseGestures.rgs
mousegestures_src_1.zip
MouseGestures
BrowserHelperObject.rgs
gesture.weights
images
about.bmp
ClickLeftRight.bmp
ClickRightLeft.bmp
down.bmp
downleft.bmp
downright.bmp
downup.bmp
left.bmp
none.bmp
right.bmp
up.bmp
updown.bmp
upleft.bmp
upright.bmp
wheel.bmp
MouseGestures.def
MouseGestures.dsp
MouseGesturesCfg.rgs
///////////////////////////////////////////////////////////////
//
// Action.h
//
// Created: 12/07/2003
// Copyright (c) 2003 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 __ACTION_H_21079340_5F58_4393_8A85_D25E8FC7E73D_
#define __ACTION_H_21079340_5F58_4393_8A85_D25E8FC7E73D_

/**
 * Structure to pass to each Action method describing
 * the context of the action 
 **/
struct ActionPacket
{
    HWND    hWnd;       /// < the window where the action was performed
    POINT   pt;         /// < the first point of the action

    ActionPacket( HWND hWnd_, const POINT &pt_ ) :
        hWnd( hWnd_ ),
        pt( pt_ )
    {
    }
};

/**
 * Pure virtual base class describing the possible actions
 * as a result of a mouse gesture. Each function must have the
 * following signature:
 *
 *  void FUNCTION( const ActionPacket & )
 *
 * @see GestureManager
 **/

class ActionBase
{
protected:
    virtual ~ActionBase() {}

public:
/// < Goto the previous page in the document history
    virtual void GotoPrevious( const ActionPacket & ) = 0;

/// < Goto the next page in the document history
    virtual void GotoNext( const ActionPacket & ) = 0;

/// < Goto IE's home page
    virtual void GoHome( const ActionPacket & ) = 0;

/// < Scroll to the top of the active document
    virtual void GotoTop( const ActionPacket & ) = 0;

/// < Scroll to the bottom of the active document
    virtual void GotoBottom( const ActionPacket & ) = 0;

/// < Close the active web browser instance
    virtual void Close( const ActionPacket & ) = 0;

/// < Open a new web browser instance in the foreground
    virtual void OpenNewForeWindow( const ActionPacket & ) = 0;

/// < Open a new web browser instance in the background
    virtual void OpenNewBackWindow( const ActionPacket & ) = 0;

/// < Refresh the active document
    virtual void Refresh( const ActionPacket & ) = 0;

/// < Reload the active document
    virtual void Reload( const ActionPacket & ) = 0;

/// < Minimise the active web browser
    virtual void Minimise( const ActionPacket & ) = 0;

/// < Restore the active window to normal size
    virtual void Restore( const ActionPacket & ) = 0;

/// < Create a new webbrowser open on the currently active page
    virtual void Duplicate( const ActionPacket & ) = 0;

/// < Scroll through all the open web browser instances on this desktop
    virtual void ScrollWindows( const ActionPacket & ) = 0;

/// < Maximise the active web browser
    virtual void Maximise( const ActionPacket & ) = 0;

/// < File->Open
    virtual void CommandOpen( const ActionPacket & ) = 0;

/// < File->Save
    virtual void CommandSave( const ActionPacket & ) = 0;

/// < File->Save As
    virtual void CommandSaveAs( const ActionPacket & ) = 0;

/// < File->Print
    virtual void CommandPrint( const ActionPacket & ) = 0;

/// < File->Print Preview
    virtual void CommandPrintPreview( const ActionPacket & ) = 0;

/// < File->Page Setup
    virtual void CommandPageSetup( const ActionPacket & ) = 0;

/// < File->Properties
    virtual void CommandProperties( const ActionPacket & ) = 0;

/// < Edit->Cut
    virtual void CommandCut( const ActionPacket & ) = 0;

/// < Edit->Copy
    virtual void CommandCopy( const ActionPacket & ) = 0;

/// < Edit->Paste
    virtual void CommandPaste( const ActionPacket & ) = 0;

/// < Edit->Undo
    virtual void CommandUndo( const ActionPacket & ) = 0;

/// < Edit->Redo
    virtual void CommandRedo( const ActionPacket & ) = 0;

/// < Edit->Select All
    virtual void CommandSelectAll( const ActionPacket & ) = 0;

/// < Edit->Clear Selection
    virtual void CommandClearSelection( const ActionPacket & ) = 0;

/// < View->Stop
    virtual void CommandStop( const ActionPacket & ) = 0;

/// < User defined Actions
    virtual void User0( const ActionPacket & ) = 0;
    virtual void User1( const ActionPacket & ) = 0;
    virtual void User2( const ActionPacket & ) = 0;
    virtual void User3( const ActionPacket & ) = 0;
    virtual void User4( const ActionPacket & ) = 0;
    virtual void User5( const ActionPacket & ) = 0;
    virtual void User6( const ActionPacket & ) = 0;
    virtual void User7( const ActionPacket & ) = 0;
    virtual void User8( const ActionPacket & ) = 0;
    virtual void User9( const ActionPacket & ) = 0;
};

typedef void ( ActionBase:: * ACTION )( const ActionPacket & );

namespace Action
{
/**
 * Enumeration associating an unique indentifier with each
 * gesture action
 **/
    enum ActionIndex
    { 
        None = -1,

        GotoPrevious = 0,
        GotoNext,
        GotoTop,
        GotoBottom,
        GoHome,
        Close,
        OpenNewForeWindow,
        OpenNewBackWindow,
        Refresh,
        Reload,
        Minimise,
        Restore,
        Duplicate,
        ScrollWindows,
        Maximise,
        CommandOpen,
        CommandSave,
        CommandSaveAs,
        CommandPrint,
        CommandPrintPreview,
        CommandPageSetup,
        CommandProperties,
        CommandCut,
        CommandCopy,
        CommandPaste,
        CommandUndo,
        CommandRedo,
        CommandSelectAll,
        CommandClearSelection,
        CommandStop,

        User0,
        User1,
        User2,
        User3,
        User4,
        User5,
        User6,
        User7,
        User8,
        User9,

        ACTION_COUNT        /// < <b>MUST</b> be last item in enum
    };

/**
 * Retrieve a pointer to an array of ACTION's - the ownership of the
 * array remains with the callee
 **/
    const ACTION *   GetActionMap();

/**
 * Retrieve the description of a given Action
 **/
    LPCTSTR          GetDescription( ActionIndex action );
}

#endif // __ACTION_H_21079340_5F58_4393_8A85_D25E8FC7E73D_

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

Share

About the Author

Ralph Hare
Web Developer
United Kingdom United Kingdom
No Biography provided

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.141216.1 | Last Updated 21 Sep 2005
Article Copyright 2003 by Ralph Hare
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid