WGUI.h

00001 //---------------------------------------------------------------------------
00002 //
00003 // Project: OpenWalnut ( http://www.openwalnut.org )
00004 //
00005 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
00006 // For more information see http://www.openwalnut.org/copying
00007 //
00008 // This file is part of OpenWalnut.
00009 //
00010 // OpenWalnut is free software: you can redistribute it and/or modify
00011 // it under the terms of the GNU Lesser General Public License as published by
00012 // the Free Software Foundation, either version 3 of the License, or
00013 // (at your option) any later version.
00014 //
00015 // OpenWalnut is distributed in the hope that it will be useful,
00016 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 // GNU Lesser General Public License for more details.
00019 //
00020 // You should have received a copy of the GNU Lesser General Public License
00021 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
00022 //
00023 //---------------------------------------------------------------------------
00024 
00025 #ifndef WGUI_H
00026 #define WGUI_H
00027 
00028 #include <string>
00029 #include <vector>
00030 
00031 #include <boost/shared_ptr.hpp>
00032 #include <boost/signals2/signal.hpp>
00033 
00034 #include "../common/WFlag.h"
00035 #include "../kernel/WModule.h"
00036 #include "../graphicsEngine/WGECamera.h"
00037 #include "WCustomWidget.h"
00038 
00039 class WDataSet;
00040 
00041 /**
00042  * This library implements the graphical user interface for OpenWalnut.
00043  *
00044  * \defgroup gui GUI
00045  */
00046 
00047 /**
00048  * This class prescribes the interface to the GUI. It basically is an abstract class defining the interface common to all possible
00049  * GUI implementations.
00050  *
00051  * \ingroup gui
00052  */
00053 class WGUI : public boost::enable_shared_from_this< WGUI >
00054 {
00055 public:
00056 
00057     /**
00058      * Constructor.
00059      *
00060      * \param argc number of arguments given on command line.
00061      * \param argv arguments given on command line.
00062      */
00063     WGUI( int argc, char** argv );
00064 
00065     /**
00066      * Destructor.
00067      */
00068     virtual ~WGUI();
00069 
00070     /**
00071      * Returns the init flag.
00072      *
00073      * \return Reference to the flag.
00074      */
00075     virtual const WFlag< bool >& isInitialized() const;
00076 
00077     /**
00078      * Runs the GUI. All initialization should be done here.
00079      *
00080      * \return the return code.
00081      */
00082     virtual int run() = 0;
00083 
00084     /**
00085      * Instruct the MainWindow to open a new custom widget.
00086      *
00087      * \param title the title of the widget
00088      * \param projectionMode the kind of projection which should be used
00089      * \param shutdownCondition condition to wait for the shutdown of a module
00090      * \return the created widget
00091      */
00092     virtual boost::shared_ptr< WCustomWidget > openCustomWidget( std::string title, WGECamera::ProjectionMode projectionMode,
00093         boost::shared_ptr< WCondition > shutdownCondition ) = 0;
00094 
00095     /**
00096      * Instruct the MainWindow to close a custom widget.
00097      *
00098      * \param title The title of the widget
00099      */
00100     virtual void closeCustomWidget( std::string title ) = 0;
00101 
00102 protected:
00103     /**
00104      * Flag determining whether the GUI is properly initialized.
00105      */
00106     WFlag< bool > m_isInitialized;
00107 
00108     /**
00109      * Number of command line arguments given.
00110      */
00111     int m_argc;
00112 
00113     /**
00114      * Command line arguments given.
00115      */
00116     char** m_argv;
00117 };
00118 
00119 #endif  // WGUI_H
00120 
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends