/******************************************************************************
* NOMAD -  Nonlinear Optimization for Mixed vAriables and Derivatives.        *
* Copyright (C) 2001-2004  Gilles Couture - Ecole Polytechnique,              *
*                          Charles Audet - Ecole Polytechnique,               *
*		           John Dennis - Rice University.                     *
*                                                                             *
* Author: Gilles Couture                                                      *
* École Polytechnique de Montréal - GERAD                                     *
* C.P. 6079, Succ. Centre-ville, Montréal (Québec) H3C 3A7 Canada             *
* Tel:  (514) 340-6053 x6928                                                  *
* Email: Gilles.Couture@gerad.ca                                              *
* Fax: (514) 340-5665                                                         *
*                                                                             *
* This program is free software; you can redistribute it and/or               *
* modify it under the terms of the GNU General Public License                 *
* as published by the Free Software Foundation. You can find the              *
* GNU General Public License at:                                              *
*             http://www.gnu.org/copyleft/gpl.html                            *
*                                                                             *
* This program is distributed in the hope that it will be useful,             *
* but WITHOUT ANY WARRANTY; without even the implied warranty of              *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               *
* GNU General Public License for more details.                                *
*                                                                             *
* You should have received a copy of the GNU General Public License           *
* along with this program; if not, write to the Free Software                 *
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. *
*                                                                             *
* You can find information on the NOMAD software at:                          *
*             http://www.gerad.ca/NOMAD/                                      *
******************************************************************************/

// mainapplication.h -- class definition for MainApplication. It has public
// inheritance from the QWidget class.

#ifndef MAINAPPLICATION_H
#define MAINAPPLICATION_H
#include <qwidget.h>

class DescriptionWindow;
class ParameterWindow;
class PreferenceWindow;
class QAction;
class QGridLayout;
class QMenu;
class QMenuBar;
class ResultWindow;
class Solver;

// MainApplication inherits publicly from QWidget.
class MainApplication: public QWidget
{
private:
// The MainApplication object has the following variables:
// ****************************************************************************
  bool run_executed;
  DescriptionWindow * description_win;
  ParameterWindow * parameter_win;
  PreferenceWindow * preference_win;
  QAction * continue_act, * edit_act, * load_act, * new_act, * open_act,
    * preferences_act, * quit_act, * reset_act, * save_act, * save_as_act,
    * solve_act, * view_act;
  // An object of the QGridLayout class, "grid". The QGridLayout class lays
  // out widgets in a grid.
  QGridLayout * grid;
  QMenu * description_m, * parameter_m, * preferences_m, * results_m, * run_m;
  QMenuBar * menu;
  ResultWindow * result_win;
  Solver * solver;

  // The macro "Q_OBJECT" must be included in all classes that contain signals
  // and/or slots. The moc compiler must generate a moc file from the .cpp
  // file; this moc file will then be compiled normally.
  Q_OBJECT

  // The class methods are described in "mainapplication.cpp".
  void newRun();
  void solveProblem();

public:
  MainApplication(QWidget * parent, int argc, char * argv[]);
  ~MainApplication();

private slots:
  void continueRun();
  void editDescription();
  void editPreferences();
  void loadParameters();
  void newDescription();
  void openDescription();
  void parameterMenuAboutToShow();
  void quitProgram();
  void resetParameters();
  void runMenuAboutToShow();
  void save();
  void saveAs();
  void solve();
  void viewResults();
};
#endif
