libkdegames
KGameCanvasItem Class Reference
#include <kgamecanvas.h>

Detailed Description
An abstract item.A KGameCanvasItem is an abstract class to represent a generic item that can be put in a canvas.
Definition at line 109 of file kgamecanvas.h.
Public Member Functions | |
| KGameCanvasItem (KGameCanvasAbstract *canvas=NULL) | |
| virtual | ~KGameCanvasItem () |
| virtual void | changed () |
| bool | visible () const |
| void | setVisible (bool v) |
| bool | animated () const |
| void | setAnimated (bool a) |
| int | opacity () const |
| void | setOpacity (int o) |
| void | hide () |
| void | show () |
| void | raise () |
| void | lower () |
| void | stackOver (KGameCanvasItem *ref) |
| void | stackUnder (KGameCanvasItem *ref) |
| KGameCanvasAbstract * | canvas () const |
| KGameCanvasWidget * | topLevelCanvas () const |
| void | putInCanvas (KGameCanvasAbstract *canvas) |
| QPoint | pos () const |
| QPoint | absolutePosition () const |
| void | moveTo (const QPoint &newpos) |
| void | moveTo (int x, int y) |
| virtual void | paint (QPainter *p)=0 |
| virtual QRect | rect () const =0 |
| virtual bool | layered () const |
| virtual void | advance (int msecs) |
Friends | |
| class | KGameCanvasAbstract |
| class | KGameCanvasWidget |
| class | KGameCanvasGroup |
| class | KGameCanvasAdapter |
Constructor & Destructor Documentation
| KGameCanvasItem::KGameCanvasItem | ( | KGameCanvasAbstract * | canvas = NULL |
) |
Constructor, it allows you to specify the reference canvas or to create an orphan item that will be put into a canvas in a second moment.
The item is always hidden after being created. Note that the restacking functions are quite intelligent and will only repaint if there is an actual need of doing it. So if you call raise on an item that is already (locally) on the top, no redraw will take place
Definition at line 234 of file kgamecanvas.cpp.
| KGameCanvasItem::~KGameCanvasItem | ( | ) | [virtual] |
Definition at line 244 of file kgamecanvas.cpp.
Member Function Documentation
| void KGameCanvasItem::changed | ( | ) | [virtual] |
| bool KGameCanvasItem::visible | ( | ) | const [inline] |
| void KGameCanvasItem::setVisible | ( | bool | v | ) |
| bool KGameCanvasItem::animated | ( | ) | const [inline] |
| void KGameCanvasItem::setAnimated | ( | bool | a | ) |
| int KGameCanvasItem::opacity | ( | ) | const [inline] |
| void KGameCanvasItem::setOpacity | ( | int | o | ) |
| void KGameCanvasItem::hide | ( | ) | [inline] |
| void KGameCanvasItem::show | ( | ) | [inline] |
| void KGameCanvasItem::raise | ( | ) |
| void KGameCanvasItem::lower | ( | ) |
| void KGameCanvasItem::stackOver | ( | KGameCanvasItem * | ref | ) |
| void KGameCanvasItem::stackUnder | ( | KGameCanvasItem * | ref | ) |
| KGameCanvasAbstract* KGameCanvasItem::canvas | ( | ) | const [inline] |
Returns the canvas that is actually "owning" the item.
Definition at line 187 of file kgamecanvas.h.
| KGameCanvasWidget* KGameCanvasItem::topLevelCanvas | ( | ) | const [inline] |
| void KGameCanvasItem::putInCanvas | ( | KGameCanvasAbstract * | canvas | ) |
Lets you specify the owning canvas.
Call this function with canvas set to NULL to remove the item from the current canvas.
Definition at line 336 of file kgamecanvas.cpp.
| QPoint KGameCanvasItem::pos | ( | ) | const [inline] |
| QPoint KGameCanvasItem::absolutePosition | ( | ) | const |
- Returns:
- Position of the item relative to the top level canvas.
Definition at line 507 of file kgamecanvas.cpp.
| void KGameCanvasItem::moveTo | ( | const QPoint & | newpos | ) |
Sets a new position.
Note that an update will be posted to the parent canvas, and if you move an item twice in very little time, a region bigger than needed will be updated, causing a possible inefficiency
Definition at line 498 of file kgamecanvas.cpp.
| void KGameCanvasItem::moveTo | ( | int | x, | |
| int | y | |||
| ) | [inline] |
| virtual void KGameCanvasItem::paint | ( | QPainter * | p | ) | [pure virtual] |
Override this function to draw the item with the painter.
Implemented in KGameCanvasDummy, KGameCanvasGroup, KGameCanvasPicture, KGameCanvasPixmap, KGameCanvasTiledPixmap, KGameCanvasRectangle, and KGameCanvasText.
| virtual QRect KGameCanvasItem::rect | ( | ) | const [pure virtual] |
Override this function to return the rect the item will be drawn into.
Implemented in KGameCanvasDummy, KGameCanvasGroup, KGameCanvasPicture, KGameCanvasPixmap, KGameCanvasTiledPixmap, KGameCanvasRectangle, and KGameCanvasText.
| bool KGameCanvasItem::layered | ( | ) | const [virtual] |
Override this function to specify if the painting operations will paint over each other.
If not, the item will be drawn more quickly when opacity is != 255, because it does not have to be painted onto a pixmap first. If you don't care about the item's opacity, don't care about this function as well.
Reimplemented in KGameCanvasPixmap, KGameCanvasTiledPixmap, KGameCanvasRectangle, and KGameCanvasText.
Definition at line 400 of file kgamecanvas.cpp.
| void KGameCanvasItem::advance | ( | int | msecs | ) | [virtual] |
Override this function to handle animations, the default function does nothing.
The argument is the number of milliseconds from the creation of the canvas, so that you use it to handle the animation.
Reimplemented in KGameCanvasGroup.
Definition at line 402 of file kgamecanvas.cpp.
Friends And Related Function Documentation
friend class KGameCanvasAbstract [friend] |
Definition at line 112 of file kgamecanvas.h.
friend class KGameCanvasWidget [friend] |
Definition at line 113 of file kgamecanvas.h.
friend class KGameCanvasGroup [friend] |
Definition at line 114 of file kgamecanvas.h.
friend class KGameCanvasAdapter [friend] |
Definition at line 115 of file kgamecanvas.h.
The documentation for this class was generated from the following files:
KDE 4.0 API Reference