NorMIT-nav  16.5
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxMainWindowApplicationComponent.h
Go to the documentation of this file.
1 #ifndef CXMAINWINDOWAPPLICATIONCOMPONENT_H
2 #define CXMAINWINDOWAPPLICATIONCOMPONENT_H
3 
4 
5 /*=========================================================================
6 This file is part of CustusX, an Image Guided Therapy Application.
7 
8 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
9 All rights reserved.
10 
11 Redistribution and use in source and binary forms, with or without
12 modification, are permitted provided that the following conditions are met:
13 
14 1. Redistributions of source code must retain the above copyright notice,
15  this list of conditions and the following disclaimer.
16 
17 2. Redistributions in binary form must reproduce the above copyright notice,
18  this list of conditions and the following disclaimer in the documentation
19  and/or other materials provided with the distribution.
20 
21 3. Neither the name of the copyright holder nor the names of its contributors
22  may be used to endorse or promote products derived from this software
23  without specific prior written permission.
24 
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 =========================================================================*/
36 
37 #include "cxLogicManager.h"
38 #include "cxApplication.h"
39 
40 namespace cx
41 {
42 
47 template<class MAIN_WINDOW>
49 {
50 public:
51  virtual void create()
52  {
53  if (this->exists())
54  return;
55  mMainWindow = new MAIN_WINDOW;
57  }
58 
59  virtual bool exists() const
60  {
61  return mMainWindow != 0;
62  }
63 
64  virtual void destroy()
65  {
66  if (!this->exists())
67  return;
68 
69  delete mMainWindow;
70  }
71 
72 //private:
73  QPointer<MAIN_WINDOW> mMainWindow;
74 };
75 
76 } // namespace cx
77 
78 
79 #endif // CXMAINWINDOWAPPLICATIONCOMPONENT_H
void bringWindowToFront(QWidget *window)