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_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 00031 class QWT_EXPORT QwtScaleDraw: public QwtAbstractScaleDraw 00032 { 00033 public: 00038 enum Alignment 00039 { 00041 BottomScale, 00042 00044 TopScale, 00045 00047 LeftScale, 00048 00050 RightScale 00051 }; 00052 00053 QwtScaleDraw(); 00054 virtual ~QwtScaleDraw(); 00055 00056 void getBorderDistHint( const QFont &, int &start, int &end ) const; 00057 int minLabelDist( const QFont & ) const; 00058 00059 int minLength( const QFont & ) const; 00060 virtual double extent( const QFont & ) const; 00061 00062 void move( double x, double y ); 00063 void move( const QPointF & ); 00064 void setLength( double length ); 00065 00066 Alignment alignment() const; 00067 void setAlignment( Alignment ); 00068 00069 Qt::Orientation orientation() const; 00070 00071 QPointF pos() const; 00072 double length() const; 00073 00074 void setLabelAlignment( Qt::Alignment ); 00075 Qt::Alignment labelAlignment() const; 00076 00077 void setLabelRotation( double rotation ); 00078 double labelRotation() const; 00079 00080 int maxLabelHeight( const QFont & ) const; 00081 int maxLabelWidth( const QFont & ) const; 00082 00083 QPointF labelPosition( double val ) const; 00084 00085 QRectF labelRect( const QFont &, double val ) const; 00086 QSizeF labelSize( const QFont &, double val ) const; 00087 00088 QRect boundingLabelRect( const QFont &, double val ) const; 00089 00090 protected: 00091 QTransform labelTransformation( const QPointF &, const QSizeF & ) const; 00092 00093 virtual void drawTick( QPainter *, double val, double len ) const; 00094 virtual void drawBackbone( QPainter * ) const; 00095 virtual void drawLabel( QPainter *, double val ) const; 00096 00097 private: 00098 QwtScaleDraw( const QwtScaleDraw & ); 00099 QwtScaleDraw &operator=( const QwtScaleDraw &other ); 00100 00101 void updateMap(); 00102 00103 class PrivateData; 00104 PrivateData *d_data; 00105 }; 00106 00115 inline void QwtScaleDraw::move( double x, double y ) 00116 { 00117 move( QPointF( x, y ) ); 00118 } 00119 00120 #endif