SciFigs/MouseTracking.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of SciFigs.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2007-01-31
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (LGIT, Grenoble, France)
00025 **
00026 ***************************************************************************/
00027 
00028 #ifndef MOUSETRACKING_H
00029 #define MOUSETRACKING_H
00030 
00031 #include "SciFigsDLLExport.h"
00032 #include "LayerMouseTracking.h"
00033 
00034 namespace SciFigs {
00035 
00036 class SCIFIGS_EXPORT MouseTracking : private QList<LayerMouseTracking>
00037 {
00038 public:
00039   MouseTracking() {_rectangle=0; _active=true;}
00040   ~MouseTracking() {delete _rectangle;}
00041 
00042   void add(const LayerMouseTracking& l);
00043   void remove(int i);
00044 
00045   bool isEmpty() const {return QList<LayerMouseTracking>::isEmpty();}
00046   int indexOf(GraphContentLayer * layer, int id=-1) const;
00047   bool contains(GraphContentLayer * layer, int id=-1) const {return indexOf(layer, id)>-1;}
00048   const LayerMouseTracking& activeLayer() const {return first();}
00049 
00050   bool isRectangle() const;
00051   bool isRectangleVisible() const;
00052   QRect * rectangle() const {return _rectangle;}
00053   void initRectangle(const QPoint& topLeft);
00054   void resetRectangle();
00055   bool isEmptyRectangle() const {return abs(_rectangle->width())<5 && abs(_rectangle->height())<5;}
00056 
00057   bool isActive() const {return _active;}
00058   void setActive(bool a) {_active=a;}
00059 private:
00060   QRect * _rectangle;
00061   bool _active;
00062 };
00063 
00064 } // namespace SciFigs
00065 
00066 #endif // MOUSETRACKING_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines