OpenWalnut  1.5.0dev
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 <memory>
29 
30 
31 #include "../common/WFlag.h"
32 #include "WUIRequirement.h"
33 #include "WUIViewEventHandler.h"
34 #include "WUIWidgetFactory.h"
35 
36 class WDataSet;
37 
38 /**
39  * This library implements the user interface for OpenWalnut.
40  *
41  * \defgroup ui UI
42  */
43 
44 /**
45  * This class prescribes the interface to the UI. It basically is an abstract class defining the interface common to all possible
46  * UI implementations.
47  *
48  * \ingroup ui
49  */
50 class WUI: public std::enable_shared_from_this< WUI >
51 {
52 public:
53  /**
54  * Constructor.
55  *
56  * \param argc number of arguments given on command line.
57  * \param argv arguments given on command line.
58  */
59  WUI( int argc, char** argv );
60 
61  /**
62  * Destructor.
63  */
64  virtual ~WUI();
65 
66  /**
67  * Returns the init flag.
68  *
69  * \return Reference to the flag.
70  */
71  virtual const WFlag< bool >& isInitialized() const;
72 
73  /**
74  * Runs the UI. All initialization should be done here.
75  *
76  * \return the return code.
77  */
78  virtual int run() = 0;
79 
80  /**
81  * Returns the widget factory of the UI. Use it to create custom widgets.
82  *
83  * \return the factory. Use this to create your widget instances.
84  */
86 protected:
87  /**
88  * Flag determining whether the UI is properly initialized.
89  */
91 
92  /**
93  * Number of command line arguments given.
94  */
95  int m_argc;
96 
97  /**
98  * Command line arguments given.
99  */
100  char** m_argv;
101 };
102 
103 #endif // WUI_H
104 
Base class for all data set types.
Definition: WDataSet.h:50
std::shared_ptr< WUIWidgetFactory > SPtr
Convenience typedef for a std::shared_ptr< WUIWidgetFactory >.
This class prescribes the interface to the UI.
Definition: WUI.h:51
virtual WUIWidgetFactory::SPtr getWidgetFactory() const =0
Returns the widget factory of the UI.
virtual int run()=0
Runs the UI.
char ** m_argv
Command line arguments given.
Definition: WUI.h:100
virtual ~WUI()
Destructor.
Definition: WUI.cpp:37
WFlag< bool > m_isInitialized
Flag determining whether the UI is properly initialized.
Definition: WUI.h:90
virtual const WFlag< bool > & isInitialized() const
Returns the init flag.
Definition: WUI.cpp:41
WUI(int argc, char **argv)
Constructor.
Definition: WUI.cpp:29
int m_argc
Number of command line arguments given.
Definition: WUI.h:95