itom 1.0.14
|
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 00047 public: 00048 FigureWidget(const QString &title, bool docked, bool isDockAvailable, int rows, int cols, QWidget *parent = 0, Qt::WindowFlags flags = 0); 00049 ~FigureWidget(); 00050 00051 RetVal plot(QSharedPointer<ito::DataObject> dataObj, int areaRow, int areaCol, const QString &className, QWidget **canvasWidget); 00052 RetVal liveImage(QPointer<AddInDataIO> cam, int areaRow, int areaCol, const QString &className, QWidget **canvasWidget); 00053 00054 QWidget *getSubplot(int index) const; 00055 00056 RetVal changeCurrentSubplot(int newIndex); 00057 00058 //--------------------------------- 00059 // setter / getter 00060 //--------------------------------- 00061 void setFigHandle(QSharedPointer<unsigned int> figHandle) { m_guardedFigHandle = figHandle; } 00062 00063 00064 inline int rows() const { return m_rows; }; 00065 inline int cols() const { return m_cols; }; 00066 00067 protected: 00068 00069 QWidget* prepareWidget(const QString &plotClassName, int areaRow, int areaCol, RetVal &retval); 00070 00071 void createActions(); 00072 void createMenus(); 00073 void createToolBars(); 00074 void createStatusBar(); 00075 void updateActions(); 00076 void updatePythonActions(){ updateActions(); } 00077 00078 void closeEvent(QCloseEvent *event); // { event->accept(); }; 00079 00080 //bool eventFilter(QObject *obj, QEvent *event); 00081 00082 QSharedPointer<ito::Param> getParamByInvoke(ito::AddInBase* addIn, const QString ¶mName, ito::RetVal &retval); 00083 00084 private: 00085 QGridLayout *m_pGrid; 00086 QWidget *m_pCenterWidget; 00087 00088 QMenu *m_menuWindow; 00089 QMenu *m_menuSubplot; 00090 QAction *m_firstSysAction; 00091 00092 QActionGroup *m_pSubplotActions; 00093 00094 int m_rows; 00095 int m_cols; 00096 int m_curIdx; 00097 00098 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. 00099 00100 QMap< QObject*, QList<QAction*> > m_menuStack; 00101 00102 QVector<QWidget*> m_widgets; 00103 00104 00105 00106 00107 00108 signals: 00109 00110 private slots: 00111 void mnu_subplotActionsTriggered(QAction *action); 00112 }; 00113 00114 } //end namespace ito 00115 00116 #endif