fw4spl
IFrameLayoutManager.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "fwGui/config.hpp"
10 #include "fwGui/container/fwContainer.hpp"
11 #include "fwGui/GuiBaseObject.hpp"
12 
13 #include <fwData/Composite.hpp>
14 
15 #include <fwRuntime/ConfigurationElement.hpp>
16 
17 #include <boost/filesystem/path.hpp>
18 
19 #include <functional>
20 #include <list>
21 
22 namespace fwGui
23 {
24 namespace layoutManager
25 {
26 
30 class FWGUI_CLASS_API IFrameLayoutManager : public ::fwGui::GuiBaseObject
31 {
32 
33 public:
34 
36 
37  typedef ::fwRuntime::ConfigurationElement::sptr ConfigurationType;
38 
40  typedef enum
41  {
42  DEFAULT,
43  STAY_ON_TOP,
44  MODAL
45  } Style;
46 
47  typedef std::string RegistryKeyType;
48 
49  static const std::string SOFTWARE_UI;
50  static const std::string FRAME_STATE_UI;
51  static const std::string FRAME_SIZE_W_UI;
52  static const std::string FRAME_SIZE_H_UI;
53  static const std::string FRAME_POSITION_X_UI;
54  static const std::string FRAME_POSITION_Y_UI;
55 
56  typedef enum
57  {
61  FULL_SCREEN
62  } FrameState;
63 
64  class FrameInfo
65  {
66  public:
67 
68  FrameInfo() :
69  m_name(""),
70  m_minSize(std::make_pair(-1, -1)),
71  m_style(DEFAULT),
72  m_size(std::make_pair(-1, -1)),
73  m_position(std::make_pair(-1, -1)),
74  m_state(UNKNOWN)
75  {
76  }
77 
79  std::string m_name;
81  ::boost::filesystem::path m_iconPath;
83  std::pair< int, int > m_minSize;
85  Style m_style;
87  std::pair< int, int > m_size;
89  std::pair< int, int > m_position;
91  FrameState m_state;
92  };
93 
95  FWGUI_API IFrameLayoutManager();
96 
98  FWGUI_API virtual ~IFrameLayoutManager();
99 
103  FWGUI_API virtual void initialize( ConfigurationType configuration);
104 
105  FWGUI_API static const RegistryKeyType REGISTRY_KEY;
106 
110  FWGUI_API virtual void createFrame() = 0;
111 
115  FWGUI_API virtual void destroyFrame() = 0;
116 
118  virtual ::fwGui::container::fwContainer::sptr getFrame()
119  {
120  return m_frame;
121  }
122 
124  virtual ::fwGui::container::fwContainer::sptr getContainer()
125  {
126  return m_container;
127  }
128 
129  typedef std::function< void () > CloseCallback;
130  FWGUI_API virtual void setCloseCallback(CloseCallback fct);
131 
132 protected:
133 
137  const FrameInfo& getFrameInfo() const
138  {
139  return m_frameInfo;
140  }
141 
142  //------------------------------------------------------------------------------
143 
145  {
146  return m_frameInfo;
147  }
148 
149  //------------------------------------------------------------------------------
150 
151  void setFrameInfo(const FrameInfo& frameInfo)
152  {
153  m_frameInfo = frameInfo;
154  }
157  ::fwGui::container::fwContainer::sptr m_frame;
158  ::fwGui::container::fwContainer::sptr m_container;
159  CloseCallback m_closeCallback;
160 
161  FWGUI_API void readConfig();
162 
163  FWGUI_API void writeConfig();
164 
165  FWGUI_API ::fwData::Composite::sptr getPreferenceUI();
166 
167 private:
168 
169  void defaultCloseCallback();
170 
172  FrameInfo m_frameInfo;
173 
174 };
175 
176 } // namespace layoutManager
177 } // namespace fwGui
const FrameInfo & getFrameInfo() const
Configuration definition.
#define fwCoreNonInstanciableClassDefinitionsMacro(_classinfo_)
Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...)
void setFrameInfo(const FrameInfo &frameInfo)
Configuration definition.
The namespace fwGui contains the base interface for IHM services.
Definition: SJobBar.hpp:23
Style
Defines all possible style for a frame.
FrameInfo & getFrameInfo()
Configuration definition.
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
virtual ::fwGui::container::fwContainer::sptr getFrame()
Return the frame container.
std::pair< int, int > m_minSize
Frame minimum size (min width and min height)
std::pair< int, int > m_position
Frame position.
Base class for all fwGui&#39;s classes.
::boost::filesystem::path m_iconPath
Frame icon.
virtual ::fwGui::container::fwContainer::sptr getContainer()
Return the first container into the frame.
Defines an interface for managing a frame.
FrameState m_state
Frame state (maximize, minized, full screen)