TarzaNN
TarzaNN neural network simulator
C:/Users/albertlr/projects/TarzaNN/TarzaNN/UI_FeaturePlaneViewer.h
Go to the documentation of this file.
00001 /****************************************************************************
00002  **
00003  ** Copyright C 2002-2012 Laboratory for Active and Attentive Vision (LAAV), Department of Computer Science and Engineering, York University, Toronto, ON, Canada.
00004  ** All rights reserved.
00005  **
00006  ** This file is part of the TarzaNN Neural Network Simulator.
00007  **
00008  ** This file may be distributed and/or modified under the terms of the
00009  ** GNU General Public License version 2 as published by the Free Software
00010  ** Foundation and appearing in the file LICENSE.GPL included in the
00011  ** packaging of this file.
00012  **
00013  ** See http://www.tarzann.org/gpl/ for GPL licensing information.
00014  **
00015  ** Contact info@tarzann.org if any conditions of this licensing are
00016  ** not clear to you.
00017  **
00018  ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00019  ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00020  **
00021  ****************************************************************************/
00022 
00023 #ifndef UI_FeaturePlaneViewer_H
00024 #define UI_FeaturePlaneViewer_H
00025 
00026 #include "UI_FeaturePlane.h"
00027 #include "UI_NeuronTimeCourse.h"
00028 #include "UI_ImageViewer.h"
00029 #include "UI_Layer.h"
00030 #include "Layer.h"
00031 #include "FeaturePlaneAbstract.h"
00032 
00033 #include <q3mainwindow.h>
00034 #include <q3vbox.h>
00035 //Added by qt3to4:
00036 #include <QHideEvent>
00037 #include <QShowEvent>
00038 #include <Q3PopupMenu>
00039 #include <QMainWindow>
00040 #include <QWorkspace>
00041 class QAction;
00042 class Q3PopupMenu;
00043 class UI_Wrapper;
00044 
00045 
00046 class UI_FeaturePlaneViewer : public QWorkspace
00047 {
00048     Q_OBJECT
00049 
00050 public:
00051     UI_FeaturePlaneViewer(QMainWindow*, QWidget *, const char * = 0);
00052     ~UI_FeaturePlaneViewer();
00053 
00054     void initActions();
00055     void initMenuBar();
00056 
00057     void showEvent(QShowEvent *);
00058     void hideEvent(QHideEvent *);
00059 
00060         QMainWindow* mainWindow;
00061     QWorkspace *workspace;
00062     QAction *actionClose, *actionCloseAll, *actionTile, *actionCascade;
00063     QMenu *windowMenu, *newMenu;
00064     UI_Wrapper *lastwrapper;
00065         QWidgetList windowList();
00066 
00067 public slots:
00068     void newSlot(int);
00069     void windowSlot(int);
00070     void windowActivated(QWidget *);
00071     void closeSlot();
00072     void closeAllSlot();
00073     void tileSlot();
00074     void cascadeSlot();
00075     void wrapperDead();
00076 
00077     void insertFeaturePlane(FeaturePlaneAbstract *tmpFp);
00078     void insertNeuronTimeCourse(FeaturePlaneAbstract *tmpFp,int x, int y);
00079         void insertLayer(Layer *layer);
00080     UI_ImageViewer* insertImage();
00081     void insertWindow(UI_Wrapper *wrapper);
00082 };
00083 
00084 class UI_Wrapper : public QWidget {
00085 public:
00086         UI_FeaturePlane *newUIFP;
00087         FeaturePlaneAbstract* theFP;
00088         
00090     UI_Wrapper(QWidget *parent, int i, FeaturePlaneAbstract* tmpFp, const char *name = 0)
00091         : QWidget(parent, Qt::WDestructiveClose), id(i)
00092     {
00093                 setBackgroundRole(QPalette::Base);
00094             layout = new QVBoxLayout;
00095                 newUIFP = new UI_FeaturePlane(tmpFp,this);
00096         if(tmpFp)
00097             tmpFp->fpViewerWindow=newUIFP;
00098                 theFP=tmpFp;
00099                 layout->addWidget(newUIFP);
00100                 layout->setMargin(1);
00101                 if (tmpFp != NULL) {
00102                         setCaption( *(tmpFp->getName()));
00103                         setWindowTitle( *(tmpFp->getName()));
00104                 }
00105                 else {
00106                         setCaption("Feature Plane - " + QString("%1").arg(id));
00107                         setWindowTitle("");
00108                 }
00109                 setLayout(layout);
00110                 resize( QSize(300, 300).expandedTo(minimumSizeHint()) );
00111                 newUIFP->show();
00112                 
00113                 repaint();
00114 
00115                 widget = newUIFP;
00116     }
00117 
00119     UI_Wrapper(QWidget *parent, int i, FeaturePlaneAbstract* tmpFp, int x, int y, const char *name = 0)
00120         : QWidget(parent, Qt::WDestructiveClose), id(i)
00121     {
00122                 newUIFP = NULL;
00123                 theFP=tmpFp;
00124 
00125                 setBackgroundRole(QPalette::Base);
00126             layout = new QVBoxLayout;   
00127                 layout->setMargin(1);                   
00128                 UI_NeuronTimeCourse *newNH = new UI_NeuronTimeCourse(tmpFp,x,y,this, "bla");
00129                 tmpFp->neuronTimeCourseWindow=newNH;
00130                 layout->addWidget(newNH);
00131                 if (name)
00132                         setCaption(name);
00133                 else
00134                         setCaption(*(tmpFp->getName()));
00135                 setLayout(layout);
00136                 newNH->resize(500,500);
00137                 newNH->show();
00138                 widget = newNH;
00139     }
00140 
00142     UI_Wrapper(QWidget *parent, int i, const char *name = 0)
00143         : QWidget(parent, Qt::WDestructiveClose), id(i)
00144     {
00145                 newUIFP = NULL;
00146                 theFP=NULL;
00147                 UI_ImageViewer *newIV;
00148                 setBackgroundRole(QPalette::Base);
00149             layout = new QVBoxLayout;                           
00150                 layout->setMargin(1);
00151                 newIV = new UI_ImageViewer(this);
00152                 layout->addWidget(newIV);
00153                 setCaption("Image Viewer");
00154                 setLayout(layout);
00155                 resize( QSize(300, 300).expandedTo(minimumSizeHint()) );
00156                 newIV->show();
00157                 repaint();
00158 
00159                 widget = newIV;
00160     }
00161 
00163     UI_Wrapper(Layer  *layer, QWidget *parent, int i, const char *name = 0)
00164         : QWidget(parent, Qt::WDestructiveClose), id(i)
00165     {
00166                 newUIFP = NULL;
00167                 theFP=NULL;
00168                 UI_Layer *newLayer;
00169                 setBackgroundRole(QPalette::Base);
00170             layout = new QVBoxLayout;                           
00171                 layout->setMargin(1);
00172                 newLayer = new UI_Layer(layer, this, name);
00173                 layout->addWidget(newLayer);
00174                 setCaption(layer->Name());
00175                 setLayout(layout);
00176                 resize( QSize(300, 300).expandedTo(minimumSizeHint()) );
00177                 newLayer->show();
00178                 repaint();
00179 
00180                 widget = newLayer;
00181     }
00182     
00184     ~UI_Wrapper() {
00185                 delete widget;
00186                 delete layout;
00187     }
00188 
00189     QWidget* widget;
00190         QVBoxLayout* layout;
00191         
00192     int id;
00193 };
00194 #endif // UI_FeaturePlaneViewer_H
00195 
00196 
00197 
00198 
00199 
00200 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines