Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
berryWorkbenchPart.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 __BERRY_WORKBENCH_PART_H__
14 #define __BERRY_WORKBENCH_PART_H__
15 
16 #include "berryIWorkbenchPart.h"
18 
21 
22 #include <QIcon>
23 
24 namespace berry {
25 
26 
41 class BERRY_UI_QT WorkbenchPart : public QObject,
42  public virtual IWorkbenchPart, public IExecutableExtension
43 {
44  Q_OBJECT
45  Q_INTERFACES(berry::IExecutableExtension);
46 
47 public:
49 
50  ~WorkbenchPart() override;
51 
52 private:
53  QString m_Title;
54  QIcon m_TitleImage;
55  QString m_ToolTip;
56 
57  IConfigurationElement::Pointer m_ConfigElement;
58  IWorkbenchPartSite::Pointer m_PartSite;
59  QString m_PartName;
60  QString m_ContentDescription;
61 
62  QHash<QString, QString> partProperties;
63  IPropertyChangeListener::Events partChangeEvents;
64 
65  void InternalSetContentDescription(const QString& description);
66  void InternalSetPartName(const QString& partName);
67 
68 protected:
69  WorkbenchPart();
70 
78  {
79  return m_ConfigElement;
80  }
81 
87 // protected Image getDefaultImage() {
88 // return PlatformUI.getWorkbench().getSharedImages().getImage(
89 // ISharedImages.IMG_DEF_VIEW);
90 // }
91 
100  void SetSite(IWorkbenchPartSite::Pointer site);
101 
108  virtual void CheckSite(IWorkbenchPartSite::Pointer site);
109 
115  virtual void SetTitleImage(const QIcon& titleImage);
116 
123  virtual void SetTitleToolTip(const QString& toolTip);
124 
132  virtual void SetPartName(const QString& partName);
133 
146  virtual void SetContentDescription(const QString& description);
147 
148  void FirePropertyChanged(const QString& key,
149  const QString& oldValue, const QString& newValue);
150 
151  void FirePropertyChange(int propertyId);
152 
153 public:
154 
155  /* (non-Javadoc)
156  * Method declared on IWorkbenchPart.
157  */
158  void AddPropertyListener(IPropertyChangeListener* l) override;
159 
160  void RemovePropertyListener(IPropertyChangeListener* l) override;
161 
162  void SetPartProperty(const QString& key, const QString& value) override;
163 
164  /* (non-Javadoc)
165  * @see org.blueberry.ui.IWorkbenchPart3#getPartProperty(java.lang.String)
166  */
167  QString GetPartProperty(const QString& key) const override;
168 
169  /* (non-Javadoc)
170  * @see org.blueberry.ui.IWorkbenchPart3#getPartProperties()
171  */
172  const QHash<QString, QString>& GetPartProperties() const override;
173 
185  void SetInitializationData(const IConfigurationElement::Pointer& cfig,
186  const QString& propertyName, const Object::Pointer& data) override;
187 
188  /*
189  * Creates the controls for this workbench part.
190  * <p>
191  * Subclasses must implement this method. For a detailed description of the
192  * requirements see <code>IWorkbenchPart</code>
193  * </p>
194  *
195  * @param parent the parent control
196  * @see IWorkbenchPart
197  */
198  void CreatePartControl(QWidget* parent) override = 0;
199 
200  /* (non-Javadoc)
201  * Asks this part to take focus within the workbench.
202  * <p>
203  * Subclasses must implement this method. For a detailed description of the
204  * requirements see <code>IWorkbenchPart</code>
205  * </p>
206  *
207  * @see IWorkbenchPart
208  */
209  void SetFocus() override = 0;
210 
211  /*
212  * Method declared on IWorkbenchPart.
213  */
214  IWorkbenchPartSite::Pointer GetSite() const override;
215 
223  QString GetPartName() const override;
224 
232  QString GetContentDescription() const override;
233 
234 
235  /* (non-Javadoc)
236  * Method declared on IWorkbenchPart.
237  */
238  QIcon GetTitleImage() const override;
239 
240  /* (non-Javadoc)
241  * Gets the title tool tip text of this part.
242  *
243  * @return the tool tip text
244  */
245  QString GetTitleToolTip() const override;
246 
247 };
248 
249 } // namespace berry
250 
251 #endif // __BERRY_WORKBENCH_PART_H__
252 
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:82
#define berryObjectMacro(...)
Definition: berryMacros.h:33
IConfigurationElement::Pointer GetConfigurationElement() const
#define BERRY_UI_QT