OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
panel_bar_widget_holder.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_GUI_PANEL_BAR_WIDGET_HOLDER_HH
20 #define OST_GUI_PANEL_BAR_WIDGET_HOLDER_HH
21 
22 
23 #include <ost/gui/module_config.hh>
24 
25 #include "panel_bar.hh"
26 
27 #include <QWidget>
28 #include <QMouseEvent>
29 class QToolBar;
30 class QAction;
31 
32 /*
33  Author: Marco Biasini
34  */
35 
36 namespace ost { namespace gui {
37 
38 class SideBar;
39 class Widget;
40 
41 class DLLEXPORT_OST_GUI PanelBarWidgetHolder : public QWidget {
42  Q_OBJECT
43 public:
44  PanelBarWidgetHolder(Widget* widget, Qt::Orientation orientation, QWidget* parent=NULL);
46 
47  void mousePressEvent(QMouseEvent *event);
48  void mouseMoveEvent(QMouseEvent *event);
49  void dragEnterEvent(QDragEnterEvent *event);
50  void dropEvent(QDropEvent *event);
51 
52 public slots:
53  void Remove();
54 public:
55  Widget* GetWidget() { return widget_; }
56  void SetWidget(Widget* widget);
57 private slots:
58  void LabelClick(bool checked);
59 private:
60  void SetupToolBar();
61  QToolBar* toolbar_;
62  Widget* widget_;
63  QAction* label_;
64  QPoint drag_start_pos_;
65 };
66 
67 }}
68 
69 
70 #endif
#define DLLEXPORT_OST_GUI
Base class for widgets.
Definition: widget.hh:40