00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision$ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #ifndef QMITKEXTWORKBENCHWINDOWADVISOR_H_ 00019 #define QMITKEXTWORKBENCHWINDOWADVISOR_H_ 00020 00021 #include <berryWorkbenchWindowAdvisor.h> 00022 00023 #include <berryIPartListener.h> 00024 #include <berryIEditorPart.h> 00025 #include <berryIWorkbenchPage.h> 00026 #include <berryWorkbenchAdvisor.h> 00027 #include "mitkQtCommonExtDll.h" 00028 #include "QmitkCommonWorkbenchWindowAdvisor.h" 00029 00030 #include <QList> 00031 class QAction; 00032 class QMenu; 00033 00034 class MITK_QT_COMMON_EXT_EXPORT QmitkExtWorkbenchWindowAdvisor : public QmitkCommonWorkbenchWindowAdvisor 00035 { 00036 public: 00037 00038 QmitkExtWorkbenchWindowAdvisor(berry::WorkbenchAdvisor* wbAdvisor, 00039 berry::IWorkbenchWindowConfigurer::Pointer configurer); 00040 00041 berry::ActionBarAdvisor::Pointer CreateActionBarAdvisor( 00042 berry::IActionBarConfigurer::Pointer configurer); 00043 00044 void* CreateEmptyWindowContents(void* parent); 00045 00046 void PostWindowCreate(); 00047 00048 void PreWindowOpen(); 00049 00050 void ShowViewToolbar(bool show); 00051 00052 void ShowVersionInfo(bool show); 00053 00054 //TODO should be removed when product support is here 00055 void SetProductName(const std::string& product); 00056 void SetWindowIcon(const std::string& wndIcon); 00057 00058 void SetPerspectiveExcludeList(std::vector<std::string> v); 00059 std::vector<std::string> GetPerspectiveExcludeList(); 00060 00061 00062 00063 private: 00064 00070 void HookTitleUpdateListeners(berry::IWorkbenchWindowConfigurer::Pointer configurer); 00071 00072 std::string ComputeTitle(); 00073 00074 void RecomputeTitle(); 00075 00081 void UpdateTitle(bool editorHidden); 00082 00083 void PropertyChange(berry::Object::Pointer /*source*/, int propId); 00084 00085 berry::IPartListener::Pointer titlePartListener; 00086 berry::IPerspectiveListener::Pointer titlePerspectiveListener; 00087 berry::IPartListener::Pointer imageNavigatorPartListener; 00088 berry::IPropertyChangeListener::Pointer editorPropertyListener; 00089 friend struct berry::PropertyChangeIntAdapter<QmitkExtWorkbenchWindowAdvisor>; 00090 friend class PartListenerForTitle; 00091 friend class PerspectiveListenerForTitle; 00092 friend class PartListenerForImageNavigator; 00093 00094 berry::IEditorPart::WeakPtr lastActiveEditor; 00095 berry::IPerspectiveDescriptor::WeakPtr lastPerspective; 00096 berry::IWorkbenchPage::WeakPtr lastActivePage; 00097 std::string lastEditorTitle; 00098 berry::IAdaptable* lastInput; 00099 00100 berry::WorkbenchAdvisor* wbAdvisor; 00101 bool showViewToolbar; 00102 bool showVersionInfo; 00103 std::string productName; 00104 std::string windowIcon; 00105 00106 // stringlist for excluding perspectives from the perspective menu entry (e.g. Welcome Perspective) 00107 std::vector<std::string> perspectiveExcludeList; 00108 00109 // actions which will be enabled/disabled depending on the application state 00110 QList<QAction*> viewActions; 00111 QAction* fileSaveProjectAction; 00112 QAction* closeProjectAction; 00113 QAction* undoAction; 00114 QAction* redoAction; 00115 QAction* imageNavigatorAction; 00116 QAction* resetPerspAction; 00117 QAction* closePerspAction; 00118 }; 00119 00120 #endif /*QMITKEXTWORKBENCHWINDOWADVISOR_H_*/