Medical Imaging Interaction Toolkit  2016.11.0
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,
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 QmitkToolSelectionBox_h_Included
18 #define QmitkToolSelectionBox_h_Included
19 
20 #include "QmitkToolGUIArea.h"
22 
23 #include "mitkToolManager.h"
24 
25 #include <QButtonGroup>
26 #include <QGridLayout>
27 #include <QWidget>
28 
29 #include <map>
30 
31 class QmitkToolGUI;
32 
59 {
60  Q_OBJECT
61 
62 public:
64  {
68  AlwaysEnabled
69  };
70 
71  QmitkToolSelectionBox(QWidget *parent = 0, mitk::DataStorage *storage = 0);
72  virtual ~QmitkToolSelectionBox();
73 
74  mitk::ToolManager *GetToolManager();
75  void SetToolManager(mitk::ToolManager &); // no NULL pointer allowed here, a manager is required
76 
77  void setTitle(const QString &title);
78 
86  void SetDisplayedToolGroups(const std::string &toolGroups = 0);
87 
88  void OnToolManagerToolModified();
89  void OnToolManagerReferenceDataModified();
90  void OnToolManagerWorkingDataModified();
91 
92  void OnToolGUIProcessEventsMessage();
93  void OnToolErrorMessage(std::string s);
94  void OnGeneralToolMessage(std::string s);
95 
96  void RecreateButtons();
97 
98 signals:
99 
105  void ToolSelected(int id);
106 
107 public slots:
108 
109  virtual void setEnabled(bool);
110  virtual void SetEnabledMode(EnabledMode mode);
111 
112  virtual void SetLayoutColumns(int);
113  virtual void SetShowNames(bool);
114  virtual void SetGenerateAccelerators(bool);
115 
116  virtual void SetToolGUIArea(QWidget *parentWidget);
117 
118 protected slots:
119 
120  void toolButtonClicked(int id);
121  void SetGUIEnabledAccordingToToolManagerState();
122 
123 protected:
124  void showEvent(QShowEvent *) override;
125  void hideEvent(QHideEvent *) override;
126 
127  void SetOrUnsetButtonForActiveTool();
128 
130 
132 
133  std::string m_DisplayedGroups;
134 
136  std::map<int, int> m_ButtonIDForToolID;
138  std::map<int, int> m_ToolIDForButtonID;
139 
143 
144  QWidget *m_ToolGUIWidget;
146 
147  // store buttons in this group
148  QButtonGroup *m_ToolButtonGroup;
149  QGridLayout *m_ButtonLayout;
150 
152 };
153 
154 #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 'was created by' relations.
itk::SmartPointer< Self > Pointer
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:36
#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.