Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
berryWindow.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef BERRYWINDOW_H_
18 #define BERRYWINDOW_H_
19 
21 
22 #include "berryIShellProvider.h"
23 #include "berryIShellListener.h"
24 
25 #include "internal/berryWindowManager.h"
27 
28 #include <berryMacros.h>
29 #include <vector>
30 
31 namespace berry
32 {
33 
34 //struct IToolBarManager;
35 
36 class MenuManager;
37 //class StatusLineManager;
38 
87 {
88 
89 public:
90 
92 
93 
99  static const int OK; // = 0;
100 
107  static const int CANCEL; // = 1;
108 
113  static QList<QIcon> defaultImages;
114 
119  struct IExceptionHandler: public Object
120  {
121 
123 
124 
130  virtual void HandleException(const std::exception& t) = 0;
131  };
132 
133 private:
134 
135  struct WindowShellListener : public IShellListener
136  {
137  WindowShellListener(Window* wnd);
138 
139  void ShellClosed(const ShellEvent::Pointer& event) override;
140 
141  private:
142  Window* window;
143  };
144 
145  QScopedPointer<IShellListener> windowShellListener;
146 
150  struct DefaultExceptionHandler: public IExceptionHandler
151  {
152  /*
153  * (non-Javadoc)
154  *
155  * @see org.blueberry.jface.window.Window.IExceptionHandler#handleException(java.lang.Throwable)
156  */
157  void HandleException(const std::exception& t) override;
158  };
159 
165  SmartPointer<MenuManager> menuBarManager;
166 
172  //SmartPointer<IToolBarManager> toolBarManager;
173 
179  //SmartPointer<StatusLineManager> statusLineManager;
180 
184  static IExceptionHandler::Pointer exceptionHandler;
185 
189  struct DefaultModalParent: public IShellProvider
190  {
191  Shell::Pointer GetShell() const override;
192  };
193 
194  friend struct DefaultModalParent;
195 
196  static IShellProvider::Pointer defaultModalParent;
197 
201  IShellProvider::Pointer parentShell;
202 
208  int shellStyle; // = Constants::SHELL_TRIM;
209 
215  WindowManager* windowManager;
216 
220  Shell::Pointer shell;
221 
225  QWidget* contents;
226 
232  int returnCode; // = OK;
233 
242  bool block; // = false;
243 
244  // /**
245  // * Internal class for informing this window when fonts change.
246  // */
247  // class FontChangeListener implements IPropertyChangeListener {
248  // public void propertyChange(PropertyChangeEvent event) {
249  // handleFontChange(event);
250  // }
251  // }
252 
253  // /**
254  // * Internal font change listener.
255  // */
256  // private FontChangeListener fontChangeListener;
257 
261  //bool resizeHasOccurred = false;
262 
263  //Listener resizeListener;
264 
265 
274  static Shell::Pointer GetModalChild(
275  const QList<Shell::Pointer>& toSearch);
276 
283  //void RunEventLoop();
284 
285 protected:
286 
299  Window(Shell::Pointer parentShell);
300 
308  Window(IShellProvider::Pointer shellProvider);
309 
310  ~Window();
311 
325  QRect GetConstrainedShellBounds(const QRect& preferredSize);
326 
330  virtual void Init();
331 
343  virtual bool CanHandleShellCloseEvent();
344 
355  virtual void ConfigureShell(Shell::Pointer newShell);
356 
362  //void ConstrainShellSize();
363 
388  virtual QWidget* CreateContents(Shell::Pointer parent);
389 
401  virtual Shell::Pointer CreateShell();
402 
410  virtual QWidget* GetContents();
411 
424  virtual QPoint GetInitialLocation(const QPoint& initialSize);
425 
433  virtual QPoint GetInitialSize();
434 
441  Shell::Pointer GetParentShell();
442 
456  virtual IShellListener* GetShellListener();
457 
468  int GetShellStyle();
469 
479  virtual void HandleShellCloseEvent();
480 
493  virtual void InitializeBounds();
494 
505  void SetParentShell(Shell::Pointer newParentShell);
506 
516  void SetReturnCode(int code);
517 
529  void SetShellStyle(int newShellStyle);
530 
536  void AddMenuBar();
537 
545  virtual SmartPointer<MenuManager> CreateMenuManager();
546 
552  virtual void CreateTrimWidgets(SmartPointer<Shell> shell);
553 
554 public:
555 
572  virtual bool Close();
573 
583  virtual void Create();
584 
593  static QIcon GetDefaultImage();
594 
606  static QList<QIcon> GetDefaultImages();
607 
615  int GetReturnCode();
616 
623  Shell::Pointer GetShell() const override;
624 
630  WindowManager* GetWindowManager();
631 
639  MenuManager* GetMenuBarManager() const;
640 
656  int Open();
657 
667  void SetBlockOnOpen(bool shouldBlock);
668 
677  static void SetDefaultImage(const QIcon& image);
678 
690  static void SetDefaultImages(const QList<QIcon>& images);
691 
702  void SetWindowManager(WindowManager* manager);
703 
714  static void SetExceptionHandler(IExceptionHandler::Pointer handler);
715 
724  static void SetDefaultModalParent(IShellProvider::Pointer provider);
725 
726 };
727 
728 }
729 
730 
731 #endif /* BERRYWINDOW_H_ */
static MsgHandler handler
Definition: usUtils.cpp:261
itk::SmartPointer< Self > Pointer
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:78
static const int CANCEL
Definition: berryWindow.h:107
#define OK
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:88
#define berryObjectMacro(...)
Definition: berryMacros.h:37
static QList< QIcon > defaultImages
Definition: berryWindow.h:113
section MAP_FRAME_Mapper_Settings Mapper settings For the mapping of corrected images
#define BERRY_UI_QT