OpenWalnut 1.3.1
|
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 * Constructor. 00058 * 00059 * \param argc number of arguments given on command line. 00060 * \param argv arguments given on command line. 00061 */ 00062 WGUI( int argc, char** argv ); 00063 00064 /** 00065 * Destructor. 00066 */ 00067 virtual ~WGUI(); 00068 00069 /** 00070 * Returns the init flag. 00071 * 00072 * \return Reference to the flag. 00073 */ 00074 virtual const WFlag< bool >& isInitialized() const; 00075 00076 /** 00077 * Runs the GUI. All initialization should be done here. 00078 * 00079 * \return the return code. 00080 */ 00081 virtual int run() = 0; 00082 00083 /** 00084 * Instruct to open a new custom widget. The specified condition should be the shutdown condition of the module, as the function returns only 00085 * if the widget was created. To ensure that the creation is aborted properly if the module shuts down in the meantime, this condition is 00086 * used. 00087 * 00088 * \note this function blocks until the widget was created. Check the resulting pointer for NULL. 00089 * 00090 * \param title the title of the widget 00091 * \param projectionMode the kind of projection which should be used 00092 * \param shutdownCondition a condition enforcing abort of widget creation. 00093 * 00094 * \return the created widget 00095 */ 00096 virtual WCustomWidget::SPtr openCustomWidget( 00097 std::string title, 00098 WGECamera::ProjectionMode projectionMode, 00099 boost::shared_ptr< WCondition > shutdownCondition ) = 0; 00100 00101 /** 00102 * Instruct to close a custom widget. 00103 * 00104 * \param title The title of the widget 00105 */ 00106 virtual void closeCustomWidget( std::string title ) = 0; 00107 00108 /** 00109 * Instruct to close the custom widget. 00110 * 00111 * \param widget the widget to close again. 00112 */ 00113 virtual void closeCustomWidget( WCustomWidget::SPtr widget ) = 0; 00114 00115 protected: 00116 /** 00117 * Flag determining whether the GUI is properly initialized. 00118 */ 00119 WFlag< bool > m_isInitialized; 00120 00121 /** 00122 * Number of command line arguments given. 00123 */ 00124 int m_argc; 00125 00126 /** 00127 * Command line arguments given. 00128 */ 00129 char** m_argv; 00130 }; 00131 00132 #endif // WGUI_H 00133