summaryrefslogtreecommitdiffstats
path: root/ui/qt/widgets/detachable_tabwidget.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /ui/qt/widgets/detachable_tabwidget.h
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/widgets/detachable_tabwidget.h')
-rw-r--r--ui/qt/widgets/detachable_tabwidget.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/ui/qt/widgets/detachable_tabwidget.h b/ui/qt/widgets/detachable_tabwidget.h
new file mode 100644
index 00000000..f5c4970d
--- /dev/null
+++ b/ui/qt/widgets/detachable_tabwidget.h
@@ -0,0 +1,89 @@
+/* @file
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef DETACHABLE_TABWIDGET_H
+#define DETACHABLE_TABWIDGET_H
+
+#include <wireshark.h>
+
+#include <QTabWidget>
+#include <QDialog>
+#include <QEvent>
+#include <QCloseEvent>
+#include <QTabBar>
+#include <QPoint>
+#include <QCursor>
+
+class DetachableTabWidget : public QTabWidget
+{
+ Q_OBJECT
+public:
+ DetachableTabWidget(QWidget * parent = nullptr);
+
+ QString tabBasename() const;
+
+protected:
+
+ void setTabBasename(QString newName);
+
+protected slots:
+
+ virtual void moveTab(int from, int to);
+ virtual void detachTab(int tabIdx, QPoint pos);
+ virtual void attachTab(QWidget * content, QString name);
+
+private:
+ QString _tabBasename;
+
+};
+
+class ToolDialog : public QDialog
+{
+ Q_OBJECT
+public:
+ explicit ToolDialog(QWidget * _contentWidget, QWidget * parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
+
+protected:
+
+ virtual bool event(QEvent *event);
+ virtual void closeEvent(QCloseEvent *event);
+
+signals:
+ void onCloseSignal(QWidget * contentWidget, QString name);
+
+private:
+ QWidget * _contentWidget;
+};
+
+class DragDropTabBar : public QTabBar
+{
+ Q_OBJECT
+public:
+ explicit DragDropTabBar(QWidget * parent);
+
+signals:
+ void onDetachTab(int tabIdx, QPoint pos);
+ void onMoveTab(int oldIdx, int newIdx);
+
+protected:
+ virtual void mouseDoubleClickEvent(QMouseEvent *event);
+ virtual void mousePressEvent(QMouseEvent *event);
+ virtual void mouseMoveEvent(QMouseEvent *event);
+ virtual void dragEnterEvent(QDragEnterEvent *event);
+ virtual void dropEvent(QDropEvent *event);
+
+private:
+ QPoint _dragStartPos;
+ QPoint _dragDropPos;
+ QCursor _mouseCursor;
+ bool _dragInitiated;
+
+};
+
+#endif // DETACHABLE_TABWIDGET_H