NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
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) SINTEF Department of Medical Technology.
9 All rights reserved.
10 
11 CustusX is released under a BSD 3-Clause license.
12 
13 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
14 =========================================================================*/
15 
16 #include "cxLogicManager.h"
17 #include "cxApplication.h"
18 
19 namespace cx
20 {
21 
26 template<class MAIN_WINDOW>
28 {
29 public:
30  virtual void create()
31  {
32  if (this->exists())
33  return;
34  mMainWindow = new MAIN_WINDOW;
36  }
37 
38  virtual bool exists() const
39  {
40  return mMainWindow != 0;
41  }
42 
43  virtual void destroy()
44  {
45  if (!this->exists())
46  return;
47 
48  delete mMainWindow;
49  }
50 
51 //private:
52  QPointer<MAIN_WINDOW> mMainWindow;
53 };
54 
55 } // namespace cx
56 
57 
58 #endif // CXMAINWINDOWAPPLICATIONCOMPONENT_H
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::MainWindowApplicationComponent::exists
virtual bool exists() const
Definition: cxMainWindowApplicationComponent.h:38
cx::ApplicationComponent
Definition: cxLogicManager.h:45
cx::bringWindowToFront
void bringWindowToFront(QWidget *window)
Definition: cxApplication.cpp:99
cx::MainWindowApplicationComponent::mMainWindow
QPointer< MAIN_WINDOW > mMainWindow
Definition: cxMainWindowApplicationComponent.h:52
cxLogicManager.h
cx::MainWindowApplicationComponent::create
virtual void create()
Definition: cxMainWindowApplicationComponent.h:30
cx::MainWindowApplicationComponent::destroy
virtual void destroy()
Definition: cxMainWindowApplicationComponent.h:43
cxApplication.h
cx::MainWindowApplicationComponent
Definition: cxMainWindowApplicationComponent.h:27