Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef MAPVIZ_PLUGINS_PLACEABLE_WINDOW_PROXY_H
00030 #define MAPVIZ_PLUGINS_PLACEABLE_WINDOW_PROXY_H
00031
00032 #include <QObject>
00033 #include <QRect>
00034 #include <QPoint>
00035
00036 QT_BEGIN_NAMESPACE;
00037 class QMouseEvent;
00038 class QResizeEvent;
00039 QT_END_NAMESPACE;
00040
00056 namespace mapviz_plugins
00057 {
00058 class PlaceableWindowProxy : public QObject
00059 {
00060 Q_OBJECT
00061
00062 public:
00063 PlaceableWindowProxy();
00064 ~PlaceableWindowProxy();
00065
00066 void setContainer(QWidget *);
00067
00068 QRect rect() const;
00069
00070 Q_SIGNALS:
00071 void rectChanged(const QRect &);
00072
00073 public Q_SLOTS:
00074 void setRect(const QRect &);
00075 void setVisible(bool visible);
00076
00077 protected:
00078 bool eventFilter(QObject *object, QEvent *event);
00079
00080 bool handleMousePress(QMouseEvent *);
00081 bool handleMouseRelease(QMouseEvent *);
00082 bool handleMouseMove(QMouseEvent *);
00083 bool handleResize(QResizeEvent *);
00084
00085 void timerEvent(QTimerEvent *);
00086
00087 void rectResize(int dx, int dy);
00088 void winResize(const QSize &);
00089
00090 QRectF resizeHelper(const QRectF &rect,
00091 const QPointF &p1,
00092 const QPointF &p2,
00093 const QPointF &p3) const;
00094
00095
00096
00097 private:
00098 enum State {
00099 INACTIVE = 0,
00100 MOVE_ALL,
00101 MOVE_TOP_LEFT,
00102 MOVE_BOTTOM_LEFT,
00103 MOVE_BOTTOM_RIGHT,
00104 MOVE_TOP_RIGHT
00105 };
00106
00107 QWidget *target_;
00108 bool visible_;
00109
00110 bool has_cursor_;
00111 State state_;
00112 QRectF rect_;
00113
00114 QRectF start_rect_;
00115 QPoint start_point_;
00116
00117 int win_resize_timer_;
00118
00119 State getNextState(const QPointF &pt) const;
00120 };
00121 }
00122 #endif //MAPVIZ_PLUGINS_CANVAS_CLICK_FILTER_H