SMIL  0.9.1
DGuiInstance.h
1 /*
2  * Copyright (c) 2011-2016, Matthieu FAESSEL and ARMINES
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of Matthieu FAESSEL, or ARMINES nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 
30 
31 #ifndef _D_GUI_INSTANCE_H
32 #define _D_GUI_INSTANCE_H
33 
34 #include "Core/include/private/DInstance.hpp"
35 #include "Core/include/private/DImage.hpp"
36 #include "private/DImageViewer.hpp"
37 
38 #ifdef USE_QT
39 #include "Gui/Qt/DQtImageViewer.hpp"
40 #include "Gui/Qt/DQtImageViewer.hxx"
41 #endif // USE_QT
42 
43 #ifdef USE_AALIB
44 #include "Gui/AALib/DAAImageViewer.hpp"
45 #endif // USE_AALIB
46 
47 
48 
49 namespace smil
50 {
56  template <class T>
57  class ImageViewer;
58 
59  class Gui;
60 
61 
65  class Gui : public UniqueInstance<Gui>
66  {
67  friend class UniqueInstance<Gui>;
68 
69  protected:
70  Gui () {}
71  virtual ~Gui () {}
72 
73  public:
74  // Public interface
75  // static void kill();
76 
77  static RES_T initialize();
81  static void execLoop();
82  static void processEvents();
83  static void showHelp();
84 
88  template <class T>
90  protected:
91  virtual void _execLoop() {}
92  virtual void _processEvents() {}
93  virtual void _showHelp() {}
94  private:
95  };
96 
97 
98  template <class T>
100  {
101  #ifdef USE_QT
102  return new QtImageViewer<T>(im);
103  #elif defined USE_AALIB
104  return new AaImageViewer<T>(im);
105  #else
106  return new ImageViewer<T>(im);
107  #endif
108  }
109 
112 } // namespace smil
113 
114 
115 
116 #endif // _D_GUI_INSTANCE_H
Qt image viewer.
Definition: DQtImageViewer.hpp:71
static void execLoop()
Run the event loop.
Definition: DGuiInstance.cpp:58
Definition: DColorConvert.h:38
Definition: DInstance.hpp:39
Base image viewer.
Definition: DBaseImage.h:45
Main Image class.
Definition: DQVtkViewer.hpp:44
AA (Ascii Art) image viewer.
Definition: DAAImageViewer.hpp:55
Gui module instance.
Definition: DGuiInstance.h:65
ImageViewer< T > * createDefaultViewer(Image< T > &im=NULL)
Create a default viewer for type T.
Definition: DGuiInstance.h:99