fw4spl
SlideBar.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2016-2017.
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 #ifndef __FWGUIQT_WIDGET_SLIDEBAR_HPP__
8 #define __FWGUIQT_WIDGET_SLIDEBAR_HPP__
9 
10 #include "fwGuiQt/config.hpp"
11 
12 #include <QApplication>
13 #include <QBoxLayout>
14 #include <QGroupBox>
15 #include <QWidget>
16 
17 namespace fwGuiQt
18 {
19 
20 namespace widget
21 {
22 
27 class FWGUIQT_CLASS_API SlideBar : public QGroupBox
28 {
29 Q_OBJECT
30 
31 public:
32 
33  enum Aligment
34  {
35  LEFT,
36  RIGHT,
37  TOP,
38  BOTTOM
39  };
40 
42  FWGUIQT_API SlideBar(QWidget* parent, Aligment align = LEFT, int buttonWidth = 200, double opacity = 0.8);
43 
45  FWGUIQT_API virtual ~SlideBar();
46 
48  FWGUIQT_API void updatePosition();
49 
51  FWGUIQT_API void setSide(Aligment align);
52 
54  bool isShown() const
55  {
56  return m_isShown;
57  }
58 
60  FWGUIQT_API virtual void setVisible(bool visible) override;
61 
62 protected:
64  bool eventFilter(QObject* obj, QEvent* event) override;
65 
66 private:
67 
69  void forceHide();
70 
72  void forceShow();
73 
75  void slide(bool visible);
76 
78  void init();
79 
80  QRect m_shownPosition;
81  QRect m_hiddenPosition;
82  int m_buttonSize;
83  double m_opacity;
84  bool m_isShown;
85  Aligment m_align;
86 
87 };
88 
89 } // namespace widget
90 } // namespace fwGuiQt
91 
92 #endif // __FWGUIQT_WIDGET_SLIDEBAR_HPP__
bool isShown() const
Return true if the widget is visible.
Definition: SlideBar.hpp:54
The namespace fwGuiQt contains classes which provide the implementation of the Gui using Qt library...
Definition: WindowLevel.hpp:32
This class allows to display a slide widget. The slide widget can be displayed over all the applicati...
Definition: SlideBar.hpp:27