Main Page | Class Hierarchy | Class List | File List | Class Members

Canvas::Item Class Reference

An abstract item. More...

#include <canvas.h>

Inheritance diagram for Canvas::Item:

Inheritance graph
[legend]
Collaboration diagram for Canvas::Item:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Item (Abstract *canvas=NULL)
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 (Item *ref)
void stackUnder (Item *ref)
Abstractcanvas () const
WidgettopLevelCanvas () const
void putInCanvas (Abstract *canvas)
QPoint pos () const
void moveTo (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 Abstract
class Widget
class Group

Detailed Description

An abstract item.

A Item is an abstract class to represent a generic item that can be put in a canvas.


Constructor & Destructor Documentation

Canvas::Item::Item Abstract 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 beeing 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


Member Function Documentation

void Canvas::Item::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 Canvas::Group.

bool Canvas::Item::animated  )  const [inline]
 

Returns true if the item is animated

Abstract* Canvas::Item::canvas  )  const [inline]
 

Returns the canvas that is actually "owning" the item

void Canvas::Item::changed  )  [inline]
 

schedule an update if the item

void Canvas::Item::hide  )  [inline]
 

Hides the item

bool Canvas::Item::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.

void Canvas::Item::lower  ) 
 

Restacks the item on the bottom of the canvas

void Canvas::Item::moveTo int  x,
int  y
[inline]
 

Overload, same as above

void Canvas::Item::moveTo 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

int Canvas::Item::opacity  )  const [inline]
 

Returns the opacity of the item

virtual void Canvas::Item::paint QPainter *  p  )  [pure virtual]
 

Override this function to draw the item with the painter

Implemented in Canvas::Group, Canvas::Dummy, Canvas::Picture, Canvas::Pixmap, Canvas::TiledPixmap, Canvas::Rectangle, and Canvas::Text.

QPoint Canvas::Item::pos  )  const [inline]
 

Returns the position of the item

void Canvas::Item::putInCanvas Abstract canvas  ) 
 

Lets you specify the owning canvas. Call this function with canvas set to NULL to remove the item from the current canvas.

void Canvas::Item::raise  ) 
 

Restacks the item on the top of the canvas

virtual QRect Canvas::Item::rect  )  const [pure virtual]
 

Override this function to return the rect the item will be drawn into

Implemented in Canvas::Group, Canvas::Dummy, Canvas::Picture, Canvas::Pixmap, Canvas::TiledPixmap, Canvas::Rectangle, and Canvas::Text.

void Canvas::Item::setAnimated bool  a  ) 
 

Set the item as animated or not

void Canvas::Item::setOpacity int  o  ) 
 

Set the item's opacity value (int the 0-255 range)

void Canvas::Item::setVisible bool  v  ) 
 

Set the item as visible or hidden

void Canvas::Item::show  )  [inline]
 

Shows the item

void Canvas::Item::stackOver Item ref  ) 
 

Restacks the item immediately over ref

void Canvas::Item::stackUnder Item ref  ) 
 

Restacks the item immediately under ref

Widget* Canvas::Item::topLevelCanvas  )  const [inline]
 

Returns the toplevel canvas widget, or NULL

bool Canvas::Item::visible  )  const [inline]
 

Returns true if the item is visible


The documentation for this class was generated from the following files:
Generated on Thu Aug 10 03:19:14 2006 for kboard by  doxygen 1.4.3-20050530