Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryWorkbenchPart.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 __BERRY_WORKBENCH_PART_H__
18 #define __BERRY_WORKBENCH_PART_H__
19 
20 #include "berryIWorkbenchPart.h"
22 
25 
26 #include <QIcon>
27 
28 namespace berry {
29 
30 
45 class BERRY_UI_QT WorkbenchPart : public QObject,
46  public virtual IWorkbenchPart, public IExecutableExtension
47 {
48  Q_OBJECT
49  Q_INTERFACES(berry::IExecutableExtension);
50 
51 public:
53 
54  ~WorkbenchPart();
55 
56 private:
57  QString m_Title;
58  QIcon m_TitleImage;
59  QString m_ToolTip;
60 
61  IConfigurationElement::Pointer m_ConfigElement;
62  IWorkbenchPartSite::Pointer m_PartSite;
63  QString m_PartName;
64  QString m_ContentDescription;
65 
66  QHash<QString, QString> partProperties;
67  IPropertyChangeListener::Events partChangeEvents;
68 
69  void InternalSetContentDescription(const QString& description);
70  void InternalSetPartName(const QString& partName);
71 
72 protected:
73  WorkbenchPart();
74 
82  {
83  return m_ConfigElement;
84  }
85 
91 // protected Image getDefaultImage() {
92 // return PlatformUI.getWorkbench().getSharedImages().getImage(
93 // ISharedImages.IMG_DEF_VIEW);
94 // }
95 
104  void SetSite(IWorkbenchPartSite::Pointer site);
105 
112  virtual void CheckSite(IWorkbenchPartSite::Pointer site);
113 
119  virtual void SetTitleImage(const QIcon& titleImage);
120 
127  virtual void SetTitleToolTip(const QString& toolTip);
128 
136  virtual void SetPartName(const QString& partName);
137 
150  virtual void SetContentDescription(const QString& description);
151 
152  void FirePropertyChanged(const QString& key,
153  const QString& oldValue, const QString& newValue);
154 
155  void FirePropertyChange(int propertyId);
156 
157 public:
158 
159  /* (non-Javadoc)
160  * Method declared on IWorkbenchPart.
161  */
162  void AddPropertyListener(IPropertyChangeListener* l) override;
163 
164  void RemovePropertyListener(IPropertyChangeListener* l) override;
165 
166  void SetPartProperty(const QString& key, const QString& value) override;
167 
168  /* (non-Javadoc)
169  * @see org.blueberry.ui.IWorkbenchPart3#getPartProperty(java.lang.String)
170  */
171  QString GetPartProperty(const QString& key) const override;
172 
173  /* (non-Javadoc)
174  * @see org.blueberry.ui.IWorkbenchPart3#getPartProperties()
175  */
176  const QHash<QString, QString>& GetPartProperties() const override;
177 
189  void SetInitializationData(const IConfigurationElement::Pointer& cfig,
190  const QString& propertyName, const Object::Pointer& data) override;
191 
192  /*
193  * Creates the controls for this workbench part.
194  * <p>
195  * Subclasses must implement this method. For a detailed description of the
196  * requirements see <code>IWorkbenchPart</code>
197  * </p>
198  *
199  * @param parent the parent control
200  * @see IWorkbenchPart
201  */
202  virtual void CreatePartControl(QWidget* parent) override = 0;
203 
204  /* (non-Javadoc)
205  * Asks this part to take focus within the workbench.
206  * <p>
207  * Subclasses must implement this method. For a detailed description of the
208  * requirements see <code>IWorkbenchPart</code>
209  * </p>
210  *
211  * @see IWorkbenchPart
212  */
213  virtual void SetFocus() override = 0;
214 
215  /*
216  * Method declared on IWorkbenchPart.
217  */
218  IWorkbenchPartSite::Pointer GetSite() const override;
219 
227  QString GetPartName() const override;
228 
236  QString GetContentDescription() const override;
237 
238 
239  /* (non-Javadoc)
240  * Method declared on IWorkbenchPart.
241  */
242  QIcon GetTitleImage() const override;
243 
244  /* (non-Javadoc)
245  * Gets the title tool tip text of this part.
246  *
247  * @return the tool tip text
248  */
249  QString GetTitleToolTip() const override;
250 
251 };
252 
253 } // namespace berry
254 
255 #endif // __BERRY_WORKBENCH_PART_H__
256 
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:88
#define berryObjectMacro(...)
Definition: berryMacros.h:37
IConfigurationElement::Pointer GetConfigurationElement() const
#define BERRY_UI_QT