Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
QmitkToolSelectionBox.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 QmitkToolSelectionBox_h_Included
14 #define QmitkToolSelectionBox_h_Included
15 
16 #include "QmitkToolGUIArea.h"
18 
19 #include "mitkToolManager.h"
20 
21 #include <QButtonGroup>
22 #include <QGridLayout>
23 #include <QWidget>
24 
25 #include <map>
26 
27 class QmitkToolGUI;
28 
52 {
53  Q_OBJECT
54 
55 public:
57  {
61  AlwaysEnabled
62  };
63 
64  QmitkToolSelectionBox(QWidget *parent = nullptr, mitk::DataStorage *storage = nullptr);
65  ~QmitkToolSelectionBox() override;
66 
67  mitk::ToolManager *GetToolManager();
68  void SetToolManager(mitk::ToolManager &); // no nullptr pointer allowed here, a manager is required
69 
70  void setTitle(const QString &title);
71 
79  void SetDisplayedToolGroups(const std::string &toolGroups = nullptr);
80 
81  void OnToolManagerToolModified();
82  void OnToolManagerReferenceDataModified();
83  void OnToolManagerWorkingDataModified();
84 
85  void OnToolGUIProcessEventsMessage();
86  void OnToolErrorMessage(std::string s);
87  void OnGeneralToolMessage(std::string s);
88 
89  void RecreateButtons();
90 
91 signals:
92 
98  void ToolSelected(int id);
99 
100 public slots:
101 
102  virtual void setEnabled(bool);
103  virtual void SetEnabledMode(EnabledMode mode);
104 
105  virtual void SetLayoutColumns(int);
106  virtual void SetShowNames(bool);
107  virtual void SetGenerateAccelerators(bool);
108 
109  virtual void SetToolGUIArea(QWidget *parentWidget);
110 
111 protected slots:
112 
113  void toolButtonClicked(int id);
114  void SetGUIEnabledAccordingToToolManagerState();
115 
116 protected:
117  void showEvent(QShowEvent *) override;
118  void hideEvent(QHideEvent *) override;
119 
120  void SetOrUnsetButtonForActiveTool();
121 
122  mitk::ToolManager::Pointer m_ToolManager;
123 
125 
126  std::string m_DisplayedGroups;
127 
129  std::map<int, int> m_ButtonIDForToolID;
131  std::map<int, int> m_ToolIDForButtonID;
132 
136 
137  QWidget *m_ToolGUIWidget;
139 
140  // store buttons in this group
141  QButtonGroup *m_ToolButtonGroup;
142  QGridLayout *m_ButtonLayout;
143 
145 };
146 
147 #endif
std::map< int, int > m_ToolIDForButtonID
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager ...
Data management class that handles &#39;was created by&#39; relations.
Display the tool selection state of a mitk::ToolManager.
mitk::ToolManager::Pointer m_ToolManager
Base class for GUIs belonging to mitk::Tool classes.
Definition: QmitkToolGUI.h:32
#define MITKSEGMENTATIONUI_EXPORT
std::map< int, int > m_ButtonIDForToolID
stores relationship between button IDs of the Qt widget and tool IDs of ToolManager ...
Manages and coordinates instances of mitk::Tool.