Back to index

salome-gui  6.5.0
QtxRubberBand.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 // File:      QtxRubberBand.h
00021 // Author:    Alexander A. BORODIN
00022 //
00023 #ifndef QTXRUBBERBAND_H
00024 #define QTXRUBBERBAND_H
00025 
00026 #include "Qtx.h"
00027 
00028 #include <QWidget>
00029 
00030 class QTX_EXPORT QtxAbstractRubberBand : public QWidget
00031 {
00032   Q_OBJECT
00033 
00034 protected:
00035   QtxAbstractRubberBand( QWidget* );
00036 
00037 public:
00038   virtual ~QtxAbstractRubberBand();
00039 
00040   virtual void    clearGeometry();
00041 
00042   bool            isClosed();
00043 
00044 protected:
00045   virtual void    paintEvent( QPaintEvent* );
00046   virtual void    showEvent( QShowEvent* );
00047   virtual void    moveEvent( QMoveEvent* );
00048   virtual void    resizeEvent( QResizeEvent* );
00049 
00050   virtual bool    eventFilter( QObject*, QEvent* );
00051 
00052   virtual void    updateMask();
00053 
00054 protected:
00055   QPolygon        myPoints;
00056 
00057   bool            myIsClosed;
00058 };
00059 
00060 class QTX_EXPORT QtxRectRubberBand: public QtxAbstractRubberBand
00061 {
00062   Q_OBJECT
00063 
00064 public:
00065   QtxRectRubberBand( QWidget* );
00066   virtual ~QtxRectRubberBand();
00067 
00068   void            initGeometry( const QRect& );
00069   void            setStartPoint( const QPoint& );
00070   void            setEndPoint( const QPoint& );
00071         
00072   virtual void    clearGeometry();
00073 };
00074 
00075 class QTX_EXPORT QtxPolyRubberBand: public QtxAbstractRubberBand
00076 {
00077   Q_OBJECT
00078 
00079 public:
00080   QtxPolyRubberBand( QWidget* );
00081   virtual ~QtxPolyRubberBand();
00082 
00083   void            initGeometry( const QPolygon& );
00084   void            initGeometry( const QPoint& );
00085 
00086   void            addNode( const QPoint& );
00087   void            replaceLastNode( const QPoint& );
00088   void            removeLastNode();
00089 
00090   void            setClosed( bool );
00091 };
00092 
00093 #endif //QTXRUBBERBAND_H