BWAPI
|
00001 // Copyright (c) 2002-2004 INRIA Sophia-Antipolis (France). 00002 // All rights reserved. 00003 // 00004 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License as 00006 // published by the Free Software Foundation; version 2.1 of the License. 00007 // See the file LICENSE.LGPL distributed with CGAL. 00008 // 00009 // Licensees holding a valid commercial license may use this file in 00010 // accordance with the commercial license agreement provided with the software. 00011 // 00012 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00013 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00014 // 00015 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Qt_widget/include/CGAL/IO/Qt_widget_layer.h $ 00016 // $Id: Qt_widget_layer.h 38534 2007-05-04 13:32:40Z lrineau $ 00017 // 00018 // 00019 // Author(s) : Laurent Rineau and Radu Ursu 00020 00021 #ifndef CGAL_QT_WIDGET_LAYER_H 00022 #define CGAL_QT_WIDGET_LAYER_H 00023 00024 #include <CGAL/IO/Qt_widget.h> 00025 #include <qobject.h> 00026 #include <qcursor.h> 00027 #include <list> 00028 00029 00030 namespace CGAL { 00031 00032 class Qt_widget_layer : public QObject { 00033 Q_OBJECT 00034 public: 00035 Qt_widget_layer(QObject* parent = 0, const char* name = 0) 00036 : QObject(parent, name), does_eat_events(false), active(false){}; 00037 00038 // Event handlers 00039 virtual void mousePressEvent(QMouseEvent *) {} ; 00040 virtual void mouseReleaseEvent(QMouseEvent *) {}; 00041 virtual void wheelEvent(QWheelEvent *) {}; 00042 virtual void mouseDoubleClickEvent(QMouseEvent *) {}; 00043 virtual void mouseMoveEvent(QMouseEvent *) {}; 00044 virtual void keyPressEvent(QKeyEvent *) {}; 00045 virtual void keyReleaseEvent(QKeyEvent *) {}; 00046 virtual void enterEvent(QEvent *) {}; 00047 virtual void leaveEvent(QEvent *) {}; 00048 virtual bool event(QEvent *e) {QObject::event(e); return true;}; 00049 00050 bool is_active(){return active;}; //return true if this layer is active 00051 bool does_eat_events; 00052 public slots: 00053 virtual void draw(){}; 00054 void stateChanged(int); 00055 void toggle(bool); 00056 bool activate(); //activate and return true if it was not active 00057 bool deactivate();//deactivate and return true if it was active 00058 signals: 00059 void activated(Qt_widget_layer*); 00060 void deactivated(Qt_widget_layer*); 00061 private: 00062 void attach(Qt_widget *w);//attach Qt_widget to the tool 00063 bool active; //true if this layers is active 00064 friend class Qt_widget; 00065 protected: 00066 Qt_widget *widget;//the pointer to the widget 00067 virtual void activating(){}; 00068 virtual void deactivating(){}; 00069 }; 00070 00071 } // namespace CGAL end 00072 00073 #endif // CGAL_QT_WIDGET_LAYER_H