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_PLOT_LEGEND_ITEM_H 00011 #define QWT_PLOT_LEGEND_ITEM_H 00012 00013 #include "qwt_global.h" 00014 #include "qwt_plot_item.h" 00015 #include "qwt_legend_data.h" 00016 00017 class QFont; 00018 00042 class QWT_EXPORT QwtPlotLegendItem: public QwtPlotItem 00043 { 00044 public: 00055 enum BackgroundMode 00056 { 00058 LegendBackground, 00059 00061 ItemBackground 00062 }; 00063 00064 explicit QwtPlotLegendItem(); 00065 virtual ~QwtPlotLegendItem(); 00066 00067 virtual int rtti() const; 00068 00069 void setAlignment( Qt::Alignment ); 00070 Qt::Alignment alignment() const; 00071 00072 void setMaxColumns( uint ); 00073 uint maxColumns() const; 00074 00075 void setMargin( int ); 00076 int margin() const; 00077 00078 void setSpacing( int ); 00079 int spacing() const; 00080 00081 void setItemMargin( int ); 00082 int itemMargin() const; 00083 00084 void setItemSpacing( int ); 00085 int itemSpacing() const; 00086 00087 void setFont( const QFont& ); 00088 QFont font() const; 00089 00090 void setBorderDistance( int numPixels ); 00091 int borderDistance() const; 00092 00093 void setBorderRadius( double ); 00094 double borderRadius() const; 00095 00096 void setBorderPen( const QPen & ); 00097 QPen borderPen() const; 00098 00099 void setBackgroundBrush( const QBrush & ); 00100 QBrush backgroundBrush() const; 00101 00102 void setBackgroundMode( BackgroundMode ); 00103 BackgroundMode backgroundMode() const; 00104 00105 void setTextPen( const QPen & ); 00106 QPen textPen() const; 00107 00108 virtual void draw( QPainter *p, 00109 const QwtScaleMap &xMap, const QwtScaleMap &yMap, 00110 const QRectF &rect ) const; 00111 00112 void clearLegend(); 00113 00114 virtual void updateLegend( const QwtPlotItem *, 00115 const QList<QwtLegendData> & ); 00116 00117 virtual QRect geometry( const QRectF &canvasRect ) const; 00118 00119 virtual QSize minimumSize( const QwtLegendData & ) const; 00120 virtual int heightForWidth( const QwtLegendData &, int w ) const; 00121 00122 QList< const QwtPlotItem * > plotItems() const; 00123 QList< QRect > legendGeometries( const QwtPlotItem * ) const; 00124 00125 protected: 00126 virtual void drawLegendData( QPainter *painter, 00127 const QwtPlotItem *, const QwtLegendData &, const QRectF & ) const; 00128 00129 virtual void drawBackground( QPainter *, const QRectF &rect ) const; 00130 00131 private: 00132 class PrivateData; 00133 PrivateData *d_data; 00134 }; 00135 00136 #endif