Main Page   Class Hierarchy   Compound List   File List   Compound Members  

KrImNode Class Reference

The base class of everything that can be in an ImageTree. More...

#include <imnode.h>

Inheritance diagram for KrImNode::

KrImage KrTextBox KrWidget KrBox KrCanvas KrSprite KrTile KrButton KrConsole KrImageListBox KrListBox KrProgress KrTextWidget List of all members.

Public Methods

int ZDepth ()
 Every node has a Z-Depth within the node that contains it. More...

void SetZDepth (int z)
 Set the z-depth of this node relative to its siblings.

int X (int window=0)
 Return the x postion of this node, relative to its parent.

int Y (int window=0)
 Return the y position of this node, relative to its parent.

GlFixed XScale (int window=0)
 Return the x scale of this node, untransformed by parent.

GlFixed YScale (int window=0)
 Return the x scale of this node, untransformed by parent.

const KrMatrix2Transform (int window=0)
 Query the entire transformation matrix.

void SetPos (int x, int y, int window=KR_ALL_WINDOWS)
 Set the x and y positon of the ImNode, relative to the node's parent. More...

void SetScale (GlFixed xScale, GlFixed yScale, int window=KR_ALL_WINDOWS)
 Set the scale of this ImNode, which changes all the children as well.

void SetTransform (KrMatrix2 &xForm, int window=KR_ALL_WINDOWS)
 Set the transformation matrix of this ImNode: combines the SetPos and SetScale functionality.

void SetQuality (int quality, int window=KR_ALL_WINDOWS)
 Set the drawing quality for scaling. More...

void DeltaPos (int deltaX, int deltaY, int window=KR_ALL_WINDOWS)
 Offsets the node position.

const KrColorTransformCTransform (int window=0)
 Get the color transformation of the node.

virtual void SetColor (const KrColorTransform &color, int window=KR_ALL_WINDOWS)
 Set the color of a node. More...

virtual KrImageToImage ()
 Return a pointer if this is an image.

virtual KrSpriteToSprite ()
 Return a pointer if this is a sprite.

virtual KrTileToTile ()
 Return a pointer if this is a tile.

virtual KrCanvasToCanvas ()
 Return a pointer if this is a canvas.

virtual KrTextBoxToTextBox ()
 Return a pointer if this is a text box.

virtual KrBoxToBox ()
 Return a pointer if this is a box.

virtual KrWidgetToWidget ()
 Return a pointer if this is a widget.

virtual KrImNode * ToExtended (const std::string &type)
 A generic cast. More...

const std::string & NodeName ()
 Any ImNode can have a name or id. More...

int NodeId ()
 Any ImNode can have a name or id. More...

void SetNodeName (const std::string &name)
 Set the name of this node. More...

void SetNodeId (int id)
 Set the id of this node. More...

GlInsideNodeIt< KrImNode *> ChildTreeIterator ()
 Fetch an iterator to walk the children with.

virtual bool HitTest (int x, int y, int flags, GlDynArray< KrImage *> *results, int window)
 Hit test this object. Returns true if there was a hit, and 'this' will be added to results.

bool IsVisible (int window=0)
 Return the visibility of this node, taking into account the state of all its parents.

bool IsThisVisible (int window=0)
 Return the visibility of this node, NOT taking into account the state of all its parents.

virtual void SetVisible (bool visible, int window=KR_ALL_WINDOWS)
 If visible is set to false, this node and all its children will not show up on the stage. More...

void ScreenToObject (int x, int y, KrVector2T< GlFixed > *object, int window=0)
 Transform screen (pixel) coordinates to local object coordinates. More...

void SetUserData (void *data)
 A hook to set user defined data.

void SetUserDataU32 (U32 data)
 A hook to set user defined data. Sets the *same* user data as SetUserData, just uses a convenience cast.

void * GetUserData ()
 Fetches the user defined data.

U32 GetUserDataU32 ()
 Fetches the user defined data. Fetches the *same* user data as GetUserData, just uses a convenience cast.

virtual KrImNode * Clone ()
 Return a copy if this object, not in a Tree(). More...

