BCGSuite for MFC
CBCGPGestureBase

Detailed Description

Using this class a developer can add gestures support in few lines of code:

just derive any class from CBCGPGestureBase, setup CBCGPGestureConfig, add WM_GESTURE message handler and override OnGestureEvent* virtual methods.

GesturesDemo sample shows how to add the gestures support to your class.

Example

Copy
class CGestureWindow : public CWnd,
{
virtual BOOL OnGestureEventPan(const CPoint& ptFrom, const CPoint& ptTo, CSize& sizeOverPan);
afx_msg LRESULT OnGesture(WPARAM wp, LPARAM lp);
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(CGestureWindow, CWnd)
ON_WM_CREATE()
ON_MESSAGE(WM_GESTURE, OnGesture)
END_MESSAGE_MAP()
int CGestureWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
....
CBCGPGestureConfig gestureConfig;
gestureConfig.EnablePan(TRUE,
BCGP_GC_PAN_WITH_SINGLE_FINGER_VERTICALLY | BCGP_GC_PAN_WITH_SINGLE_FINGER_HORIZONTALLY |
BCGP_GC_PAN_WITH_GUTTER | BCGP_GC_PAN_WITH_INERTIA);
bcgpGestureManager.SetGestureConfig(GetSafeHwnd(), gestureConfig);
return 0;
}
LRESULT CGestureWindow::OnGesture(WPARAM wp, LPARAM lp)
{
if (ProcessGestureEvent(this, wp, lp))
{
return Default();
}
return 0;
}
BOOL CGestureWindow::OnGestureEventPan(const CPoint& ptFrom, const CPoint& ptTo, CSize& sizeOverPan)
{
double dx = ptTo.x - ptFrom.x;
double dy = ptTo.y - ptFrom.y;
// Process horizontal/vertical window content shifting
....
return TRUE;
}
+ Inheritance diagram for CBCGPGestureBase:

Protected Member Functions

 OnGestureEventBeginCalled by the framework to handle BCGP_GID_BEGIN notification.
 
 OnGestureEventEndCalled by the framework to handle BCGP_GID_END notification.
 
 OnGestureEventPanCalled by the framework to handle BCGP_GID_PAN notification
 
 OnGestureEventPressAndTapCalled by the framework to handle BCGP_GID_PRESSANDTAP notification.
 
 OnGestureEventRotateCalled by the framework to handle BCGP_GID_ROTATE notification.
 
 OnGestureEventTwoFingerTapCalled by the framework to handle BCGP_GID_TWOFINGERTAP notification.
 
 OnGestureEventZoomCalled by the framework to handle BCGP_GID_ZOOM notification.
 
 ProcessGestureEventThis method should be called from WM_GESTURE message handler.