00001 /* Copyright (C) 2006 P.L. Lucas 00002 * 00003 * This program is free software; you can redistribute it and/or modify 00004 * it under the terms of the GNU General Public License as published by 00005 * the Free Software Foundation; either version 2 of the License, or 00006 * (at your option) any later version. 00007 * 00008 * This program is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 * GNU General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU General Public License 00014 * along with this program; if not, write to the Free Software 00015 * Foundation, Inc., 59 Temple Place, Suite 330, 00016 * Boston, MA 02111-1307, USA. 00017 */ 00018 00019 #ifndef MAINWINDOW_H 00020 #define MAINWINDOW_H 00021 00022 #include <QtCore/QVariant> 00023 #include <QtGui/QAction> 00024 #include <QtGui/QApplication> 00025 #include <QtGui/QButtonGroup> 00026 #include <QtGui/QMainWindow> 00027 #include <QtGui/QMenu> 00028 #include <QtGui/QMenuBar> 00029 #include <QtGui/QStatusBar> 00030 #include <QtGui/QToolBar> 00031 #include <QtGui/QWidget> 00032 #include <QWorkspace> 00033 #include <QMap> 00034 #include "config.h" 00035 #include "octave_connection.h" 00036 00037 /**Represents and creates main window. This class is only for creates main window interface, menus and menus actions. Menus callbacks are implemented in Operations class.<br> 00038 * Menus and actions can be added to this class or using createAction and createMenu methods. 00039 * @see GenerateMenu for user menus. 00040 * @see Operations class for actions callbacks. 00041 * @see createAction, createMenu 00042 */ 00043 class MainWindow:public QMainWindow 00044 { 00045 public: 00046 //General actions 00047 QAction *actionOpen; 00048 QAction *actionOctave_help; 00049 QAction *actionTable; 00050 QAction *actionEditor; 00051 //Matrix actions 00052 QAction *actionInverse; 00053 QAction *actionDeterminant; 00054 QAction *actionEigenvalues; 00055 QAction *actionTranspose; 00056 QAction *actionSubmatrix; 00057 //Statistics actions 00058 QAction *actionMean; 00059 QAction *actionMedian; 00060 QAction *actionStd; 00061 QAction *actionCov; 00062 QAction *actionCorrcoef; 00063 //Plot actions 00064 QAction *actionPlot; 00065 QAction *actionPolar; 00066 QAction *actionSemilogy; 00067 QAction *actionSemilogx; 00068 QAction *actionLogLog; 00069 QAction *actionAxis; 00070 QAction *actionTitleLabel; 00071 QMenu *menu2DPlot; 00072 QMenu *menuExport; 00073 QAction *actionToEPS; 00074 QAction *actionToPDF; 00075 QAction *actionToPNG; 00076 //Config actions 00077 QAction *actionGeneralConfig; 00078 /**Main window work space.*/ 00079 QWorkspace *work_space; 00080 /**Main window menu bar.*/ 00081 QMenuBar *menubar; 00082 QMenu *menuFile; 00083 QMenu *menuEdit; 00084 QMenu *menuData; 00085 QMenu *menuMatrix; 00086 QMenu *menuStatistics; 00087 QMenu *menuPlot; 00088 QMenu *menuConfig; 00089 QMenu *menuHelp; 00090 /**Main window status bar.*/ 00091 QStatusBar *statusbar; 00092 /**Main window tool bar.*/ 00093 QToolBar *toolBar; 00094 00095 /**Creates new MainWindow. 00096 * @param oc OctaveConnection creates in terminal. 00097 * @param parent parent widget. 00098 */ 00099 MainWindow(OctaveConnection *oc, QWidget *parent=0); 00100 /**Clears all menus. 00101 */ 00102 void clear_menu(); 00103 /**Show base menu.*/ 00104 void show_menu_base(); 00105 00106 /**This a QMap of menu actions. You can create menu actions using createAction method. 00107 * @see createAction. 00108 */ 00109 QMap<QString, QAction *> actions; 00110 00111 /**Creates new action. Actions are added to actions variable. 00112 * @param action_name Name of action. Only for internal use. 00113 * @param name Label of action in menues. 00114 * @param icon Icon path of action in menues. 00115 * @return New action. 00116 * @see actions. 00117 */ 00118 QAction *createAction(QString action_name, const char *name, QString icon=QString()); 00119 /**This a QMap of menus. You can create menu using createMenu method. 00120 * @see createMenu. 00121 */ 00122 QMap<QString, QMenu *> menus; 00123 /**Creates new menu. Menus are added to menus variable. 00124 * @param action_name Name of menu. Only for internal use. 00125 * @param name Label of menu. 00126 * @param icon Icon path of menu. 00127 * @return New menu. 00128 * @see menus. 00129 */ 00130 QMenu *createMenu(QString menu_name, const char *name, QString icon=QString()); 00131 /**Connection to Octave terminal. Useful for send commands to Octave and see results in terminal. 00132 */ 00133 OctaveConnection *octave_connection; 00134 }; 00135 00136 #endif