fw4spl
SSignalButton.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2015-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 <boost/filesystem/path.hpp>
16 
17 #include <QPointer>
18 #include <QPushButton>
19 
20 namespace guiQt
21 {
22 
23 namespace editor
24 {
25 
64 class GUIQT_CLASS_API SSignalButton : public QObject,
66 {
67 Q_OBJECT
68 public:
69 
71 
73  GUIQT_API SSignalButton() noexcept;
74 
76  GUIQT_API virtual ~SSignalButton() noexcept;
77 
78 protected:
79 
86  GUIQT_API virtual void starting() override;
87 
91  GUIQT_API virtual void stopping() override;
92 
96  GUIQT_API virtual void updating() override;
97 
99  GUIQT_API virtual void configuring() override;
100 
104  GUIQT_API virtual void info(std::ostream& _sstream ) override;
105 
107 
108 private Q_SLOTS:
109  void onClicked();
110  void onToggled(bool);
111 
112 private:
113 
118  typedef ::fwCom::Signal< void () > ClickedSignalType;
120  ClickedSignalType::sptr m_sigClicked;
121 
123  typedef ::fwCom::Signal< void (bool) > ToggledSignalType;
124  ToggledSignalType::sptr m_sigToggled;
133  void setChecked(bool checked);
139  QPointer <QPushButton> m_button;
140 
141  std::string m_text;
142  std::string m_text2;
143  ::boost::filesystem::path m_icon;
144  ::boost::filesystem::path m_icon2;
145  bool m_checkable;
146  bool m_checkAtStart;
147  unsigned int m_iconWidth;
148  unsigned int m_iconHeight;
149 };
150 
151 }
152 }
This editor shows a button and send a signal when it is clicked.
Namespace containing fw4spl communication tools.
Definition: DumpEditor.hpp:30
Defines the service interface managing the editor service for object.
Definition: IEditor.hpp:25
STL namespace.
#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