Qwt User's Guide
svn
|
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_SCALE_DRAW_H 00011 #define QWT_SCALE_DRAW_H 00012 00013 #include "qwt_global.h" 00014 #include "qwt_abstract_scale_draw.h" 00015 #include <qpoint.h> 00016 #include <qrect.h> 00017 #include <qtransform.h> 00018 00032 class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw 00033 { 00034 public: 00039 enum Alignment 00040 { 00042 BottomScale, 00043 00045 TopScale, 00046 00048 LeftScale, 00049 00051 RightScale 00052 }; 00053 00054 QwtScaleDraw(); 00055 virtual ~QwtScaleDraw(); 00056 00057 void getBorderDistHint( const QFont &, int &start, int &end ) const; 00058 int minLabelDist( const QFont & ) const; 00059 00060 int minLength( const QFont & ) const; 00061 virtual double extent( const QFont & ) const; 00062 00063 void move( double x, double y ); 00064 void move( const QPointF & ); 00065 void setLength( double length ); 00066 00067 Alignment alignment() const; 00068 void setAlignment( Alignment ); 00069 00070 Qt::Orientation orientation() const; 00071 00072 QPointF pos() const; 00073 double length() const; 00074 00075 void setLabelAlignment( Qt::Alignment ); 00076 Qt::Alignment labelAlignment() const; 00077 00078 void setLabelRotation( double rotation ); 00079 double labelRotation() const; 00080 00081 int maxLabelHeight( const QFont & ) const; 00082 int maxLabelWidth( const QFont & ) const; 00083 00084 QPointF labelPosition( double val ) const; 00085 00086 QRectF labelRect( const QFont &, double val ) const; 00087 QSizeF labelSize( const QFont &, double val ) const; 00088 00089 QRect boundingLabelRect( const QFont &, double val ) const; 00090 00091 protected: 00092 QTransform labelTransformation( const QPointF &, const QSizeF & ) const; 00093 00094 virtual void drawTick( QPainter *, double val, double len ) const; 00095 virtual void drawBackbone( QPainter * ) const; 00096 virtual void drawLabel( QPainter *, double val ) const; 00097 00098 private: 00099 QwtScaleDraw( const QwtScaleDraw & ); 00100 QwtScaleDraw &operator=( const QwtScaleDraw &other ); 00101 00102 void updateMap(); 00103 00104 class PrivateData; 00105 PrivateData *d_data; 00106 }; 00107 00112 inline void QwtScaleDraw::move( double x, double y ) 00113 { 00114 move( QPointF( x, y ) ); 00115 } 00116 00117 #endif