OpenWalnut  1.4.0
WUI.h
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #ifndef WUI_H
26 #define WUI_H
27 
28 #include <string>
29 
30 #ifndef Q_MOC_RUN
31 #include <boost/shared_ptr.hpp>
32 #endif
33 
34 #include "../common/WFlag.h"
35 #include "../graphicsEngine/WGECamera.h"
36 #include "WCustomWidget.h"
37 
38 class WDataSet;
39 
40 /**
41  * This library implements the user interface for OpenWalnut.
42  *
43  * \defgroup ui UI
44  */
45 
46 /**
47  * This class prescribes the interface to the UI. It basically is an abstract class defining the interface common to all possible
48  * UI implementations.
49  *
50  * \ingroup ui
51  */
52 class WUI : public boost::enable_shared_from_this< WUI >
53 {
54 public:
55  /**
56  * Constructor.
57  *
58  * \param argc number of arguments given on command line.
59  * \param argv arguments given on command line.
60  */
61  WUI( int argc, char** argv );
62 
63  /**
64  * Destructor.
65  */
66  virtual ~WUI();
67 
68  /**
69  * Returns the init flag.
70  *
71  * \return Reference to the flag.
72  */
73  virtual const WFlag< bool >& isInitialized() const;
74 
75  /**
76  * Runs the UI. All initialization should be done here.
77  *
78  * \return the return code.
79  */
80  virtual int run() = 0;
81 
82  /**
83  * Instruct to open a new custom widget. The specified condition should be the shutdown condition of the module, as the function returns only
84  * if the widget was created. To ensure that the creation is aborted properly if the module shuts down in the meantime, this condition is
85  * used.
86  *
87  * \note this function blocks until the widget was created. Check the resulting pointer for NULL.
88  *
89  * \param title the title of the widget
90  * \param projectionMode the kind of projection which should be used
91  * \param shutdownCondition a condition enforcing abort of widget creation.
92  *
93  * \return the created widget
94  */
96  std::string title,
97  WGECamera::ProjectionMode projectionMode,
98  boost::shared_ptr< WCondition > shutdownCondition ) = 0;
99 
100  /**
101  * Instruct to close a custom widget.
102  *
103  * \param title The title of the widget
104  */
105  virtual void closeCustomWidget( std::string title ) = 0;
106 
107  /**
108  * Instruct to close the custom widget.
109  *
110  * \param widget the widget to close again.
111  */
112  virtual void closeCustomWidget( WCustomWidget::SPtr widget ) = 0;
113 
114 protected:
115  /**
116  * Flag determining whether the UI is properly initialized.
117  */
119 
120  /**
121  * Number of command line arguments given.
122  */
123  int m_argc;
124 
125  /**
126  * Command line arguments given.
127  */
128  char** m_argv;
129 };
130 
131 #endif // WUI_H
132 
virtual void closeCustomWidget(std::string title)=0
Instruct to close a custom widget.
This class prescribes the interface to the UI.
Definition: WUI.h:52
Base class for all data set types.
Definition: WDataSet.h:55
int m_argc
Number of command line arguments given.
Definition: WUI.h:123
virtual const WFlag< bool > & isInitialized() const
Returns the init flag.
Definition: WUI.cpp:41
ProjectionMode
List of possible camera modes.
Definition: WGECamera.h:43
char ** m_argv
Command line arguments given.
Definition: WUI.h:128
WFlag< bool > m_isInitialized
Flag determining whether the UI is properly initialized.
Definition: WUI.h:118
WUI(int argc, char **argv)
Constructor.
Definition: WUI.cpp:29
virtual int run()=0
Runs the UI.
virtual ~WUI()
Destructor.
Definition: WUI.cpp:37
virtual WCustomWidget::SPtr openCustomWidget(std::string title, WGECamera::ProjectionMode projectionMode, boost::shared_ptr< WCondition > shutdownCondition)=0
Instruct to open a new custom widget.
boost::shared_ptr< WCustomWidget > SPtr
Abbreviation for a shared pointer on a instance of this class.
Definition: WCustomWidget.h:72