Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
berryWindow.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef BERRYWINDOW_H_
14 #define BERRYWINDOW_H_
15 
17 
18 #include "berryIShellProvider.h"
19 #include "berryIShellListener.h"
20 
21 #include "internal/berryWindowManager.h"
23 
24 #include <berryMacros.h>
25 #include <vector>
26 
27 namespace berry
28 {
29 
30 //struct IToolBarManager;
31 
32 class MenuManager;
33 //class StatusLineManager;
34 
83 {
84 
85 public:
86 
88 
95  static const int OK; // = 0;
96 
103  static const int CANCEL; // = 1;
104 
109  static QList<QIcon> defaultImages;
110 
115  struct IExceptionHandler: public Object
116  {
117 
119 
126  virtual void HandleException(const std::exception& t) = 0;
127  };
128 
129 private:
130 
131  struct WindowShellListener : public IShellListener
132  {
133  WindowShellListener(Window* wnd);
134 
135  void ShellClosed(const ShellEvent::Pointer& event) override;
136 
137  private:
138  Window* window;
139  };
140 
141  QScopedPointer<IShellListener> windowShellListener;
142 
146  struct DefaultExceptionHandler: public IExceptionHandler
147  {
148  /*
149  * (non-Javadoc)
150  *
151  * @see org.blueberry.jface.window.Window.IExceptionHandler#handleException(java.lang.Throwable)
152  */
153  void HandleException(const std::exception& t) override;
154  };
155 
161  SmartPointer<MenuManager> menuBarManager;
162 
166  static IExceptionHandler::Pointer exceptionHandler;
167 
171  struct DefaultModalParent: public IShellProvider
172  {
173  Shell::Pointer GetShell() const override;
174  };
175 
176  friend struct DefaultModalParent;
177 
178  static IShellProvider::Pointer defaultModalParent;
179 
183  IShellProvider::Pointer parentShell;
184 
190  int shellStyle; // = Constants::SHELL_TRIM;
191 
197  WindowManager* windowManager;
198 
202  Shell::Pointer shell;
203 
207  QWidget* contents;
208 
214  int returnCode; // = OK;
215 
224  bool block; // = false;
225 
234  static Shell::Pointer GetModalChild(
235  const QList<Shell::Pointer>& toSearch);
236 
237 protected:
238 
250  Window(Shell::Pointer parentShell);
251 
259  Window(IShellProvider::Pointer shellProvider);
260 
261  ~Window() override;
262 
276  QRect GetConstrainedShellBounds(const QRect& preferredSize);
277 
281  virtual void Init();
282 
294  virtual bool CanHandleShellCloseEvent();
295 
306  virtual void ConfigureShell(Shell::Pointer newShell);
307 
332  virtual QWidget* CreateContents(Shell::Pointer parent);
333 
345  virtual Shell::Pointer CreateShell();
346 
354  virtual QWidget* GetContents();
355 
368  virtual QPoint GetInitialLocation(const QPoint& initialSize);
369 
377  virtual QPoint GetInitialSize();
378 
385  Shell::Pointer GetParentShell();
386 
400  virtual IShellListener* GetShellListener();
401 
412  int GetShellStyle();
413 
423  virtual void HandleShellCloseEvent();
424 
437  virtual void InitializeBounds();
438 
449  void SetParentShell(Shell::Pointer newParentShell);
450 
460  void SetReturnCode(int code);
461 
473  void SetShellStyle(int newShellStyle);
474 
480  void AddMenuBar();
481 
489  virtual SmartPointer<MenuManager> CreateMenuManager();
490 
496  virtual void CreateTrimWidgets(SmartPointer<Shell> shell);
497 
498 public:
499 
516  virtual bool Close();
517 
527  virtual void Create();
528 
537  static QIcon GetDefaultImage();
538 
550  static QList<QIcon> GetDefaultImages();
551 
559  int GetReturnCode();
560 
567  Shell::Pointer GetShell() const override;
568 
574  WindowManager* GetWindowManager();
575 
583  MenuManager* GetMenuBarManager() const;
584 
600  int Open();
601 
611  void SetBlockOnOpen(bool shouldBlock);
612 
621  static void SetDefaultImage(const QIcon& image);
622 
634  static void SetDefaultImages(const QList<QIcon>& images);
635 
646  void SetWindowManager(WindowManager* manager);
647 
658  static void SetExceptionHandler(IExceptionHandler::Pointer handler);
659 
668  static void SetDefaultModalParent(IShellProvider::Pointer provider);
669 
670 };
671 
672 }
673 
674 
675 #endif /* BERRYWINDOW_H_ */
berry::Window::defaultImages
static QList< QIcon > defaultImages
Definition: berryWindow.h:109
org_blueberry_ui_qt_Export.h
berry::IShellProvider
Definition: berryIShellProvider.h:32
berryIShellListener.h
berryMacros.h
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
berry::Window::CANCEL
static const int CANCEL
Definition: berryWindow.h:103
berry::Object
Light weight base class for most BlueBerry classes.
Definition: berryObject.h:72
berry::Window
Definition: berryWindow.h:82
berry::Window::OK
static const int OK
Definition: berryWindow.h:95
berryIShellProvider.h
berry::MenuManager
Definition: berryMenuManager.h:37
BERRY_UI_QT
#define BERRY_UI_QT
Definition: org_blueberry_ui_qt_Export.h:26
berry::Window::IExceptionHandler
Definition: berryWindow.h:115
berry::IShellListener
Definition: berryIShellListener.h:40
berry::Object::Pointer
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:82
berryObjectMacro
#define berryObjectMacro(...)
Definition: berryMacros.h:31
berryGuiWidgetsTweaklet.h
berry
Definition: QmitkPropertyItemModel.h:24