//-*-C++-*-
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2000-2002 by Andreas Zehender
    email                : zehender@kde.org
**************************************************************************

**************************************************************************
*                                                                        *
*  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; either version 2 of the License, or     *
*  (at your option) any later version.                                   *
*                                                                        *
**************************************************************************/


#ifndef PMSHELL_H
#define PMSHELL_H

#include "pmdockwidget.h"

#include "pmpart.h"
#include "pmglview.h"
#include "version.h"

#include <qptrlist.h>

//class KHelpMenu;
class KStatusBar;
class KListAction;
class KToggleAction;
class KSelectAction;
class KRecentFilesAction;
class PMGLViewConnector;
class KActionMenu;

/**
 * Main view for KPovModeler
 */
class PMShell : public PMDockMainWindow
{
   Q_OBJECT

public:
   /** Standard constructor */
   PMShell( const KURL& = KURL( ) );
   /** Destructor */
   virtual ~PMShell( );

   /** Creates the actions */
   void setupActions( );
   /** Creates the docking views */
   void setupView( );

   /**
    * Checks if a file with that name exists and asks if
    * it should be overwritten.
    *
    * Returns true if the files is not a local file, the file does'n exist
    * or the file should be overwritten.
    */
   static bool overwriteURL( const KURL& u );

public slots:
   void openURL( const KURL& );
   void slotOpenRecent( const KURL& );
   void slotOpenRecentTimer( );
   
   void slotFileNew( );
   void slotFileOpen( );
   void slotFileSave( );
   void slotFileSaveAs( );
   void slotFileExportPovray( );
   void slotFileRevert( );
   void slotFilePrint( );
   void slotFileNewWindow( );
   void slotFileClose( );
   
   void slotShowToolbar( );
   void slotShowStatusbar( );
   void slotShowPath( );
   void slotConfigureKeys( );
   void slotConfigureToolbars( );
   void slotSettings( );
   void slotNewToolbarConfig( );

   void slotNewGraphicalView( PMGLView::PMViewType );
   void slotNewTopView( );
   void slotNewBottomView( );
   void slotNewLeftView( );
   void slotNewRightView( );
   void slotNewFrontView( );
   void slotNewBackView( );
   void slotNewCameraView( );
   void slotNewTreeView( );
   void slotNewDialogView( );
   
   void saveOptions( );
   void restoreOptions( );
   
   void setCaption( const QString& caption = QString::null );
   void statusMsg( const QString& text = QString::null );
   void slotControlPointMsg( const QString& msg = QString::null );

   void slotModified( );
   void slotDockWidgetClosed( );
   void slotDeleteClosedObjects( );
   void slotSelectedLayout( int id );
   void slotSaveViewLayout( );
   void slotViewsMenuAboutToShow( );
   
protected:
   virtual bool queryClose( );

public:
   PMDockWidget* createTreeView( );
   PMDockWidget* createDialogView( );
   PMDockWidget* create3DView( PMGLView::PMViewType );
   
private:
   KRecentFilesAction* m_pRecent;
   KToggleAction* m_pToolbarAction;
   KToggleAction* m_pStatusbarAction;
   KToggleAction* m_pPathAction;
   KAction* m_pExportPovrayAction;

   KAction* m_pNewTreeViewAction;
   KAction* m_pNewDialogViewAction;
   KAction* m_pNewTopViewAction;
   KAction* m_pNewBottomViewAction;
   KAction* m_pNewLeftViewAction;
   KAction* m_pNewRightViewAction;
   KAction* m_pNewFrontViewAction;
   KAction* m_pNewBackViewAction;
   KAction* m_pNewCameraViewAction;

   KActionMenu* m_pViewLayoutsAction;
   KAction* m_pSaveViewLayoutAction;

   KStatusBar* m_pStatusBar;
   PMPart* m_pPart;
   KURL m_openRecentURL;
   PMGLViewConnector* m_pGLConnector;

   QPtrList<QObject> m_objectsToDelete;
   int m_numGLViews, m_numTreeViews, m_numDialogViews;
};

#endif
