Qwt User's Guide
|
00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- ***************************** 00002 * Qwt Widget Library 00003 * Copyright (C) 1997 Josef Wilgen 00004 * Copyright (C) 2002 Uwe Rathmann 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the Qwt License, Version 1.0 00008 *****************************************************************************/ 00009 00010 #ifndef QWT_LEGEND_DATA_H 00011 #define QWT_LEGEND_DATA_H 00012 00013 #include "qwt_global.h" 00014 #include "qwt_text.h" 00015 #include "qwt_graphic.h" 00016 #include <qvariant.h> 00017 #include <qpixmap.h> 00018 #include <qmap.h> 00019 00035 class QWT_EXPORT QwtLegendData 00036 { 00037 public: 00039 enum Mode 00040 { 00042 ReadOnly, 00043 00045 Clickable, 00046 00048 Checkable 00049 }; 00050 00052 enum Role 00053 { 00054 // The value is a Mode 00055 ModeRole, 00056 00057 // The value is a title 00058 TitleRole, 00059 00060 // The value is an icon 00061 IconRole, 00062 00063 // Values < UserRole are reserved for internal use 00064 UserRole = 32 00065 }; 00066 00067 QwtLegendData(); 00068 ~QwtLegendData(); 00069 00070 void setValues( const QMap<int, QVariant> & ); 00071 const QMap<int, QVariant> &values() const; 00072 00073 void setValue( int role, const QVariant & ); 00074 QVariant value( int role ) const; 00075 00076 bool hasRole( int role ) const; 00077 bool isValid() const; 00078 00079 QwtGraphic icon() const; 00080 QwtText title() const; 00081 Mode mode() const; 00082 00083 private: 00084 QMap<int, QVariant> d_map; 00085 }; 00086 00087 #endif