KdmItem Class Reference

Base class for every kdmthemes' element. More...

#include <kdmitem.h>

Inheritance diagram for KdmItem:
KdmLabel KdmPixmap KdmRect

List of all members.

Signals

void needUpdate (int x, int y, int w, int h)
void activated (const TQString &id)

Public Member Functions

 KdmItem (KdmItem *parent, const TQDomNode &node=TQDomNode(), const char *name=0)
 KdmItem (TQWidget *parent, const TQDomNode &node=TQDomNode(), const char *name=0)
virtual void setGeometry (const TQRect &newGeometry, bool force)
void paint (TQPainter *painter, const TQRect &boundaries)
virtual void update ()
void mouseEvent (int x, int y, bool pressed=false, bool released=false)
virtual TQRect placementHint (const TQRect &parentGeometry)
void setBoxLayout (const TQDomNode &node=TQDomNode())
void setFixedLayout (const TQDomNode &node=TQDomNode())
TQString type () const
void setType (const TQString &t)
void setBaseDir (const TQString &bd)
TQString baseDir () const
KdmItemfindNode (const TQString &id) const
virtual void setWidget (TQWidget *widget)
TQWidgetwidget () const
virtual void setLayoutItem (TQLayoutItem *item)
virtual void hide (bool force=false)
virtual void show (bool force=false)
bool isHidden () const
bool isExplicitlyHidden () const
TQRect rect () const
TQWidgetparentWidget () const
TQString getId () const

Protected Types

enum  ItemState { Snormal, Sactive, Sprelight }
enum  DataType {
  DTnone, DTpixel, DTnpixel, DTpercent,
  DTbox
}
enum  { MNone = 0, MFixed = 1, MBox = 2 }
enum  { InitialHidden, ExplicitlyHidden, Shown }

Protected Slots

void widgetGone ()
void layoutItemGone ()

Protected Member Functions

virtual TQSize sizeHint ()
virtual void drawContents (TQPainter *painter, const TQRect &region)=0
virtual void statusChanged ()
void needUpdate ()
void addChildItem (KdmItem *item)
void parseAttribute (const TQString &, int &, enum DataType &)
void parseFont (const TQString &, TQFont &)
void parseColor (const TQString &, TQColor &)
void inheritFromButton (KdmItem *button)
void init (const TQDomNode &node=TQDomNode(), const char *name=0)

Protected Attributes

enum KdmItem::ItemState state
struct {
   bool   incrementalPaint
properties
TQRect area
struct {
   enum DataType xType yType wType   hType
   int   x
   int   y
   int   width
   int   height
   TQString   anchor
pos
TQString itemType
TQString id
TQValueList< KdmItem * > m_children
int m_backgroundModifier
enum KdmItem:: { ... }  currentManager
KdmLayoutBoxboxManager
KdmLayoutFixedfixedManager
TQImage * image
TQString basedir
TQWidgetmyWidget
TQLayoutItem * myLayoutItem
enum KdmItem:: { ... }  isShown
KdmItembuttonParent

Static Protected Attributes

static KdmItemcurrentActive = 0

Friends

class KdmThemer

Detailed Description

Base class for every kdmthemes' element.

class KdmItem This class provides methods for arranging it and its children to the screen (see note below), painting the whole area or a sub-region using an opened painter, handling mouse events or events in general dispatching them to children and sending some signals to the root (for example on mouse click).

KdmItem sits in a hierarchical top to bottom tree with signals that traverse the tree back from leafs (or inner nodes) to the root.

To implement a KdmItem only a few virtual protected methods must be reimplemented, other virtual functions are there for convenience only - the default implementation should satisfy your needs. A note on layouting - how does it work?


Constructor & Destructor Documentation

KdmItem::KdmItem ( KdmItem parent,
const TQDomNode &  node = TQDomNode(),
const char *  name = 0 
)

Item constructor and destructor


Member Function Documentation

virtual void KdmItem::drawContents ( TQPainter *  painter,
const TQRect &  region 
) [protected, pure virtual]

Low level graphical function to paint the item. All items must reimplement this function to draw themeselves (or a part of) into the image keeping inside the rect . Try to do this as fast as possible.

Parameters:
painter the painter to draw the item with
region the part of the the image to render

Implemented in KdmLabel, KdmPixmap, and KdmRect.

void KdmItem::mouseEvent ( int  x,
int  y,
bool  pressed = false,
bool  released = false 
)

Handle mouse motion and dispatch events to children. This leads to items prelighting, activation() on click and more..

void KdmItem::needUpdate (  )  [protected]

emits needUpdate( int, int, int, int ) with the full widget area.

void KdmItem::paint ( TQPainter *  painter,
const TQRect &  boundaries 
)

Paint the item and its children using the given painter. This is the compositing core function. It buffers paint operations to speed up rendering of dynamic objects.

QRect KdmItem::placementHint ( const TQRect &  parentGeometry  )  [virtual]

Similar to sizeHint(..), this returns the area of the item given the parentGeometry. The default implementation takes into account geometric constraints and layoutings.

Parameters:
parentGeometry the geometry of the caller item or a null rect if the geometry of the parent is not yet defined.
void KdmItem::setBoxLayout ( const TQDomNode &  node = TQDomNode()  ) 

Create the box layout manager; next children will be managed by the box layouter

void KdmItem::setFixedLayout ( const TQDomNode &  node = TQDomNode()  ) 

Create the fixed layout manager; next children will be in fixed position relative to this item

void KdmItem::setGeometry ( const TQRect &  newGeometry,
bool  force 
) [virtual]

Fixup the geometry of an item and its children (even if fixed or boxed ones). Note that this will generate repaint signals when needed. The default implementation should fit all needs.

Reimplemented in KdmPixmap.

QSize KdmItem::sizeHint (  )  [protected, virtual]

Returns the optimal/minimal size for this item. This should be reimplemented in items like label and pixmap.

Returns:
(-1,-1) if no size can be determined (so it should default to parent's size).

Reimplemented in KdmLabel, and KdmPixmap.

void KdmItem::statusChanged (  )  [protected, virtual]

Called when item changes its 'state' variable. This must handle item's repaint.

Reimplemented in KdmLabel, KdmPixmap, and KdmRect.

void KdmItem::update (  )  [virtual]

Update representation of contents and repaint.

Reimplemented in KdmLabel.


The documentation for this class was generated from the following files:

Generated on Sat Oct 2 22:59:29 2010 by  doxygen 1.6.1