2012-01-14 00:16:16 +00:00
|
|
|
/* label_stack.h
|
|
|
|
*
|
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2012-06-28 22:56:06 +00:00
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2012-01-14 00:16:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LABEL_STACK_H
|
|
|
|
#define LABEL_STACK_H
|
|
|
|
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QStack>
|
2012-11-30 23:14:53 +00:00
|
|
|
#include <QTime>
|
|
|
|
#include <QTimer>
|
2012-01-14 00:16:16 +00:00
|
|
|
|
|
|
|
class LabelStack : public QLabel
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit LabelStack(QWidget *parent = 0);
|
2013-08-08 00:26:57 +00:00
|
|
|
void setTemporaryContext(const int ctx);
|
2015-03-04 16:12:58 +00:00
|
|
|
void pushText(const QString &text, int ctx);
|
|
|
|
void setShrinkable(bool shrinkable = true);
|
2012-01-14 00:16:16 +00:00
|
|
|
|
2012-12-30 19:33:05 +00:00
|
|
|
protected:
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
void mouseReleaseEvent(QMouseEvent *event);
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
|
|
|
void contextMenuEvent(QContextMenuEvent *event);
|
2015-03-04 16:12:58 +00:00
|
|
|
void paintEvent (QPaintEvent *event);
|
2012-12-30 19:33:05 +00:00
|
|
|
|
2012-01-14 00:16:16 +00:00
|
|
|
private:
|
|
|
|
typedef struct _StackItem {
|
|
|
|
QString text;
|
|
|
|
int ctx;
|
|
|
|
} StackItem;
|
|
|
|
|
2012-11-30 23:14:53 +00:00
|
|
|
int temporary_ctx_;
|
2014-10-27 01:48:14 +00:00
|
|
|
QList<StackItem> labels_;
|
2015-03-04 16:12:58 +00:00
|
|
|
bool shrinkable_;
|
2012-11-30 23:14:53 +00:00
|
|
|
QTime temporary_epoch_;
|
|
|
|
QTimer temporary_timer_;
|
2012-01-14 00:16:16 +00:00
|
|
|
|
|
|
|
void fillLabel();
|
|
|
|
|
|
|
|
signals:
|
2012-11-30 23:14:53 +00:00
|
|
|
void toggleTemporaryFlash(bool enable);
|
2012-12-30 19:33:05 +00:00
|
|
|
void mousePressedAt(const QPoint &global_pos, Qt::MouseButton button);
|
2012-01-14 00:16:16 +00:00
|
|
|
|
|
|
|
public slots:
|
|
|
|
void popText(int ctx);
|
|
|
|
|
|
|
|
private slots:
|
2012-11-30 23:14:53 +00:00
|
|
|
void updateTemporaryStatus();
|
2012-01-14 00:16:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // LABEL_STACK_H
|
2012-09-04 08:18:31 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|