![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /********************************************************************* 00002 ** Copyright (c) 2001 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *********************************************************************/ 00005 /********************************************************************* 00006 ** $RCSfile: tmMiniMap.h,v $ $Revision: 1.26 $ $State: Exp $ 00007 *********************************************************************/ 00008 00011 00012 #ifndef TMMINIMAP_H 00013 #define TMMINIMAP_H 00014 00015 #include "tmqt/tmArea.h" 00016 00017 #include "tmqt/tmRubberBand.h" 00018 00019 #include <QtGui/QPixmap> 00020 00021 00022 00023 class DtTMWindow; 00024 class DtTMMapArea; 00025 00033 00034 #include "tmqt/tmqtDefines.h" 00035 class DT_DLL_tmqt DtTMMiniMap : public DtTMArea 00036 { 00037 Q_OBJECT 00038 00039 public: 00040 00042 DtTMMiniMap(QWidget* parent = 0, const Qt::WindowFlags& f = 0); 00043 00045 virtual ~DtTMMiniMap(); 00046 00048 virtual bool init(const DtTMFactory* f); 00049 00051 virtual bool showingRubberBands() const; 00052 00054 virtual void setShowingRubberBands(bool onOff); 00055 00057 virtual QSize minimumSizeHint() const; 00058 virtual QSize sizeHint() const; 00059 00060 //Rubber bands represent an area (usually another view) 00061 //When you ask to add a Rubber band the function returns an identifying 00062 //integer that you can use to identify it when the signals come back. 00063 //There is one active rubber band, specified with setActiveMap 00064 //This is the one that gets resized when you move the mouse around 00065 //if you want no resize/move, just setActiveMap to 0. 00066 virtual DtTMRubberBand* addRubberBand 00067 ( 00068 const DtTMFactory* f, 00069 const DtTMMiniMap* m, 00070 const DtTMMapArea* a, 00071 double pctX = 0, 00072 double pctY = 0, 00073 double pctWidth = 1, 00074 double pctHeight = 1, 00075 QPen* activePen = 0, 00076 QPen* inactivePen = 0 00077 ); 00078 00082 virtual const QPen& activePen() const; 00083 00085 virtual void setActivePen(const QPen& p); 00086 00090 virtual const QPen& inactivePen() const; 00091 00093 virtual void setInactivePen(const QPen& p); 00094 00095 //set the Inactive color of the pen. Also resets all previus 00096 //rubber bands to that color 00097 virtual void setActiveColor(const QColor& c); 00098 00099 //set the Inactive color of the pen. Also resets all previus 00100 //rubber bands to that color 00101 virtual void setInactiveColor(const QColor& c); 00102 00103 public: 00104 00106 static DtTMMiniMap* create(QWidget* parent, const Qt::WindowFlags& f); 00107 00108 signals: 00109 00111 void activeRubberBandSet(const DtTMRubberBand*); 00112 00113 public slots: 00114 00116 virtual void setActiveRubberBand(DtTMRubberBand*); 00117 00118 //Take a rubber band out of the equation. 00119 //Note: the QObject should be of type DtTMRubberBand 00121 virtual void removeRubberBand(QObject*); 00122 00123 virtual void drawRubberBands(QPainter* p); 00124 00125 protected: 00126 00128 DtTMMiniMap(const DtTMMiniMap& orig); 00129 00131 DtTMMiniMap& operator=(const DtTMMiniMap& orig); 00132 00134 virtual void mouseReleaseEvent(QMouseEvent* e); 00135 virtual void mousePressEvent(QMouseEvent* e); 00136 virtual void mouseMoveEvent(QMouseEvent* e); 00137 virtual void resizeEvent(QResizeEvent* e); 00138 00140 00141 virtual void clipPoint(QPoint& point); 00142 00143 virtual void clipRect(QRect& rect); 00144 00145 virtual void reorderRectangle(QRect& rect); 00146 00147 virtual void resizeRectToFitAspectRatio(QRect& r, const double& ratio); 00148 00150 virtual bool needsDrawOrder() const; 00151 00152 protected: 00153 QPen myActivePen; 00154 QPen myInactivePen; 00155 00156 DtTMRubberBandList myTMRubberBandList; 00157 DtTMRubberBand* myActiveRubberBand; 00158 00159 QRect mySelectionRect; 00160 00161 bool myShowingRubberBands; 00162 bool myTracking; 00163 00164 }; 00165 00166 #endif