00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef QGSCOMPOSERVIEW_H
00019 #define QGSCOMPOSERVIEW_H
00020
00021 #include <QGraphicsView>
00022
00023 class QKeyEvent;
00024 class QMainWindow;
00025 class QMouseEvent;
00026 class QgsComposition;
00027 class QgsComposerArrow;
00028 class QgsComposerItem;
00029 class QgsComposerLabel;
00030 class QgsComposerLegend;
00031 class QgsComposerMap;
00032 class QgsComposerPicture;
00033 class QgsComposerScaleBar;
00034 class QgsComposerShape;
00035 class QgsComposerAttributeTable;
00036
00044 class GUI_EXPORT QgsComposerView: public QGraphicsView
00045 {
00046 Q_OBJECT
00047
00048 public:
00049
00051 enum Tool
00052 {
00053 Select = 0,
00054 AddArrow,
00055 AddMap,
00056 AddLegend,
00057 AddLabel,
00058 AddScalebar,
00059 AddPicture,
00060 AddShape,
00061 AddTable,
00062 MoveItemContent
00063 };
00064
00065 QgsComposerView( QWidget* parent = 0, const char* name = 0, Qt::WFlags f = 0 );
00066
00068 void groupItems();
00069
00071 void ungroupItems();
00072
00073 QgsComposerView::Tool currentTool() const {return mCurrentTool;}
00074 void setCurrentTool( QgsComposerView::Tool t ) {mCurrentTool = t;}
00075
00077 void setComposition( QgsComposition* c );
00079 QgsComposition* composition();
00080
00082 void addComposerArrow( QgsComposerArrow* arrow );
00084 void addComposerLabel( QgsComposerLabel* label );
00086 void addComposerMap( QgsComposerMap* map );
00088 void addComposerScaleBar( QgsComposerScaleBar* scaleBar );
00090 void addComposerLegend( QgsComposerLegend* legend );
00092 void addComposerPicture( QgsComposerPicture* picture );
00094 void addComposerShape( QgsComposerShape* shape );
00096 void addComposerTable( QgsComposerAttributeTable* table );
00097
00099 QMainWindow* composerWindow();
00100
00101 protected:
00102 void mousePressEvent( QMouseEvent* );
00103 void mouseReleaseEvent( QMouseEvent* );
00104 void mouseMoveEvent( QMouseEvent* );
00105 void mouseDoubleClickEvent( QMouseEvent* e );
00106
00107 void keyPressEvent( QKeyEvent * e );
00108 void keyReleaseEvent( QKeyEvent * e );
00109
00110 void wheelEvent( QWheelEvent* event );
00111
00112 private:
00114 bool mShiftKeyPressed;
00116 QgsComposerView::Tool mCurrentTool;
00118 QGraphicsRectItem* mRubberBandItem;
00120 QGraphicsLineItem* mRubberBandLineItem;
00122 QgsComposerItem* mMoveContentItem;
00124 QPointF mMoveContentStartPos;
00126 QPointF mRubberBandStartPos;
00127
00128 public slots:
00130 void sendItemRemovedSignal( QgsComposerItem* item );
00131
00132 signals:
00134 void selectedItemChanged( const QgsComposerItem* selected );
00136 void composerArrowAdded( QgsComposerArrow* arrow );
00138 void composerLabelAdded( QgsComposerLabel* label );
00140 void composerMapAdded( QgsComposerMap* map );
00142 void composerScaleBarAdded( QgsComposerScaleBar* scalebar );
00144 void composerLegendAdded( QgsComposerLegend* legend );
00146 void composerPictureAdded( QgsComposerPicture* picture );
00148 void composerShapeAdded( QgsComposerShape* shape );
00150 void composerTableAdded( QgsComposerAttributeTable* table );
00152 void itemRemoved( QgsComposerItem* );
00155 void actionFinished();
00156 };
00157
00158 #endif