Qwt User's Guide 6.0.1

- Main Page
- Related Pages
- Classes
- Files

- File List

# qwt_symbol.h

    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_SYMBOL_H
    00011 #define QWT_SYMBOL_H
    00012
    00013 #include "qwt_global.h"
    00014 #include <QPolygonF>
    00015
    00016 class QPainter;
    00017 class QRect;
    00018 class QSize;
    00019 class QBrush;
    00020 class QPen;
    00021 class QColor;
    00022 class QPointF;
    00023
    00025 class QWT_EXPORT QwtSymbol
    00026 {
    00027 public:
    00032     enum Style
    00033     {
    00035         NoSymbol = -1,
    00036
    00038         Ellipse,
    00039
    00041         Rect,
    00042
    00044         Diamond,
    00045
    00047         Triangle,
    00048
    00050         DTriangle,
    00051
    00053         UTriangle,
    00054
    00056         LTriangle,
    00057
    00059         RTriangle,
    00060
    00062         Cross,
    00063
    00065         XCross,
    00066
    00068         HLine,
    00069
    00071         VLine,
    00072
    00074         Star1,
    00075
    00077         Star2,
    00078
    00080         Hexagon,
    00081
    00087         UserStyle = 1000
    00088     };
    00089
    00090 public:
    00091     QwtSymbol( Style = NoSymbol );
    00092     QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
    00093     QwtSymbol( const QwtSymbol & );
    00094     virtual ~QwtSymbol();
    00095
    00096     QwtSymbol &operator=( const QwtSymbol & );
    00097     bool operator==( const QwtSymbol & ) const;
    00098     bool operator!=( const QwtSymbol & ) const;
    00099
    00100     void setSize( const QSize & );
    00101     void setSize( int width, int height = -1 );
    00102     const QSize& size() const;
    00103
    00104     virtual void setColor( const QColor & );
    00105
    00106     void setBrush( const QBrush& b );
    00107     const QBrush& brush() const;
    00108
    00109     void setPen( const QPen & );
    00110     const QPen& pen() const;
    00111
    00112     void setStyle( Style );
    00113     Style style() const;
    00114
    00115     void drawSymbol( QPainter *, const QPointF & ) const;
    00116     void drawSymbols( QPainter *, const QPolygonF & ) const;
    00117
    00118     virtual QSize boundingSize() const;
    00119
    00120 protected:
    00121     virtual void drawSymbols( QPainter *,
    00122         const QPointF *, int numPoints ) const;
    00123
    00124 private:
    00125     class PrivateData;
    00126     PrivateData *d_data;
    00127 };
    00128
    00135 inline void QwtSymbol::drawSymbol(
    00136     QPainter *painter, const QPointF &pos ) const
    00137 {
    00138     drawSymbols( painter, &pos, 1 );
    00139 }
    00140
    00148 inline void QwtSymbol::drawSymbols(
    00149     QPainter *painter, const QPolygonF &points ) const
    00150 {
    00151     drawSymbols( painter, points.data(), points.size() );
    00152 }
    00153
    00154 #endif