Loading...
Searching...
No Matches
IGUIElement.h
Go to the documentation of this file.
// Copyright (C) 2002-2012 Nikolaus Gebhardt
// This file is part of the "Irrlicht Engine".
// For conditions of distribution and use, see copyright notice in irrlicht.h
#ifndef __I_GUI_ELEMENT_H_INCLUDED__
#define __I_GUI_ELEMENT_H_INCLUDED__
#include "IAttributeExchangingObject.h"
#include "irrList.h"
#include "rect.h"
#include "irrString.h"
#include "IEventReceiver.h"
#include "EGUIElementTypes.h"
#include "EGUIAlignment.h"
#include "IAttributes.h"
namespace irr
{
namespace gui
{
class IGUIEnvironment;
class IGUIElement : public virtual io::IAttributeExchangingObject, public IEventReceiver
{
public:
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment* environment, IGUIElement* parent,
s32 id, const core::rect<s32>& rectangle)
: Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle),
AbsoluteClippingRect(rectangle), DesiredRect(rectangle),
MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true),
IsSubElement(false), NoClip(false), ID(id), IsTabStop(false), TabOrder(-1), IsTabGroup(false),
AlignLeft(EGUIA_UPPERLEFT), AlignRight(EGUIA_UPPERLEFT), AlignTop(EGUIA_UPPERLEFT), AlignBottom(EGUIA_UPPERLEFT),
Environment(environment), Type(type)
{
#ifdef _DEBUG
setDebugName("IGUIElement");
#endif
// if we were given a parent to attach to
if (parent)
{
parent->addChildToEnd(this);
recalculateAbsolutePosition(true);
}
}
virtual ~IGUIElement()
{
// delete all children
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->Parent = 0;
(*it)->drop();
}
}
IGUIElement* getParent() const
{
return Parent;
}
core::rect<s32> getRelativePosition() const
{
return RelativeRect;
}
void setRelativePosition(const core::rect<s32>& r)
{
if (Parent)
{
const core::rect<s32>& r2 = Parent->getAbsolutePosition();
core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
if (AlignLeft == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.X = (f32)r.UpperLeftCorner.X / d.Width;
if (AlignRight == EGUIA_SCALE)
ScaleRect.LowerRightCorner.X = (f32)r.LowerRightCorner.X / d.Width;
if (AlignTop == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.Y = (f32)r.UpperLeftCorner.Y / d.Height;
if (AlignBottom == EGUIA_SCALE)
ScaleRect.LowerRightCorner.Y = (f32)r.LowerRightCorner.Y / d.Height;
}
DesiredRect = r;
updateAbsolutePosition();
}
void setRelativePosition(const core::position2di & position)
{
const core::dimension2di mySize = RelativeRect.getSize();
const core::rect<s32> rectangle(position.X, position.Y,
position.X + mySize.Width, position.Y + mySize.Height);
setRelativePosition(rectangle);
}
void setRelativePositionProportional(const core::rect<f32>& r)
{
if (!Parent)
return;
const core::dimension2di& d = Parent->getAbsolutePosition().getSize();
DesiredRect = core::rect<s32>(
core::floor32((f32)d.Width * r.UpperLeftCorner.X),
core::floor32((f32)d.Height * r.UpperLeftCorner.Y),
core::floor32((f32)d.Width * r.LowerRightCorner.X),
core::floor32((f32)d.Height * r.LowerRightCorner.Y));
ScaleRect = r;
updateAbsolutePosition();
}
core::rect<s32> getAbsolutePosition() const
{
return AbsoluteRect;
}
core::rect<s32> getAbsoluteClippingRect() const
{
return AbsoluteClippingRect;
}
void setNotClipped(bool noClip)
{
NoClip = noClip;
updateAbsolutePosition();
}
bool isNotClipped() const
{
return NoClip;
}
void setMaxSize(core::dimension2du size)
{
MaxSize = size;
updateAbsolutePosition();
}
void setMinSize(core::dimension2du size)
{
MinSize = size;
if (MinSize.Width < 1)
MinSize.Width = 1;
if (MinSize.Height < 1)
MinSize.Height = 1;
updateAbsolutePosition();
}
void setAlignment(EGUI_ALIGNMENT left, EGUI_ALIGNMENT right, EGUI_ALIGNMENT top, EGUI_ALIGNMENT bottom)
{
AlignLeft = left;
AlignRight = right;
AlignTop = top;
AlignBottom = bottom;
if (Parent)
{
core::rect<s32> r(Parent->getAbsolutePosition());
core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
if (AlignLeft == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.X = (f32)DesiredRect.UpperLeftCorner.X / d.Width;
if (AlignRight == EGUIA_SCALE)
ScaleRect.LowerRightCorner.X = (f32)DesiredRect.LowerRightCorner.X / d.Width;
if (AlignTop == EGUIA_SCALE)
ScaleRect.UpperLeftCorner.Y = (f32)DesiredRect.UpperLeftCorner.Y / d.Height;
if (AlignBottom == EGUIA_SCALE)
ScaleRect.LowerRightCorner.Y = (f32)DesiredRect.LowerRightCorner.Y / d.Height;
}
}
virtual void updateAbsolutePosition()
{
recalculateAbsolutePosition(false);
// update all children
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->updateAbsolutePosition();
}
}
IGUIElement* getElementFromPoint(const core::position2d<s32>& point)
{
IGUIElement* target = 0;
// we have to search from back to front, because later children
// might be drawn over the top of earlier ones.
core::list<IGUIElement*>::Iterator it = Children.getLast();
if (isVisible())
{
while(it != Children.end())
{
target = (*it)->getElementFromPoint(point);
if (target)
return target;
--it;
}
}
if (isVisible() && isPointInside(point))
target = this;
return target;
}
virtual bool isPointInside(const core::position2d<s32>& point) const
{
return AbsoluteClippingRect.isPointInside(point);
}
virtual void addChild(IGUIElement* child)
{
addChildToEnd(child);
if (child)
{
child->updateAbsolutePosition();
}
}
virtual void removeChild(IGUIElement* child)
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
if ((*it) == child)
{
(*it)->Parent = 0;
(*it)->drop();
Children.erase(it);
return;
}
}
virtual void remove()
{
if (Parent)
Parent->removeChild(this);
}
virtual void draw()
{
if ( isVisible() )
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->draw();
}
}
virtual void OnPostRender(u32 timeMs)
{
if ( isVisible() )
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->OnPostRender( timeMs );
}
}
virtual void move(core::position2d<s32> absoluteMovement)
{
setRelativePosition(DesiredRect + absoluteMovement);
}
virtual bool isVisible() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsVisible;
}
virtual void setVisible(bool visible)
{
IsVisible = visible;
}
virtual bool isSubElement() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsSubElement;
}
virtual void setSubElement(bool subElement)
{
IsSubElement = subElement;
}
void setTabStop(bool enable)
{
IsTabStop = enable;
}
bool isTabStop() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsTabStop;
}
void setTabOrder(s32 index)
{
// negative = autonumber
if (index < 0)
{
TabOrder = 0;
IGUIElement *el = getTabGroup();
while (IsTabGroup && el && el->Parent)
el = el->Parent;
IGUIElement *first=0, *closest=0;
if (el)
{
// find the highest element number
el->getNextElement(-1, true, IsTabGroup, first, closest, true);
if (first)
{
TabOrder = first->getTabOrder() + 1;
}
}
}
else
TabOrder = index;
}
s32 getTabOrder() const
{
return TabOrder;
}
void setTabGroup(bool isGroup)
{
IsTabGroup = isGroup;
}
bool isTabGroup() const
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsTabGroup;
}
IGUIElement* getTabGroup()
{
IGUIElement *ret=this;
while (ret && !ret->isTabGroup())
ret = ret->getParent();
return ret;
}
virtual bool isEnabled() const
{
if ( isSubElement() && IsEnabled && getParent() )
return getParent()->isEnabled();
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return IsEnabled;
}
virtual void setEnabled(bool enabled)
{
IsEnabled = enabled;
}
virtual void setText(const wchar_t* text)
{
Text = text;
}
virtual const wchar_t* getText() const
{
return Text.c_str();
}
virtual void setToolTipText(const wchar_t* text)
{
ToolTipText = text;
}
virtual const core::stringw& getToolTipText() const
{
return ToolTipText;
}
virtual s32 getID() const
{
return ID;
}
virtual void setID(s32 id)
{
ID = id;
}
virtual bool OnEvent(const SEvent& event)
{
return Parent ? Parent->OnEvent(event) : false;
}
virtual bool bringToFront(IGUIElement* element)
{
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
if (element == (*it))
{
Children.erase(it);
Children.push_back(element);
return true;
}
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
virtual bool sendToBack(IGUIElement* child)
{
core::list<IGUIElement*>::Iterator it = Children.begin();
if (child == (*it)) // already there
return true;
for (; it != Children.end(); ++it)
{
if (child == (*it))
{
Children.erase(it);
Children.push_front(child);
return true;
}
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
virtual const core::list<IGUIElement*>& getChildren() const
{
return Children;
}
virtual IGUIElement* getElementFromId(s32 id, bool searchchildren=false) const
{
IGUIElement* e = 0;
core::list<IGUIElement*>::ConstIterator it = Children.begin();
for (; it != Children.end(); ++it)
{
if ((*it)->getID() == id)
return (*it);
if (searchchildren)
e = (*it)->getElementFromId(id, true);
if (e)
return e;
}
return e;
}
bool isMyChild(IGUIElement* child) const
{
if (!child)
return false;
do
{
if (child->Parent)
child = child->Parent;
} while (child->Parent && child != this);
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return child == this;
}
bool getNextElement(s32 startOrder, bool reverse, bool group,
IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const
{
// we'll stop searching if we find this number
s32 wanted = startOrder + ( reverse ? -1 : 1 );
if (wanted==-2)
wanted = 1073741824; // maximum s32
core::list<IGUIElement*>::ConstIterator it = Children.begin();
s32 closestOrder, currentOrder;
while(it != Children.end())
{
// ignore invisible elements and their children
if ( ( (*it)->isVisible() || includeInvisible ) &&
(group == true || (*it)->isTabGroup() == false) )
{
// only check tab stops and those with the same group status
if ((*it)->isTabStop() && ((*it)->isTabGroup() == group))
{
currentOrder = (*it)->getTabOrder();
// is this what we're looking for?
if (currentOrder == wanted)
{
closest = *it;
return true;
}
// is it closer than the current closest?
if (closest)
{
closestOrder = closest->getTabOrder();
if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
{
closest = *it;
}
}
else
if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) )
{
closest = *it;
}
// is it before the current first?
if (first)
{
closestOrder = first->getTabOrder();
if ( (reverse && closestOrder < currentOrder) || (!reverse && closestOrder > currentOrder) )
{
first = *it;
}
}
else
{
first = *it;
}
}
// search within children
if ((*it)->getNextElement(startOrder, reverse, group, first, closest))
{
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return true;
}
}
++it;
}
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX;
return false;
}
EGUI_ELEMENT_TYPE getType() const
{
return Type;
}
virtual bool hasType(EGUI_ELEMENT_TYPE type) const
{
return type == Type;
}
virtual const c8* getTypeName() const
{
return GUIElementTypeNames[Type];
}
virtual const c8* getName() const
{
return Name.c_str();
}
virtual void setName(const c8* name)
{
Name = name;
}
virtual void setName(const core::stringc& name)
{
Name = name;
}
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const
{
out->addString("Name", Name.c_str());
out->addInt("Id", ID );
out->addString("Caption", getText());
out->addRect("Rect", DesiredRect);
out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);
out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);
out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);
out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames);
out->addBool("Visible", IsVisible);
out->addBool("Enabled", IsEnabled);
out->addBool("TabStop", IsTabStop);
out->addBool("TabGroup", IsTabGroup);
out->addInt("TabOrder", TabOrder);
out->addBool("NoClip", NoClip);
}
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0)
{
setName(in->getAttributeAsString("Name"));
setID(in->getAttributeAsInt("Id"));
setText(in->getAttributeAsStringW("Caption").c_str());
setVisible(in->getAttributeAsBool("Visible"));
setEnabled(in->getAttributeAsBool("Enabled"));
IsTabStop = in->getAttributeAsBool("TabStop");
IsTabGroup = in->getAttributeAsBool("TabGroup");
TabOrder = in->getAttributeAsInt("TabOrder");
core::position2di p = in->getAttributeAsPosition2d("MaxSize");
setMaxSize(core::dimension2du(p.X,p.Y));
p = in->getAttributeAsPosition2d("MinSize");
setMinSize(core::dimension2du(p.X,p.Y));
setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames),
(EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames));
setRelativePosition(in->getAttributeAsRect("Rect"));
setNotClipped(in->getAttributeAsBool("NoClip"));
}
protected:
// not virtual because needed in constructor
void addChildToEnd(IGUIElement* child)
{
if (child)
{
child->grab(); // prevent destruction when removed
child->remove(); // remove from old parent
child->LastParentRect = getAbsolutePosition();
child->Parent = this;
Children.push_back(child);
}
}
// not virtual because needed in constructor
void recalculateAbsolutePosition(bool recursive)
{
core::rect<s32> parentAbsolute(0,0,0,0);
core::rect<s32> parentAbsoluteClip;
f32 fw=0.f, fh=0.f;
if (Parent)
{
parentAbsolute = Parent->AbsoluteRect;
if (NoClip)
{
IGUIElement* p=this;
while (p && p->Parent)
p = p->Parent;
parentAbsoluteClip = p->AbsoluteClippingRect;
}
else
parentAbsoluteClip = Parent->AbsoluteClippingRect;
}
const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
if (AlignLeft == EGUIA_SCALE || AlignRight == EGUIA_SCALE)
fw = (f32)parentAbsolute.getWidth();
if (AlignTop == EGUIA_SCALE || AlignBottom == EGUIA_SCALE)
fh = (f32)parentAbsolute.getHeight();
switch (AlignLeft)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.X = core::round32(ScaleRect.UpperLeftCorner.X * fw);
break;
}
switch (AlignRight)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.X += diffx;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.X += diffx/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.X = core::round32(ScaleRect.LowerRightCorner.X * fw);
break;
}
switch (AlignTop)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.UpperLeftCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.UpperLeftCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.UpperLeftCorner.Y = core::round32(ScaleRect.UpperLeftCorner.Y * fh);
break;
}
switch (AlignBottom)
{
case EGUIA_UPPERLEFT:
break;
case EGUIA_LOWERRIGHT:
DesiredRect.LowerRightCorner.Y += diffy;
break;
case EGUIA_CENTER:
DesiredRect.LowerRightCorner.Y += diffy/2;
break;
case EGUIA_SCALE:
DesiredRect.LowerRightCorner.Y = core::round32(ScaleRect.LowerRightCorner.Y * fh);
break;
}
RelativeRect = DesiredRect;
const s32 w = RelativeRect.getWidth();
const s32 h = RelativeRect.getHeight();
// make sure the desired rectangle is allowed
if (w < (s32)MinSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MinSize.Width;
if (h < (s32)MinSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MinSize.Height;
if (MaxSize.Width && w > (s32)MaxSize.Width)
RelativeRect.LowerRightCorner.X = RelativeRect.UpperLeftCorner.X + MaxSize.Width;
if (MaxSize.Height && h > (s32)MaxSize.Height)
RelativeRect.LowerRightCorner.Y = RelativeRect.UpperLeftCorner.Y + MaxSize.Height;
RelativeRect.repair();
AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
if (!Parent)
parentAbsoluteClip = AbsoluteRect;
AbsoluteClippingRect = AbsoluteRect;
AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
LastParentRect = parentAbsolute;
if ( recursive )
{
// update all children
core::list<IGUIElement*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
{
(*it)->recalculateAbsolutePosition(recursive);
}
}
}
protected:
core::list<IGUIElement*> Children;
IGUIElement* Parent;
core::rect<s32> RelativeRect;
core::rect<s32> AbsoluteRect;
core::rect<s32> AbsoluteClippingRect;
core::rect<s32> DesiredRect;
core::rect<s32> LastParentRect;
core::rect<f32> ScaleRect;
core::dimension2du MaxSize, MinSize;
bool IsVisible;
bool IsEnabled;
bool IsSubElement;
bool NoClip;
core::stringw Text;
core::stringw ToolTipText;
core::stringc Name;
s32 ID;
bool IsTabStop;
s32 TabOrder;
bool IsTabGroup;
EGUI_ALIGNMENT AlignLeft, AlignRight, AlignTop, AlignBottom;
IGUIEnvironment* Environment;
EGUI_ELEMENT_TYPE Type;
};
} // end namespace gui
} // end namespace irr
#endif
EGUIAlignment.h
EGUIElementTypes.h
IAttributeExchangingObject.h
IAttributes.h
IEventReceiver.h
irr::IEventReceiver
Interface of an object which can receive events.
Definition IEventReceiver.h:434
irr::IReferenceCounted::grab
void grab() const
Grabs the object. Increments the reference counter by one.
Definition IReferenceCounted.h:86
irr::IReferenceCounted::setDebugName
void setDebugName(const c8 *newName)
Sets the debug name of the object.
Definition IReferenceCounted.h:153
irr::core::dimension2d::Width
T Width
Width of the dimension.
Definition dimension2d.h:204
irr::core::dimension2d::Height
T Height
Height of the dimension.
Definition dimension2d.h:206
irr::core::list::ConstIterator
List iterator for const access.
Definition irrList.h:88
irr::core::list::Iterator
List iterator.
Definition irrList.h:39
irr::core::list
Doubly linked list template.
Definition irrList.h:21
irr::core::rect
Rectangle template.
Definition rect.h:27
irr::core::rect::getSize
dimension2d< T > getSize() const
Get the dimensions of the rectangle.
Definition rect.h:231
irr::core::rect::LowerRightCorner
position2d< T > LowerRightCorner
Lower right corner.
Definition rect.h:267
irr::core::rect::UpperLeftCorner
position2d< T > UpperLeftCorner
Upper left corner.
Definition rect.h:265
irr::core::rect::getHeight
T getHeight() const
Get height of rectangle.
Definition rect.h:190
irr::core::rect::getWidth
T getWidth() const
Get width of rectangle.
Definition rect.h:184
irr::core::string::c_str
const T * c_str() const
Returns character string.
Definition irrString.h:495
irr::core::vector2d::X
T X
X coordinate of vector.
Definition vector2d.h:316
irr::core::vector2d::Y
T Y
Y coordinate of vector.
Definition vector2d.h:319
irr::gui::IGUIElement::LastParentRect
core::rect< s32 > LastParentRect
for calculating the difference when resizing parent
Definition IGUIElement.h:981
irr::gui::IGUIElement::AbsoluteRect
core::rect< s32 > AbsoluteRect
absolute rect of element
Definition IGUIElement.h:971
irr::gui::IGUIElement::~IGUIElement
virtual ~IGUIElement()
Destructor.
Definition IGUIElement.h:53
irr::gui::IGUIElement::AlignLeft
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition IGUIElement.h:1023
irr::gui::IGUIElement::setRelativePosition
void setRelativePosition(const core::rect< s32 > &r)
Sets the relative rectangle of this element.
Definition IGUIElement.h:81
irr::gui::IGUIElement::isTabStop
bool isTabStop() const
Returns true if this element can be focused by navigating with the tab key.
Definition IGUIElement.h:384
irr::gui::IGUIElement::AbsoluteClippingRect
core::rect< s32 > AbsoluteClippingRect
absolute clipping rect of element
Definition IGUIElement.h:974
irr::gui::IGUIElement::MaxSize
core::dimension2du MaxSize
maximum and minimum size of the element
Definition IGUIElement.h:987
irr::gui::IGUIElement::IsSubElement
bool IsSubElement
is a part of a larger whole and should not be serialized?
Definition IGUIElement.h:996
irr::gui::IGUIElement::setTabOrder
void setTabOrder(s32 index)
Sets the priority of focus when using the tab key to navigate between a group of elements.
Definition IGUIElement.h:394
irr::gui::IGUIElement::isPointInside
virtual bool isPointInside(const core::position2d< s32 > &point) const
Returns true if a point is within this element.
Definition IGUIElement.h:272
irr::gui::IGUIElement::setAlignment
void setAlignment(EGUI_ALIGNMENT left, EGUI_ALIGNMENT right, EGUI_ALIGNMENT top, EGUI_ALIGNMENT bottom)
The alignment defines how the borders of this element will be positioned when the parent element is r...
Definition IGUIElement.h:191
irr::gui::IGUIElement::draw
virtual void draw()
Draws the element and its children.
Definition IGUIElement.h:312
irr::gui::IGUIElement::getText
virtual const wchar_t * getText() const
Returns caption of this element.
Definition IGUIElement.h:487
irr::gui::IGUIElement::addChild
virtual void addChild(IGUIElement *child)
Adds a GUI element as new child of this element.
Definition IGUIElement.h:279
irr::gui::IGUIElement::setEnabled
virtual void setEnabled(bool enabled)
Sets the enabled state of this element.
Definition IGUIElement.h:473
irr::gui::IGUIElement::removeChild
virtual void removeChild(IGUIElement *child)
Removes a child.
Definition IGUIElement.h:289
irr::gui::IGUIElement::getRelativePosition
core::rect< s32 > getRelativePosition() const
Returns the relative rectangle of this element.
Definition IGUIElement.h:73
irr::gui::IGUIElement::hasType
virtual bool hasType(EGUI_ELEMENT_TYPE type) const
Returns true if the gui element supports the given type.
Definition IGUIElement.h:724
irr::gui::IGUIElement::AlignBottom
EGUI_ALIGNMENT AlignBottom
Definition IGUIElement.h:1023
irr::gui::IGUIElement::ToolTipText
core::stringw ToolTipText
tooltip
Definition IGUIElement.h:1005
irr::gui::IGUIElement::recalculateAbsolutePosition
void recalculateAbsolutePosition(bool recursive)
Definition IGUIElement.h:831
irr::gui::IGUIElement::setName
virtual void setName(const c8 *name)
Sets the name of the element.
Definition IGUIElement.h:748
irr::gui::IGUIElement::setSubElement
virtual void setSubElement(bool subElement)
Sets whether this control was created as part of its parent.
Definition IGUIElement.h:368
irr::gui::IGUIElement::getTabGroup
IGUIElement * getTabGroup()
Returns the container element which holds all elements in this element's tab group.
Definition IGUIElement.h:446
irr::gui::IGUIElement::IGUIElement
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
Definition IGUIElement.h:30
irr::gui::IGUIElement::OnEvent
virtual bool OnEvent(const SEvent &event)
Called if an event happened.
Definition IGUIElement.h:522
irr::gui::IGUIElement::setID
virtual void setID(s32 id)
Sets the id of this element.
Definition IGUIElement.h:515
irr::gui::IGUIElement::setTabStop
void setTabStop(bool enable)
If set to true, the focus will visit this element when using the tab key to cycle through elements.
Definition IGUIElement.h:377
irr::gui::IGUIElement::setName
virtual void setName(const core::stringc &name)
Sets the name of the element.
Definition IGUIElement.h:756
irr::gui::IGUIElement::setToolTipText
virtual void setToolTipText(const wchar_t *text)
Sets the new caption of this element.
Definition IGUIElement.h:494
irr::gui::IGUIElement::isTabGroup
bool isTabGroup() const
Returns true if this element is a tab group.
Definition IGUIElement.h:438
irr::gui::IGUIElement::isMyChild
bool isMyChild(IGUIElement *child) const
Definition IGUIElement.h:606
irr::gui::IGUIElement::ID
s32 ID
users can set this for identificating the element by integer
Definition IGUIElement.h:1011
irr::gui::IGUIElement::Environment
IGUIEnvironment * Environment
GUI Environment.
Definition IGUIElement.h:1026
irr::gui::IGUIElement::setNotClipped
void setNotClipped(bool noClip)
Sets whether the element will ignore its parent's clipping rectangle.
Definition IGUIElement.h:154
irr::gui::IGUIElement::move
virtual void move(core::position2d< s32 > absoluteMovement)
Moves this element.
Definition IGUIElement.h:336
irr::gui::IGUIElement::getChildren
virtual const core::list< IGUIElement * > & getChildren() const
Returns list with children of this element.
Definition IGUIElement.h:570
irr::gui::IGUIElement::IsTabGroup
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition IGUIElement.h:1020
irr::gui::IGUIElement::setText
virtual void setText(const wchar_t *text)
Sets the new caption of this element.
Definition IGUIElement.h:480
irr::gui::IGUIElement::NoClip
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition IGUIElement.h:999
irr::gui::IGUIElement::Children
core::list< IGUIElement * > Children
List of all children of this element.
Definition IGUIElement.h:962
irr::gui::IGUIElement::TabOrder
s32 TabOrder
tab order
Definition IGUIElement.h:1017
irr::gui::IGUIElement::isNotClipped
bool isNotClipped() const
Gets whether the element will ignore its parent's clipping rectangle.
Definition IGUIElement.h:163
irr::gui::IGUIElement::getAbsolutePosition
core::rect< s32 > getAbsolutePosition() const
Gets the absolute rectangle of this element.
Definition IGUIElement.h:139
irr::gui::IGUIElement::sendToBack
virtual bool sendToBack(IGUIElement *child)
Moves a child to the back, so it's siblings are drawn on top of it.
Definition IGUIElement.h:550
irr::gui::IGUIElement::getElementFromId
virtual IGUIElement * getElementFromId(s32 id, bool searchchildren=false) const
Finds the first element with the given id.
Definition IGUIElement.h:583
irr::gui::IGUIElement::isVisible
virtual bool isVisible() const
Returns true if element is visible.
Definition IGUIElement.h:343
irr::gui::IGUIElement::setTabGroup
void setTabGroup(bool isGroup)
Sets whether this element is a container for a group of elements which can be navigated using the tab...
Definition IGUIElement.h:431
irr::gui::IGUIElement::MinSize
core::dimension2du MinSize
Definition IGUIElement.h:987
irr::gui::IGUIElement::setRelativePositionProportional
void setRelativePositionProportional(const core::rect< f32 > &r)
Sets the relative rectangle of this element as a proportion of its parent's area.
Definition IGUIElement.h:119
irr::gui::IGUIElement::isSubElement
virtual bool isSubElement() const
Returns true if this element was created as part of its parent control.
Definition IGUIElement.h:358
irr::gui::IGUIElement::getNextElement
bool getNextElement(s32 startOrder, bool reverse, bool group, IGUIElement *&first, IGUIElement *&closest, bool includeInvisible=false) const
searches elements to find the closest next element to tab to
Definition IGUIElement.h:630
irr::gui::IGUIElement::setRelativePosition
void setRelativePosition(const core::position2di &position)
Sets the relative rectangle of this element, maintaining its current width and height.
Definition IGUIElement.h:105
irr::gui::IGUIElement::IsEnabled
bool IsEnabled
is enabled?
Definition IGUIElement.h:993
irr::gui::IGUIElement::addChildToEnd
void addChildToEnd(IGUIElement *child)
Definition IGUIElement.h:818
irr::gui::IGUIElement::getToolTipText
virtual const core::stringw & getToolTipText() const
Returns caption of this element.
Definition IGUIElement.h:501
irr::gui::IGUIElement::AlignTop
EGUI_ALIGNMENT AlignTop
Definition IGUIElement.h:1023
irr::gui::IGUIElement::AlignRight
EGUI_ALIGNMENT AlignRight
Definition IGUIElement.h:1023
irr::gui::IGUIElement::bringToFront
virtual bool bringToFront(IGUIElement *element)
Brings a child to front.
Definition IGUIElement.h:530
irr::gui::IGUIElement::serializeAttributes
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const
Writes attributes of the scene node.
Definition IGUIElement.h:765
irr::gui::IGUIElement::OnPostRender
virtual void OnPostRender(u32 timeMs)
animate the element and its children.
Definition IGUIElement.h:324
irr::gui::IGUIElement::Name
core::stringc Name
users can set this for identificating the element by string
Definition IGUIElement.h:1008
irr::gui::IGUIElement::Type
EGUI_ELEMENT_TYPE Type
type of element
Definition IGUIElement.h:1029
irr::gui::IGUIElement::updateAbsolutePosition
virtual void updateAbsolutePosition()
Updates the absolute position.
Definition IGUIElement.h:217
irr::gui::IGUIElement::Parent
IGUIElement * Parent
Pointer to the parent.
Definition IGUIElement.h:965
irr::gui::IGUIElement::DesiredRect
core::rect< s32 > DesiredRect
Definition IGUIElement.h:978
irr::gui::IGUIElement::IsVisible
bool IsVisible
is visible?
Definition IGUIElement.h:990
irr::gui::IGUIElement::isEnabled
virtual bool isEnabled() const
Returns true if element is enabled.
Definition IGUIElement.h:462
irr::gui::IGUIElement::setMinSize
void setMinSize(core::dimension2du size)
Sets the minimum size allowed for this element.
Definition IGUIElement.h:179
irr::gui::IGUIElement::setMaxSize
void setMaxSize(core::dimension2du size)
Sets the maximum size allowed for this element.
Definition IGUIElement.h:171
irr::gui::IGUIElement::getParent
IGUIElement * getParent() const
Returns parent of this element.
Definition IGUIElement.h:66
irr::gui::IGUIElement::getElementFromPoint
IGUIElement * getElementFromPoint(const core::position2d< s32 > &point)
Returns the topmost GUI element at the specific position.
Definition IGUIElement.h:242
irr::gui::IGUIElement::getName
virtual const c8 * getName() const
Returns the name of the element.
Definition IGUIElement.h:740
irr::gui::IGUIElement::getType
EGUI_ELEMENT_TYPE getType() const
Returns the type of the gui element.
Definition IGUIElement.h:710
irr::gui::IGUIElement::setVisible
virtual void setVisible(bool visible)
Sets the visible state of this element.
Definition IGUIElement.h:351
irr::gui::IGUIElement::RelativeRect
core::rect< s32 > RelativeRect
relative rect of element
Definition IGUIElement.h:968
irr::gui::IGUIElement::getTabOrder
s32 getTabOrder() const
Returns the number in the tab order sequence.
Definition IGUIElement.h:422
irr::gui::IGUIElement::Text
core::stringw Text
caption
Definition IGUIElement.h:1002
irr::gui::IGUIElement::getAbsoluteClippingRect
core::rect< s32 > getAbsoluteClippingRect() const
Returns the visible area of the element.
Definition IGUIElement.h:146
irr::gui::IGUIElement::deserializeAttributes
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)
Reads attributes of the scene node.
Definition IGUIElement.h:789
irr::gui::IGUIElement::getID
virtual s32 getID() const
Returns id. Can be used to identify the element.
Definition IGUIElement.h:508
irr::gui::IGUIElement::getTypeName
virtual const c8 * getTypeName() const
Returns the type name of the gui element.
Definition IGUIElement.h:733
irr::gui::IGUIElement::remove
virtual void remove()
Removes this element from its parent.
Definition IGUIElement.h:304
irr::gui::IGUIElement::ScaleRect
core::rect< f32 > ScaleRect
relative scale of the element inside its parent
Definition IGUIElement.h:984
irr::gui::IGUIElement::IsTabStop
bool IsTabStop
tab stop like in windows
Definition IGUIElement.h:1014
irr::gui::IGUIEnvironment
GUI Environment. Used as factory and manager of all other GUI elements.
Definition IGUIEnvironment.h:71
irr::io::IAttributeExchangingObject
An object which is able to serialize and deserialize its attributes into an attributes object.
Definition IAttributeExchangingObject.h:52
irr::io::IAttributes
Provides a generic interface for attributes and their values and the possiblity to serialize them.
Definition IAttributes.h:42
irr::io::IAttributes::addString
virtual void addString(const c8 *attributeName, const c8 *value)=0
Adds an attribute as string.
irr::io::IAttributes::getAttributeAsBool
virtual bool getAttributeAsBool(const c8 *attributeName)=0
irr::io::IAttributes::addBool
virtual void addBool(const c8 *attributeName, bool value)=0
Adds an attribute as bool.
irr::io::IAttributes::getAttributeAsRect
virtual core::rect< s32 > getAttributeAsRect(const c8 *attributeName)=0
irr::io::IAttributes::getAttributeAsString
virtual core::stringc getAttributeAsString(const c8 *attributeName)=0
irr::io::IAttributes::getAttributeAsStringW
virtual core::stringw getAttributeAsStringW(const c8 *attributeName)=0
irr::io::IAttributes::addRect
virtual void addRect(const c8 *attributeName, core::rect< s32 > value)=0
Adds an attribute as rectangle.
irr::io::IAttributes::getAttributeAsPosition2d
virtual core::position2di getAttributeAsPosition2d(const c8 *attributeName)=0
irr::io::IAttributes::getAttributeAsInt
virtual s32 getAttributeAsInt(const c8 *attributeName) const =0
irr::io::IAttributes::addPosition2d
virtual void addPosition2d(const c8 *attributeName, core::position2di value)=0
Adds an attribute as 2d position.
irr::io::IAttributes::getAttributeAsEnumeration
virtual const c8 * getAttributeAsEnumeration(const c8 *attributeName)=0
irr::io::IAttributes::addEnum
virtual void addEnum(const c8 *attributeName, const c8 *enumValue, const c8 *const *enumerationLiterals)=0
Adds an attribute as enum.
irr::io::IAttributes::addInt
virtual void addInt(const c8 *attributeName, s32 value)=0
Adds an attribute as integer.
irrList.h
irrString.h
_IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
Defines a small statement to work around a microsoft compiler bug.
Definition irrTypes.h:207
irr::core::position2di
vector2d< s32 > position2di
Definition position2d.h:24
irr::core::floor32
REALINLINE s32 floor32(f32 x)
Definition irrMath.h:613
irr::core::dimension2di
dimension2d< s32 > dimension2di
Typedef for an integer dimension.
Definition dimension2d.h:217
irr::core::dimension2du
dimension2d< u32 > dimension2du
Typedef for an unsigned integer dimension.
Definition dimension2d.h:212
irr::core::stringc
string< c8 > stringc
Typedef for character strings.
Definition irrString.h:1358
irr::core::round32
REALINLINE s32 round32(f32 x)
Definition irrMath.h:680
irr::core::stringw
string< wchar_t > stringw
Typedef for wide character strings.
Definition irrString.h:1361
irr::core::dimension2df
dimension2d< f32 > dimension2df
Typedef for an f32 dimension.
Definition dimension2d.h:210
irr::gui
The gui namespace contains useful classes for easy creation of a graphical user interface.
Definition EGUIAlignment.h:11
irr::gui::EGUI_ALIGNMENT
EGUI_ALIGNMENT
Definition EGUIAlignment.h:13
irr::gui::EGUIA_SCALE
@ EGUIA_SCALE
Stretched to fit parent.
Definition EGUIAlignment.h:21
irr::gui::EGUIA_LOWERRIGHT
@ EGUIA_LOWERRIGHT
Aligned to parent's bottom or right side.
Definition EGUIAlignment.h:17
irr::gui::EGUIA_UPPERLEFT
@ EGUIA_UPPERLEFT
Aligned to parent's top or left side (default).
Definition EGUIAlignment.h:15
irr::gui::EGUIA_CENTER
@ EGUIA_CENTER
Aligned to the center of parent.
Definition EGUIAlignment.h:19
irr::gui::GUIAlignmentNames
const c8 *const GUIAlignmentNames[]
Names for alignments.
Definition EGUIAlignment.h:25
irr::gui::EGUI_ELEMENT_TYPE
EGUI_ELEMENT_TYPE
List of all basic Irrlicht GUI elements.
Definition EGUIElementTypes.h:18
irr::gui::GUIElementTypeNames
const c8 *const GUIElementTypeNames[]
Names for built-in element types.
Definition EGUIElementTypes.h:103
irr
Everything in the Irrlicht Engine can be found in this namespace.
Definition aabbox3d.h:13
irr::f32
float f32
32 bit floating point variable.
Definition irrTypes.h:104
irr::u32
unsigned int u32
32 bit unsigned variable.
Definition irrTypes.h:58
irr::c8
char c8
8 bit character variable.
Definition irrTypes.h:31
irr::s32
signed int s32
32 bit signed variable.
Definition irrTypes.h:66
rect.h
irr::SEvent
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
Definition IEventReceiver.h:263
irr::io::SAttributeReadWriteOptions
struct holding data describing options
Definition IAttributeExchangingObject.h:35
- Irrlicht Engine Documentation © 2003-2012 by Nikolaus Gebhardt. Generated on for Irrlicht 3D Engine by Doxygen 1.15.0