| 178 | 
        kaklik | 
        1 | 
        #ifndef __SELECTRECTWIDGET_HH | 
      
      
         | 
         | 
        2 | 
        #define __SELECTRECTWIDGET_HH | 
      
      
         | 
         | 
        3 | 
          | 
      
      
         | 
         | 
        4 | 
        #include "videoWidget.hh" | 
      
      
         | 
         | 
        5 | 
          | 
      
      
         | 
         | 
        6 | 
        class SelectRectWidget: public VideoWidget | 
      
      
         | 
         | 
        7 | 
        { | 
      
      
         | 
         | 
        8 | 
          Q_OBJECT | 
      
      
         | 
         | 
        9 | 
        public: | 
      
      
         | 
         | 
        10 | 
          SelectRectWidget( QWidget *parent = 0, Qt::WFlags f = 0 ); | 
      
      
         | 
         | 
        11 | 
          virtual void setImage( const mimas::image< mimas::rgba< unsigned char > > &_img ); | 
      
      
         | 
         | 
        12 | 
          mimas::image< mimas::rgba< unsigned char > > selectedImage(); | 
      
      
         | 
         | 
        13 | 
          bool isRectDefined(void) { return haveRect && !dragging; } | 
      
      
         | 
         | 
        14 | 
          void clearSelection(void); | 
      
      
         | 
         | 
        15 | 
        signals: | 
      
      
         | 
         | 
        16 | 
          void rectDefined(bool); | 
      
      
         | 
         | 
        17 | 
        protected: | 
      
      
         | 
         | 
        18 | 
          void paintGL(void); | 
      
      
         | 
         | 
        19 | 
          void refresh(void); | 
      
      
         | 
         | 
        20 | 
          void mousePressEvent( QMouseEvent *e ); | 
      
      
         | 
         | 
        21 | 
          void mouseMoveEvent( QMouseEvent *e ); | 
      
      
         | 
         | 
        22 | 
          void mouseReleaseEvent( QMouseEvent *e ); | 
      
      
         | 
         | 
        23 | 
          int x0; | 
      
      
         | 
         | 
        24 | 
          int y0; | 
      
      
         | 
         | 
        25 | 
          int x1; | 
      
      
         | 
         | 
        26 | 
          int y1; | 
      
      
         | 
         | 
        27 | 
          bool dragging; | 
      
      
         | 
         | 
        28 | 
          bool haveRect; | 
      
      
         | 
         | 
        29 | 
        }; | 
      
      
         | 
         | 
        30 | 
          | 
      
      
         | 
         | 
        31 | 
        #endif |