Click here to Skip to main content
15,895,011 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.
///////////////////////////////////////////////////////////////
//
// TrailsPage.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 __TRAILSPAGE_ADF2A98D_E37D_45D2_A111_1527BD0F52D6
#define __TRAILSPAGE_ADF2A98D_E37D_45D2_A111_1527BD0F52D6

#include "resource.h"
#include "TrackBarCtrlEx.h"
#include "MouseTrackerEx.h"
#include <atlmisc.h>
#include <atlddx.h>

struct ColourRec
{
    LPCTSTR     name;
    COLORREF    clr;
};

class TrailsPage :     
    public CPropertyPageImpl< TrailsPage >,
    public CWinDataExchange< TrailsPage >,
    public MouseTracker::Watcher
{
public:
	TrailsPage();

public:
	enum { IDD = IDD_PROPPAGE_TRAILS };

	BEGIN_MSG_MAP( TrailsPage )
		MESSAGE_HANDLER( WM_INITDIALOG, OnInitDialog )
        MESSAGE_HANDLER( WM_DESTROY, OnDestroy )
        MESSAGE_HANDLER( WM_DRAWITEM, OnDrawItem )
        COMMAND_HANDLER( IDC_COMBO_COLOUR, CBN_SELCHANGE, OnColourChange )
        COMMAND_ID_HANDLER( IDC_BUTTON_CUSTOM, OnCustom )
        COMMAND_ID_HANDLER( IDC_CHECK_ENABLE, OnEnabled )
        NOTIFY_HANDLER( IDC_SLIDER_THICKNESS, NM_RELEASEDCAPTURE, OnSliderChange )
        NOTIFY_HANDLER( IDC_SLIDER_TRANSPARENCY, NM_RELEASEDCAPTURE, OnSliderChange )
        NOTIFY_HANDLER( IDC_SLIDER_FADE_SPEED, NM_RELEASEDCAPTURE, OnSliderChange )
        NOTIFY_CODE_HANDLER( TTN_NEEDTEXTW, OnNeedTextW );
        CHAIN_MSG_MAP( CPropertyPageImpl< TrailsPage > )
	END_MSG_MAP()

    BEGIN_DDX_MAP( TrailsPage )
        DDX_CHECK( IDC_CHECK_ENABLE, m_enable )
    END_DDX_MAP()

// Handler prototypes (uncomment arguments if needed):
//	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled )
//	LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL &bHandled )
//	LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL &bHandled )

private:
	LRESULT OnInitDialog( UINT, WPARAM, LPARAM, BOOL & );
    LRESULT OnDestroy( UINT, WPARAM, LPARAM, BOOL & );
    LRESULT OnDrawItem( UINT, WPARAM, LPARAM, BOOL & );
    LRESULT OnCustom( WORD, WORD, HWND, BOOL & );
    LRESULT OnEnabled( WORD, WORD, HWND, BOOL & );
    LRESULT OnColourChange( WORD, WORD, HWND, BOOL & );
    LRESULT OnSliderChange( int, LPNMHDR, BOOL & );    
    LRESULT OnNeedTextW( int, LPNMHDR, BOOL & );

// CPropertyPageImpl
public:
    BOOL OnApply();
    void SetModified( BOOL isModified );

// MouseTracker::Watcher
private:
    bool OnRightButtonDown( HWND, const POINT &pt, DWORD );

private:
    void EnableWindows();
    COLORREF GetColour() const;

private:
    CComboBox       m_comboColour;
    CButton         m_btnEnable;
    CButton         m_btnCustom;
    CTrackBarCtrl   m_sliderThickness;
    TrackBarCtrlEx  m_sliderTransparency;
    TrackBarCtrlEx  m_sliderFadeSpeed;
    CStatic         m_staticImage;
    CBitmap         m_bitmapImage;
    WTL::CRect      m_rcImage;

    ColourRec       m_customColour;
    BOOL            m_enable;

    MouseTrackerEx  m_mouseTracker;
    bool            m_isModified;
};

#endif // __TRAILSPAGE_ADF2A98D_E37D_45D2_A111_1527BD0F52D6

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