Qwt User's Guide: qwt_symbol.h Source File

- Main Page
- Classes
- Files
- Related Pages

# 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 <qbrush.h>
    00014 #include <qpen.h>
    00015 #include <qsize.h>
    00016 #include "qwt_global.h"
    00017
    00018 class QPainter;
    00019 class QRect;
    00020
    00022 class QWT_EXPORT QwtSymbol
    00023 {
    00024 public:
    00029     enum Style
    00030     {
    00031         NoSymbol = -1,
    00032
    00033         Ellipse,
    00034         Rect,
    00035         Diamond,
    00036         Triangle,
    00037         DTriangle,
    00038         UTriangle,
    00039         LTriangle,
    00040         RTriangle,
    00041         Cross,
    00042         XCross,
    00043         HLine,
    00044         VLine,
    00045         Star1,
    00046         Star2,
    00047         Hexagon,
    00048
    00049         StyleCnt
    00050     };
    00051
    00052 public:
    00053     QwtSymbol();
    00054     QwtSymbol(Style st, const QBrush &bd, const QPen &pn, const QSize &s);
    00055     virtual ~QwtSymbol();
    00056
    00057     bool operator!=(const QwtSymbol &) const;
    00058     bool operator==(const QwtSymbol &) const;
    00059
    00060     void setSize(const QSize &s);
    00061     void setSize(int a, int b = -1);
    00062     void setBrush(const QBrush& b);
    00063     void setPen(const QPen &p);
    00064     void setStyle (Style s);
    00065
    00067     const QBrush& brush() const { return d_brush; }
    00069     const QPen& pen() const { return d_pen; }
    00071     const QSize& size() const { return d_size; }
    00073     Style style() const { return d_style; }
    00074
    00075     void draw(QPainter *p, const QPoint &pt) const;
    00076     void draw(QPainter *p, int x, int y) const;
    00077     virtual void draw(QPainter *p, const QRect &r) const;
    00078
    00079 private:
    00080     QBrush d_brush;
    00081     QPen d_pen;
    00082     QSize d_size;
    00083     Style d_style;
    00084 };
    00085
    00086 #endif