00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef QSCLEGEND_H
00020 #define QSCLEGEND_H
00021
00022 #ifdef HAVE_CONFIG_H
00023 #include <config.h>
00024 #endif
00025
00026 #include"qscobject.h"
00027
00028
00029
00034 class QSCLegend : public QSCObject
00035 {
00036 Q_OBJECT
00037 Q_PROPERTY( int columns READ columns WRITE setColumns )
00038 Q_PROPERTY( int align READ align WRITE setAlign )
00039 Q_PROPERTY( double posX READ posX WRITE setPosX )
00040 Q_PROPERTY( double posY READ posY WRITE setPosY )
00041 Q_PROPERTY( double posZ READ posZ WRITE setPosZ )
00042 Q_PROPERTY( int coordX READ coordX WRITE setCoordX )
00043 Q_PROPERTY( int coordY READ coordY WRITE setCoordY )
00044 Q_PROPERTY( int coordZ READ coordZ WRITE setCoordZ )
00045 Q_PROPERTY( QString font READ fontProperty WRITE setFontProperty )
00046 Q_PROPERTY( QString fill READ fillProperty WRITE setFillProperty )
00047 Q_PROPERTY( QString frame READ frameProperty WRITE setFrameProperty )
00048 Q_PROPERTY( QString shadowFill READ shadowFillProperty WRITE setShadowFillProperty )
00049 Q_PROPERTY( int shadowPosX READ shadowPosX WRITE setShadowPosX )
00050 Q_PROPERTY( int shadowPosY READ shadowPosY WRITE setShadowPosY )
00051
00052 public:
00056 QSCLegend( QSAxes *parentAxes, QObject *parent=NULL );
00057 virtual ~QSCLegend();
00058 virtual int style() { return Moveable; }
00059 virtual void draw( QSDrv *drv, bool blocking=true, bool transparent=true );
00060 virtual void setBox( const QSRectf& r, QSDrv *drv );
00061 virtual QSRectf box( QSDrv *drv );
00062 virtual QString name();
00063
00064 void setColumns( int columns );
00065 int columns() const { return m_columns; }
00066 void setAlign( int align );
00067 int align() const { return m_align; }
00068 void setPos( const QSPt3f& pos );
00069 void setPosX( double value );
00070 void setPosY( double value );
00071 void setPosZ( double value );
00072 QSPt3f pos() const { return m_pos; }
00073 double posX() const { return m_pos.x; }
00074 double posY() const { return m_pos.y; }
00075 double posZ() const { return m_pos.z; }
00076 void setCoord( const QSPt3& coordSystem );
00077 void setCoordX( int coordSystem );
00078 void setCoordY( int coordSystem );
00079 void setCoordZ( int coordSystem );
00080 QSPt3 coord() const { return m_axis; }
00081 int coordX() const { return m_axis.x; }
00082 int coordY() const { return m_axis.y; }
00083 int coordZ() const { return m_axis.z; }
00084 void setFont( const QSGFont& font );
00085 void setFontProperty( const QString& data );
00086 QSGFont font() const { return m_font; }
00087 QString fontProperty() const { return toQString(m_font); }
00088 void setFill( const QSGFill& fill );
00089 void setFillProperty( const QString &data );
00090 QSGFill fill() const { return m_fill; }
00091 QString fillProperty() const { return toQString(m_fill); }
00092 void setFrame( const QSGLine& line );
00093 void setFrameProperty( const QString& data );
00094 QSGLine frame() const { return m_frame; }
00095 QString frameProperty() const { return toQString(m_frame); }
00096 void setShadowFill( const QSGFill& fill );
00097 void setShadowFillProperty( const QString& data );
00098 QSGFill shadowFill() const { return m_shadow_fill; }
00099 QString shadowFillProperty() const { return toQString(m_shadow_fill); }
00100 void setShadowPos( const QSPt2& shift );
00101 void setShadowPosX( int shift );
00102 void setShadowPosY( int shift );
00103 QSPt2 shadowPos() const { return m_shadow_pos; }
00104 int shadowPosX() const { return m_shadow_pos.x; }
00105 int shadowPosY() const { return m_shadow_pos.y; }
00106 virtual void loadStateFromStream( QDataStream& stream, QSObjectFactory *factory );
00107 virtual void saveStateToStream( QDataStream& stream, QSObjectFactory *factory );
00108
00109 protected:
00110 int m_columns;
00111 int m_align;
00112 QSPt3f m_pos;
00113 QSPt3 m_axis;
00114 QSGFont m_font;
00115 QSGFill m_fill;
00116 QSGLine m_frame;
00117 QSGFill m_shadow_fill;
00118 QSPt2 m_shadow_pos;
00119
00120 private:
00121 static const double frmSpace ;
00122 static const double rowSpace ;
00123 static const double colSpace ;
00124 void do_everything( QSDrv *drv, QSRectf& rect, double average_height, bool draw );
00125 double get_height( QSDrv *drv );
00126 };
00127
00128 #endif
00129