itom 1.1.0
|
00001 /* ******************************************************************** 00002 itom software 00003 URL: http://www.uni-stuttgart.de/ito 00004 Copyright (C) 2013, Institut für Technische Optik (ITO), 00005 Universität Stuttgart, Germany 00006 00007 This file is part of itom. 00008 00009 itom is free software; you can redistribute it and/or modify it 00010 under the terms of the GNU Library General Public Licence as published by 00011 the Free Software Foundation; either version 2 of the Licence, or (at 00012 your option) any later version. 00013 00014 itom is distributed in the hope that it will be useful, but 00015 WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library 00017 General Public Licence for more details. 00018 00019 You should have received a copy of the GNU Library General Public License 00020 along with itom. If not, see <http://www.gnu.org/licenses/>. 00021 *********************************************************************** */ 00022 00023 #ifndef FIGUREWIDGET_H 00024 #define FIGUREWIDGET_H 00025 00026 #include "abstractDockWidget.h" 00027 00028 #include "common/sharedStructures.h" 00029 #include "DataObject/dataobj.h" 00030 #include "common/addInInterface.h" 00031 00032 #include <qgridlayout.h> 00033 #include <qsharedpointer.h> 00034 #include <qpointer.h> 00035 #include <qaction.h> 00036 #include <qmenu.h> 00037 #include <qevent.h> 00038 #include <qsignalmapper.h> 00039 00040 namespace ito { 00041 00042 class FigureWidget : public AbstractDockWidget 00043 { 00044 Q_OBJECT 00045 00046 Q_PROPERTY(QRect geometry READ geometry WRITE setGeometry) 00047 00048 00049 public: 00050 FigureWidget(const QString &title, bool docked, bool isDockAvailable, int rows, int cols, QWidget *parent = 0, Qt::WindowFlags flags = 0); 00051 ~FigureWidget(); 00052 00053 RetVal plot(QSharedPointer<ito::DataObject> dataObj, int areaRow, int areaCol, const QString &className, QWidget **canvasWidget); 00054 RetVal liveImage(QPointer<AddInDataIO> cam, int areaRow, int areaCol, const QString &className, QWidget **canvasWidget); 00055 00056 QWidget *getSubplot(int index) const; 00057 00058 RetVal changeCurrentSubplot(int newIndex); 00059 00060 //--------------------------------- 00061 // setter / getter 00062 //--------------------------------- 00063 void setFigHandle(QSharedPointer<unsigned int> figHandle) { m_guardedFigHandle = figHandle; } 00064 00065 00066 inline int rows() const { return m_rows; }; 00067 inline int cols() const { return m_cols; }; 00068 00069 protected: 00070 00071 QWidget* prepareWidget(const QString &plotClassName, int areaRow, int areaCol, RetVal &retval); 00072 00073 void createActions(); 00074 void createMenus(); 00075 void createToolBars(); 00076 void createStatusBar(); 00077 void updateActions(); 00078 void updatePythonActions(){ updateActions(); } 00079 00080 void closeEvent(QCloseEvent *event); // { event->accept(); }; 00081 00082 //bool eventFilter(QObject *obj, QEvent *event); 00083 00084 QSharedPointer<ito::Param> getParamByInvoke(ito::AddInBase* addIn, const QString ¶mName, ito::RetVal &retval); 00085 00086 private: 00087 QGridLayout *m_pGrid; 00088 QWidget *m_pCenterWidget; 00089 00090 QMenu *m_menuWindow; 00091 QMenu *m_menuSubplot; 00092 QAction *m_firstSysAction; 00093 00094 QActionGroup *m_pSubplotActions; 00095 00096 int m_rows; 00097 int m_cols; 00098 int m_curIdx; 00099 00100 QSharedPointer<unsigned int> m_guardedFigHandle; //this figure holds it own reference, this is deleted if this figure is closed by a close-event or if the close-method is called. 00101 00102 QMap< QObject*, QList<QAction*> > m_menuStack; 00103 00104 QVector<QWidget*> m_widgets; 00105 00106 signals: 00107 00108 private slots: 00109 void mnu_subplotActionsTriggered(QAction *action); 00110 }; 00111 00112 } //end namespace ito 00113 00114 #endif