OpenStructure
tabbed_panel_bar.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_TABBED_PANEL_BAR
20 #define OST_GUI_TABBED_PANEL_BAR
21 
22 
23 #include <ost/gui/module_config.hh>
24 #include <ost/gui/widget_pool.hh>
25 #include <ost/gui/widget.hh>
26 
28 #include "button_box.hh"
29 
30 #include <QHBoxLayout>
31 #include <QWidget>
32 #include <QString>
33 #include <QAction>
34 #include <QTabBar>
35 #include <QTabWidget>
36 #include <QToolBar>
37 namespace ost { namespace gui {
38 
40 class DLLEXPORT_OST_GUI DragTabBar : public QTabBar{
41  Q_OBJECT
42 public:
43  DragTabBar(QTabWidget* parent);
44 
45 protected:
46  void mousePressEvent(QMouseEvent *event);
47  void mouseMoveEvent(QMouseEvent *event);
48 
49 private:
50  QTabWidget* tab_widget_;
51  QPoint drag_start_pos_;
52 
53 };
54 
56 class DLLEXPORT_OST_GUI TabbedDragWidget : public QTabWidget{
57  Q_OBJECT
58 public:
59  TabbedDragWidget(QWidget* parent);
60 };
61 
64  Q_OBJECT
65 public:
68 
69  virtual bool Save(const QString& prefix);
70  virtual bool Restore(const QString& prefix);
71 
72  void WidgetMoved(Widget* widget, int position);
73  QString GetName();
74 
75 protected:
76  void dragEnterEvent(QDragEnterEvent *event);
77  void dropEvent(QDropEvent *event);
78 
79 private:
80  virtual void ShowWidget(Widget* widget, int pos, bool show);
81  QHBoxLayout* layout_;
82  QTabWidget* tab_widget_;
83  QToolBar* toolbar_;
84 
85 private slots:
86  void CurrentChanged(int index);
87 
88 };
89 
90 }}
91 
92 #endif
tabbed drag widget
DragTabBar(QTabWidget *parent)
void mousePressEvent(QMouseEvent *event)
void mouseMoveEvent(QMouseEvent *event)
Panel Bar which may contain other Widgets A PanelBar might have different ViewModes which are PanelWi...
Definition: panel_bar.hh:53
A PanelWidgetContainer can display various widgets A PanelWidgetContainer is a abstract class which i...
TabbedDragWidget(QWidget *parent)
virtual bool Save(const QString &prefix)
QString GetName()
Get readable name This method must return a QString which identifies this WidgetContainer....
void WidgetMoved(Widget *widget, int position)
move widget to given position Move the given widget to the index position.
void dropEvent(QDropEvent *event)
TabbedPanelBar(PanelBar *parent)
void dragEnterEvent(QDragEnterEvent *event)
virtual bool Restore(const QString &prefix)
Base class for widgets.
Definition: widget.hh:40
#define DLLEXPORT_OST_GUI
Definition: base.dox:1