///////////////////////////////////////////////////////////////
//
// 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_