![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2003 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 /******************************************************************************* 00006 ** $RCSfile: dragDropHandler.h,v $ $Revision: 1.18 $ $State: Exp $ 00007 *******************************************************************************/ 00008 00011 00012 #ifndef DRAGDROPHANDLER_H_ 00013 #define DRAGDROPHANDLER_H_ 00014 00015 #include "tmqt/eventHandler.h" 00016 #include "symbolMapper/modelData.h" 00017 #include "drawerNative/displayPoint.h" 00018 00019 #include <QtCore/QTimer> 00020 #include <QtCore/QDateTime> 00021 #include <QtCore/QHash> 00022 00023 class DtBaseWindow; 00024 class DtDragObject; 00025 class DtTMMapArea; 00026 class DtStdContextMenu; 00027 class DtSymbol; 00028 00031 #include "tmEventHandler/tmEventHandlerDefines.h" 00032 class DT_DLL_tmEventHandler DtDragData : public QObject 00033 { 00034 Q_OBJECT 00035 00036 public: 00037 DtDragData(DtTMMapArea* area, DtEventHandler* parent); 00038 00039 virtual ~DtDragData(); 00040 00041 virtual void reset(); 00042 00043 public slots: 00047 virtual void showDraggedSymbol(); 00048 virtual void symbolRemoved(const DtModelKey& symbol); 00049 00050 public: 00051 DtDisplayPoint myDragPoint; 00052 DtDisplayPoint myLastDragPoint; 00053 QList<DtSymbol*> myDragSymbols; 00054 bool myEndDrag; 00055 QTimer* myDragTimer; 00056 QTime myDrawTimer; 00057 DtTMMapArea* myMapArea; 00058 QVector<DtModelKey> myDragData; 00059 DtEventHandler* myParent; 00060 Qt::MouseButtons myMouseButtonState; 00061 }; 00062 00064 class DT_DLL_tmEventHandler DtDragDropHandler : public DtEventHandler 00065 { 00066 Q_OBJECT 00067 00068 public: 00069 00071 DtDragDropHandler(); 00072 00074 virtual ~DtDragDropHandler(); 00075 00079 virtual bool isValidForDrag(DtTMMapArea* map, DtModelKey &key); 00080 00084 virtual DtDragObject* createDragObject(DtTMMapArea* activeMap, QString &dragging); 00085 00087 virtual void dragMove(DtTMMapArea* area, DtModelData* data, const DtPoint& delta); 00088 00089 public: 00091 static DtEventHandler* create(DtEventController* owner, void* usr); 00092 00093 public slots: 00094 virtual bool mouseEvent(DtTMMapArea* area, QMouseEvent* evnt, const DtPoint& pnt); 00095 00096 protected slots: 00099 virtual bool dropSymbols(DtTMMapArea* area, QDropEvent* e); 00100 00101 public: 00102 virtual bool dropEvent(DtTMMapArea* area, QDropEvent* evnt); 00103 virtual bool dragMoveEvent(DtTMMapArea* area, QDragMoveEvent* evnt); 00104 virtual bool dragEnterEvent(DtTMMapArea* area, QDragEnterEvent* evnt); 00105 virtual bool dragLeaveEvent(DtTMMapArea* area, QDragLeaveEvent* evnt); 00106 00107 protected: 00109 virtual bool canDrag(DtTMMapArea* area) const; 00110 00112 virtual void endDrag(DtTMMapArea* area, int timerMsec); 00113 00121 virtual bool getDropLocationData(DtTMMapArea* area, const QPoint& dropPoint, QString& idStr, QVector<DtPoint>& pnts, double heightChange); 00122 00124 virtual DtDragData* dragDataForArea(DtTMMapArea* area); 00125 00126 virtual void tick(); 00127 00129 virtual void dropSymbol(DtTMMapArea* area, const QPoint& dropPoint, DtModelData* symData, double heightChange = 0.); 00130 00133 virtual int timeout() const; 00134 00136 virtual bool dragAboutToStart(DtTMMapArea*); 00137 00139 virtual void modifyPoint(const DtModelData& data, DtPoint& pnt); 00140 00141 virtual bool dropSymbols(DtTMMapArea* area, const QPoint& dropPoint, const QString& idStr, double heightChange = 0.); 00142 00143 protected: 00144 QHash<DtTMMapArea*, DtDragData*> myMapDragData; 00145 bool myCompletedDrag; 00146 }; 00147 00148 #endif //DRAGDROPHANDLER_H_ 00149 00150