diff options
Diffstat (limited to 'ui/qt/widgets/label_stack.h')
-rw-r--r-- | ui/qt/widgets/label_stack.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/ui/qt/widgets/label_stack.h b/ui/qt/widgets/label_stack.h new file mode 100644 index 0000000..63657b7 --- /dev/null +++ b/ui/qt/widgets/label_stack.h @@ -0,0 +1,60 @@ +/** @file + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 1998 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef LABEL_STACK_H +#define LABEL_STACK_H + +#include <QLabel> +#include <QStack> +#include <QElapsedTimer> +#include <QTimer> + +class LabelStack : public QLabel +{ + Q_OBJECT +public: + explicit LabelStack(QWidget *parent = 0); + void setTemporaryContext(const int ctx); + void pushText(const QString &text, int ctx); + void setShrinkable(bool shrinkable = true); + +protected: + void mousePressEvent(QMouseEvent *event); + void mouseReleaseEvent(QMouseEvent *event); + void mouseDoubleClickEvent(QMouseEvent *event); + void mouseMoveEvent(QMouseEvent *event); + void contextMenuEvent(QContextMenuEvent *event); + void paintEvent (QPaintEvent *event); + +private: + typedef struct _StackItem { + QString text; + int ctx; + } StackItem; + + int temporary_ctx_; + QList<StackItem> labels_; + bool shrinkable_; + QElapsedTimer temporary_epoch_; + QTimer temporary_timer_; + + void fillLabel(); + +signals: + void toggleTemporaryFlash(bool enable); + void mousePressedAt(const QPoint &global_pos, Qt::MouseButton button); + +public slots: + void popText(int ctx); + +private slots: + void updateTemporaryStatus(); +}; + +#endif // LABEL_STACK_H |