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