KrImNode * Parent ()
 The parent of this KrImNode.

KrEngineEngine ()
 The engine this KrImNode is in.


Protected Methods

void Resort (KrImNode *resortMe)
 Resort can be called if a node's depth has changed and it needs to move elsewhere in the list.


Friends

class KrImageTree

Detailed Description

The base class of everything that can be in an ImageTree.

The class in not abstract -- it can be very useful to have a KrImNode that is used as a container for other objects.

Children always draw on top of their parents.


Member Function Documentation

virtual KrImNode* KrImNode::Clone   [virtual]
 

Return a copy if this object, not in a Tree().

It is return untransformed. In the case of a sprite, the action and frame will be set to the current value.

Reimplemented in KrBox, KrCanvas, KrSprite, KrTextBox, and KrTile.

int KrImNode::NodeId   [inline]
 

Any ImNode can have a name or id.

They are completely managed by the user -- they are not used by the engine in any way. They should be unique to the tree, and can be used as a way to keep track of nodes.

An empty name or an id<0 indicate no name and no id, respectively.

const std::string& KrImNode::NodeName   [inline]
 

Any ImNode can have a name or id.

They are completely managed by the user -- they are not used by the engine in any way. They should be unique to the tree, and can be used as a way to keep track of nodes.

An empty name or an id<0 indicate no name and no id, respectively.

void KrImNode::ScreenToObject int    x,
int    y,
KrVector2T< GlFixed > *    object,
int    window = 0
 

Transform screen (pixel) coordinates to local object coordinates.

The composite Xform is used for this and must be initialized -- practically, the object must be in a Tree to call this method.

virtual void KrImNode::SetColor const KrColorTransform   color,
int    window = KR_ALL_WINDOWS
[virtual]
 

Set the color of a node.

This color transforms all the node's children as well.

void KrImNode::SetNodeId int    id
 

Set the id of this node.

It must be > 0. This is completely user defined. Like the name, this should be unique. In DEBUG mode, an assertion will fire if an id is re-used.

void KrImNode::SetNodeName const std::string &    name
 

Set the name of this node.

This is completely user defined. The name of a node should be unique. In DEBUG mode, an assertion will fire if the same name is used twice.

void KrImNode::SetPos int    x,
int    y,
int    window = KR_ALL_WINDOWS
 

Set the x and y positon of the ImNode, relative to the node's parent.

Even non-drawing nodes have position since changing the position moves the node's children.

Setting the positon of the root node scrolls the screen.

void KrImNode::SetQuality int    quality,
int    window = KR_ALL_WINDOWS
 

Set the drawing quality for scaling.

Quality is inherited from the parent the same way other properties are, if the quality is set to KrQualityNone, else the set quality is used. Cached scaling is always at maximum quality.

virtual void KrImNode::SetVisible bool    visible,
int    window = KR_ALL_WINDOWS
[virtual]
 

If visible is set to false, this node and all its children will not show up on the stage.

Returns true if the visiblity was changed by this call.

virtual KrImNode* KrImNode::ToExtended const std::string &    name [inline, virtual]
 

A generic cast.

The Kyra library is not as extensible as it could be; this implements a "cheap RTTI" if you add your own sub-classes. Arbitrary casting to any type in the string. For example,

                        MyClassType* myType = (MyClassType*) node->ToExtended( "MyClassType" );
                
Somewhat inelegant, but a very useful hook. The build in classes will not respond to this. (That is, ToExtended( "Sprite" ) does not work.)

Reimplemented in KrConsole.

int KrImNode::ZDepth   [inline]
 

Every node has a Z-Depth within the node that contains it.

The lowest z-depth is the farthest from the viewer. Any integer value is acceptable.

Nodes at the same z-depth are sorted by the order they were added to the tree. The last one added is the closest to the viewer. (It is not a good idea to mix z-depth changing and "order sorting." Go with one or the other.

Changing the z-depth of the root is meaningless. (It has no siblings.)


The documentation for this class was generated from the following file:
Generated on Mon Sep 15 12:01:11 2003 for Kyra by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001