/* -*- mode: c++; indent-tabs-mode: nil; -*-
 *
 * This file is part of the Mango recipe management distribution.
 * Copyright (c) 2000-2003, Roland Jesse
 * All rights reserved.
 *
 * For license and copyright information see the file COPYRIGHT or 
 * <http://www.opensource.org/licenses/bsd-license.html>.
 *
 * $Id: Mango.h,v 1.14 2003/09/18 11:59:04 rjesse Exp $
 */
 
#ifndef MANGO_H
#define MANGO_H

//#include "MangoForm.h"
#include <qextmdimainfrm.h>
#include <string>

class BusyWidget;
class QAction;
class QVBox;
class QWorkspace;

/**
 * This class is the base class for the Mango recipe management application.
 * It sets up the main window and provides a menubar, toolbar, and a statusbar.
 */
//class Mango : public MangoForm {
class Mango : public QextMdiMainFrm {
      Q_OBJECT
      typedef QextMdiMainFrm inherited;

   public:
      static Mango* getInstance();
      static void deleteInstance();
      QString activeStyle() const;
      int startupTimeout() const;

      QPixmap fromMimeSource( const QString&) const;

   public slots:
      void slotNew();
      void slotOpen();
      void slotPrint();
      void slotPrintPreview();
      void slotQuit();
	  void slotFind();
	  void slotAbout();
      void slotAboutQt();
      
	  void slotLoadPreferences();
	  void slotSavePreferences();
      void setStyle( const QString&);
      void setStartupTimeout( const int);
      void slotManageCookbooks();
      void slotOrganiseRecipes();
      void slotContinueFromLastTime();

      void setBusy( bool busy = true, const QString& message = QString::null);

   protected:
      Mango();
      ~Mango();
      virtual void closeEvent( QCloseEvent*);
      virtual void resizeEvent( QResizeEvent*);

   private slots:
      void slotPreferences();
      void slotOpen( const QString&);
      void slotClose();
      void slotHelpContents();

      void slotImportDialog();
      void slotImportFile();
      void slotImportRaw();
      
   private:
      /** Singleton. */
      static Mango* m_instance;

	  void initGuiActions();
      void initMenuBar();
      void initToolbars();
      void showStartupDialog();
      
      QAction* m_newAction;
      QAction* m_openAction;
      QAction* m_saveAction;
      QAction* m_saveAsAction;
      QAction* m_printAction;
      QAction* m_quitAction;
      QAction* m_undoAction;
      QAction* m_redoAction;
      QAction* m_copyAction;
      QAction* m_pasteAction;
      QAction* m_findAction;
      QAction* m_manageCookbooksAction;
      QAction* m_organiseRecipesAction;

      QAction* m_helpContentsAction;
      QAction* m_whatsThisAction;
      QAction* m_aboutAction;
      QAction* m_aboutQtAction;

      QToolBar* m_standardToolbar;
      BusyWidget* m_busy;
      QString m_activeStyle;
      int m_startupTimeout;
};
#endif // MANGO_H
