• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kig

ObjectDrawer Class Reference

#include <object_drawer.h>

List of all members.


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.

bool ObjectDrawer::inRect ( const ObjectImp &  imp,
const Rect &  r,
const KigWidget &  w 
) const

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

returns the color that the object will be drawn in

Definition at line 57 of file object_drawer.cc.

int ObjectDrawer::width (  )  const

return the width of the object

Definition at line 134 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.

int ObjectDrawer::pointStyle (  )  const

return pointStyle for points

Definition at line 144 of file object_drawer.cc.

QFont ObjectDrawer::font (  )  const

return the font

Definition at line 149 of file object_drawer.cc.

QString ObjectDrawer::pointStyleToString (  )  const

return pointStyle transformed in a string

Definition at line 184 of file object_drawer.cc.

QString ObjectDrawer::styleToString (  )  const

return style transformed in a string

Definition at line 215 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::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:
  • object_drawer.h
  • object_drawer.cc

kig

Skip menu "kig"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal