diff options
Diffstat (limited to 'src/libpcp_qed/src/qed_legend.h')
-rw-r--r-- | src/libpcp_qed/src/qed_legend.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/libpcp_qed/src/qed_legend.h b/src/libpcp_qed/src/qed_legend.h new file mode 100644 index 0000000..c70e872 --- /dev/null +++ b/src/libpcp_qed/src/qed_legend.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2013-2014, Red Hat. + * + * 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. + */ +#ifndef QED_LEGEND_H +#define QED_LEGEND_H + +#include <QtGui> + +class QedThreshold +{ +public: + QedThreshold(double value, const QColor &color) + { my.value = value; my.color = color; } + + double value() const { return my.value; } + QColor color() const { return my.color; } + +private: + struct { + double value; // maximum value for range + QColor color; + } my; +}; + +// Simple legend - a named list of value ranges, +// with colors associated with each value range. +// +class QedLegend : public QString +{ +public: + QedLegend(); + QedLegend(const char *legend); + const char *identity() const; + void setDefaultColor(const char *color); + void addThreshold(double value, const char *color); + void setThresholds(QStringList &tl); + +private: + struct { + QColor defaultColor; + QList<QedThreshold> thresholds; + } my; +}; + +#endif // QED_LEGEND_H |