kig
#include <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()) | |
QColor | color () const |
bool | contains (const ObjectImp &imp, const Coordinate &pt, const KigWidget &w, bool nv=false) const |
void | draw (const ObjectImp &imp, KigPainter &p, bool selected) const |
QFont | font () const |
ObjectDrawer * | getCopyColor (const QColor &c) const |
ObjectDrawer * | getCopyFont (const QFont &f) const |
ObjectDrawer * | getCopyPointStyle (int p) const |
ObjectDrawer * | getCopyShown (bool s) const |
ObjectDrawer * | getCopyStyle (Qt::PenStyle s) const |
ObjectDrawer * | getCopyWidth (int w) const |
bool | inRect (const ObjectImp &imp, const Rect &r, const KigWidget &w) const |
int | pointStyle () const |
QString | pointStyleToString () const |
bool | shown () const |
Qt::PenStyle | style () const |
QString | styleToString () const |
int | width () const |
Static Public Member Functions | |
static int | pointStyleFromString (const QString &style) |
static Qt::PenStyle | styleFromString (const QString &style) |
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.
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.
|
explicit |
Definition at line 154 of file object_drawer.cc.
Member Function Documentation
QColor ObjectDrawer::color | ( | ) | const |
returns the color that the object will be drawn in
Definition at line 57 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.
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.
QFont ObjectDrawer::font | ( | ) | const |
return the font
Definition at line 149 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::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.
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::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::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::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.
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.
int ObjectDrawer::pointStyle | ( | ) | const |
return pointStyle for points
Definition at line 144 of file object_drawer.cc.
|
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.
QString ObjectDrawer::pointStyleToString | ( | ) | const |
return pointStyle transformed in a string
Definition at line 184 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.
Qt::PenStyle ObjectDrawer::style | ( | ) | const |
return PenStyle for all objects except points
Definition at line 139 of file object_drawer.cc.
|
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.
QString ObjectDrawer::styleToString | ( | ) | const |
return style transformed in a string
Definition at line 215 of file object_drawer.cc.
int ObjectDrawer::width | ( | ) | const |
return the width of the object
Definition at line 134 of file object_drawer.cc.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:12:06 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.