Back to index

unity  6.0.0
GestureEngine.h
Go to the documentation of this file.
00001 /*
00002  * GestureEngine.h
00003  * This file is part of Unity
00004  *
00005  * Copyright (C) 2011 - Canonical Ltd.
00006  *
00007  * Unity is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * Unity is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with Unity; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin St, Fifth Floor,
00020  * Boston, MA  02110-1301  USA
00021  */
00022 
00023 #include <core/core.h>
00024 
00025 #include <sigc++/sigc++.h>
00026 #include "GeisAdapter.h"
00027 
00028 class GestureEngine : public sigc::trackable
00029 {
00030 public:
00031   GestureEngine(CompScreen* screen);
00032   virtual ~GestureEngine();
00033 
00034   void OnTap(GeisAdapter::GeisTapData* data);
00035 
00036   void OnDragStart(GeisAdapter::GeisDragData* data);
00037   void OnDragUpdate(GeisAdapter::GeisDragData* data);
00038   void OnDragFinish(GeisAdapter::GeisDragData* data);
00039 
00040   void OnRotateStart(GeisAdapter::GeisRotateData* data);
00041   void OnRotateUpdate(GeisAdapter::GeisRotateData* data);
00042   void OnRotateFinish(GeisAdapter::GeisRotateData* data);
00043 
00044   void OnPinchStart(GeisAdapter::GeisPinchData* data);
00045   void OnPinchUpdate(GeisAdapter::GeisPinchData* data);
00046   void OnPinchFinish(GeisAdapter::GeisPinchData* data);
00047 
00048   void OnTouchStart(GeisAdapter::GeisTouchData* data);
00049   void OnTouchUpdate(GeisAdapter::GeisTouchData* data);
00050   void OnTouchFinish(GeisAdapter::GeisTouchData* data);
00051 
00052   void EndDrag();
00053 private:
00054   CompWindow* FindCompWindowAtPos(float pos_x, float pos_y);
00055 
00056   CompScreen* _screen;
00057   CompWindow* _drag_window;
00058   CompWindow* _pinch_window;
00059   CompWindow* _touch_window;
00060   CompScreen::GrabHandle _drag_grab;
00061   CompScreen::GrabHandle _pinch_grab;
00062 
00063   int _drag_id;
00064   int _pinch_id;
00065   int _touch_id;
00066 
00067   Cursor _fleur_cursor;
00068 };