Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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 
89  void SetSite(IWorkbenchPartSite::Pointer site);
90 
97  virtual void CheckSite(IWorkbenchPartSite::Pointer site);
98 
104  virtual void SetTitleImage(const QIcon& titleImage);
105 
112  virtual void SetTitleToolTip(const QString& toolTip);
113 
121  virtual void SetPartName(const QString& partName);
122 
135  virtual void SetContentDescription(const QString& description);
136 
137  void FirePropertyChanged(const QString& key,
138  const QString& oldValue, const QString& newValue);
139 
140  void FirePropertyChange(int propertyId);
141 
142 public:
143 
144  /* (non-Javadoc)
145  * Method declared on IWorkbenchPart.
146  */
147  void AddPropertyListener(IPropertyChangeListener* l) override;
148 
149  void RemovePropertyListener(IPropertyChangeListener* l) override;
150 
151  void SetPartProperty(const QString& key, const QString& value) override;
152 
153  /* (non-Javadoc)
154  * @see org.blueberry.ui.IWorkbenchPart3#getPartProperty(java.lang.String)
155  */
156  QString GetPartProperty(const QString& key) const override;
157 
158  /* (non-Javadoc)
159  * @see org.blueberry.ui.IWorkbenchPart3#getPartProperties()
160  */
161  const QHash<QString, QString>& GetPartProperties() const override;
162 
174  void SetInitializationData(const IConfigurationElement::Pointer& cfig,
175  const QString& propertyName, const Object::Pointer& data) override;
176 
177  /*
178  * Creates the controls for this workbench part.
179  * <p>
180  * Subclasses must implement this method. For a detailed description of the
181  * requirements see <code>IWorkbenchPart</code>
182  * </p>
183  *
184  * @param parent the parent control
185  * @see IWorkbenchPart
186  */
187  void CreatePartControl(QWidget* parent) override = 0;
188 
189  /* (non-Javadoc)
190  * Asks this part to take focus within the workbench.
191  * <p>
192  * Subclasses must implement this method. For a detailed description of the
193  * requirements see <code>IWorkbenchPart</code>
194  * </p>
195  *
196  * @see IWorkbenchPart
197  */
198  void SetFocus() override = 0;
199 
200  /*
201  * Method declared on IWorkbenchPart.
202  */
203  IWorkbenchPartSite::Pointer GetSite() const override;
204 
212  QString GetPartName() const override;
213 
221  QString GetContentDescription() const override;
222 
223 
224  /* (non-Javadoc)
225  * Method declared on IWorkbenchPart.
226  */
227  QIcon GetTitleImage() const override;
228 
229  /* (non-Javadoc)
230  * Gets the title tool tip text of this part.
231  *
232  * @return the tool tip text
233  */
234  QString GetTitleToolTip() const override;
235 
236 };
237 
238 } // namespace berry
239 
240 #endif // __BERRY_WORKBENCH_PART_H__
241 
berry::IPropertyChangeListener
Definition: berryIPropertyChangeListener.h:42
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
berryIConfigurationElement.h
berryIWorkbenchPartSite.h
berryIExecutableExtension.h
BERRY_UI_QT
#define BERRY_UI_QT
Definition: org_blueberry_ui_qt_Export.h:26
berry::IWorkbenchPart
Definition: berryIWorkbenchPart.h:106
berry::WorkbenchPart
Definition: berryWorkbenchPart.h:40
berry::WorkbenchPart::GetConfigurationElement
IConfigurationElement::Pointer GetConfigurationElement() const
Definition: berryWorkbenchPart.h:76
berry::IExecutableExtension
Definition: berryIExecutableExtension.h:42
berryIWorkbenchPart.h
berryObjectMacro
#define berryObjectMacro(...)
Definition: berryMacros.h:31
berry
Definition: QmitkPropertyItemModel.h:24
berry::IPropertyChangeListener::Events
Definition: berryIPropertyChangeListener.h:47