fw4spl
SSelectionMenuButton.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2018.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #pragma once
8 
9 #include "guiQt/config.hpp"
10 
11 #include <fwGui/editor/IEditor.hpp>
12 
13 #include <fwTools/Failed.hpp>
14 
15 #include <QAction>
16 #include <QObject>
17 #include <QPointer>
18 
19 class QMenu;
20 class QActionGroup;
21 class QPushButton;
22 
23 namespace guiQt
24 {
25 
26 namespace editor
27 {
28 
67 class GUIQT_CLASS_API SSelectionMenuButton : public QObject,
69 {
70 
71 Q_OBJECT
72 
73 public:
74 
76 
78  GUIQT_API SSelectionMenuButton() noexcept;
79 
81  GUIQT_API virtual ~SSelectionMenuButton() noexcept;
82 
83 protected:
84 
85  typedef ::fwRuntime::ConfigurationElement::sptr Configuration;
86 
90  virtual void starting() override;
91 
95  virtual void stopping() override;
96 
98  virtual void updating() override;
99 
101  virtual void swapping() override;
102 
104  virtual void configuring() override;
105 
107  virtual void info( std::ostream& _sstream ) override;
108 
109 protected Q_SLOTS:
111  void onSelection(QAction* action);
112 
113 private:
114 
119  typedef ::fwCom::Signal< void (int) > SelectedSignalType;
121  SelectedSignalType::sptr m_sigSelected;
130  void setEnabled(bool enabled);
132 
134  void enable();
135 
137  void disable();
142  std::string m_text;
143  std::string m_toolTip;
144  typedef std::pair <int, std::string> ItemType;
145  typedef std::vector<ItemType> ItemContainerType;
146  ItemContainerType m_items;
147 
148  QPointer < QMenu > m_pDropDownMenu;
149  QPointer < QPushButton > m_dropDownButton;
150  QPointer < QActionGroup > m_actionGroup;
151 
152  int m_selection;
153 
154 };
155 
156 } // namespace editor
157 } // namespace guiQt
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
Defines the service interface managing the editor service for object.
Definition: IEditor.hpp:25
This service show a menu button. The user can select one item in the menu.
STL namespace.
The namespace fwRuntime contains classes to manage bundle, configuration element, extension point in ...
#define fwCoreServiceClassDefinitionsMacro(_classinfo_)
Generate common code for services classes.
The namespace guiQt contains the basic services to build the application IHM with Qt...
Definition: Code.hpp:21