kig
ObjectDrawer Class Reference
#include <object_drawer.h>
Detailed Description
A class holding some information about how a certain object is drawn on the window.An ObjectDrawer is used by an ObjectHolder to keep information about how to draw an ObjectImp on the window. It is really nothing more than a struct with some convenience methods. It does not have any virtual methods, or have any complex semantics. It keeps information like the thickness of an object, its color, and whether or not it is hidden.
- Note:
- The default width of an object depends on its type. E.g. A point is by default drawn at width 5, a line at width 1. Therefore, there is a special width -1, which means "the default width for this object".
Definition at line 47 of file object_drawer.h.
Public Member Functions | |
| ObjectDrawer () | |
| ObjectDrawer (const QColor &color, int width=-1, bool shown=true, Qt::PenStyle=Qt::SolidLine, int pointStyle=0, const QFont &f=QFont()) | |
| void | draw (const ObjectImp &imp, KigPainter &p, bool selected) const |
| bool | contains (const ObjectImp &imp, const Coordinate &pt, const KigWidget &w, bool nv=false) const |
| bool | inRect (const ObjectImp &imp, const Rect &r, const KigWidget &w) const |
| bool | shown () const |
| QColor | color () const |
| int | width () const |
| Qt::PenStyle | style () const |
| int | pointStyle () const |
| QFont | font () const |
| QString | pointStyleToString () const |
| QString | styleToString () const |
| ObjectDrawer * | getCopyShown (bool s) const |
| ObjectDrawer * | getCopyColor (const QColor &c) const |
| ObjectDrawer * | getCopyWidth (int w) const |
| ObjectDrawer * | getCopyStyle (Qt::PenStyle s) const |
| ObjectDrawer * | getCopyPointStyle (int p) const |
| ObjectDrawer * | getCopyFont (const QFont &f) const |
Static Public Member Functions | |
| static int | pointStyleFromString (const QString &style) |
| static Qt::PenStyle | styleFromString (const QString &style) |
Constructor & Destructor Documentation
| ObjectDrawer::ObjectDrawer | ( | ) |
Construct a new ObjectDrawer with a default color ( Qt::blue ), width ( -1 ), shown state ( true ), PenStyle ( Qt::SolidLine ), pointstyle ( 0 ) and font ( default application font ).
Definition at line 159 of file object_drawer.cc.
| ObjectDrawer::ObjectDrawer | ( | const QColor & | color, | |
| int | width = -1, |
|||
| bool | shown = true, |
|||
| Qt::PenStyle | style = Qt::SolidLine, |
|||
| int | pointStyle = 0, |
|||
| const QFont & | f = QFont() | |||
| ) |
Definition at line 154 of file object_drawer.cc.
Member Function Documentation
| void ObjectDrawer::draw | ( | const ObjectImp & | imp, | |
| KigPainter & | p, | |||
| bool | selected | |||
| ) | const |
Draw the object imp on kigpainter p .
If selected is true, it is drawn in red, otherwise in its normal color.
Definition at line 29 of file object_drawer.cc.
| bool ObjectDrawer::contains | ( | const ObjectImp & | imp, | |
| const Coordinate & | pt, | |||
| const KigWidget & | w, | |||
| bool | nv = false | |||
| ) | const |
returns whether the object imp contains coordinate p .
This is dependent on whether it is shown ( when it will never contain anything ), and on its width.
Definition at line 46 of file object_drawer.cc.
returns whether the object imp is in the rectangle r .
This is dependent on whether it is shown and on its width.
Definition at line 164 of file object_drawer.cc.
| bool ObjectDrawer::shown | ( | ) | const |
returns whether the object this ObjectDrawer is responsible for will be drawn or not.
Definition at line 52 of file object_drawer.cc.
| QColor ObjectDrawer::color | ( | ) | const |
| int ObjectDrawer::width | ( | ) | const |
| Qt::PenStyle ObjectDrawer::style | ( | ) | const |
| int ObjectDrawer::pointStyle | ( | ) | const |
| QFont ObjectDrawer::font | ( | ) | const |
| QString ObjectDrawer::pointStyleToString | ( | ) | const |
| QString ObjectDrawer::styleToString | ( | ) | const |
| ObjectDrawer * ObjectDrawer::getCopyShown | ( | bool | s | ) | const |
returns a new ObjectDrawer that is identical to this one, except that the shown state is set to s
Definition at line 62 of file object_drawer.cc.
| ObjectDrawer * ObjectDrawer::getCopyColor | ( | const QColor & | c | ) | const |
returns a new ObjectDrawer that is identical to this one, except that the color is set to c
Definition at line 74 of file object_drawer.cc.
| ObjectDrawer * ObjectDrawer::getCopyWidth | ( | int | w | ) | const |
returns a new ObjectDrawer that is identical to this one, except that the width is set to w
Definition at line 86 of file object_drawer.cc.
| ObjectDrawer * ObjectDrawer::getCopyStyle | ( | Qt::PenStyle | s | ) | const |
returns a new ObjectDrawer that is identical to this one, except that the PenStyle state is set to s
Definition at line 98 of file object_drawer.cc.
| ObjectDrawer * ObjectDrawer::getCopyPointStyle | ( | int | p | ) | const |
returns a new ObjectDrawer that is identical to this one, except that the pointStyle state is set to p
Definition at line 110 of file object_drawer.cc.
| ObjectDrawer * ObjectDrawer::getCopyFont | ( | const QFont & | f | ) | const |
returns a new ObjectDrawer that is identical to this one, except that the font state is set to f
Definition at line 122 of file object_drawer.cc.
| int ObjectDrawer::pointStyleFromString | ( | const QString & | style | ) | [static] |
Note that this returns a valid point style in every case, even if the given style string is unknown.
In that case it returns a default value.
Definition at line 169 of file object_drawer.cc.
| Qt::PenStyle ObjectDrawer::styleFromString | ( | const QString & | style | ) | [static] |
Note that this returns a valid style in every case, even if the given style string is unknown.
In that case it returns a default value.
Definition at line 200 of file object_drawer.cc.
The documentation for this class was generated from the following files:
KDE 4.0 API Reference