5#ifndef __I_GUI_ELEMENT_H_INCLUDED__
6#define __I_GUI_ELEMENT_H_INCLUDED__
109 position.X + mySize.Width, position.Y + mySize.Height);
225 (*it)->updateAbsolutePosition();
330 (*it)->OnPostRender( timeMs );
535 if (element == (*it))
590 if ((*it)->getID() ==
id)
615 }
while (child->
Parent && child !=
this);
618 return child ==
this;
634 s32 wanted = startOrder + ( reverse ? -1 : 1 );
640 s32 closestOrder, currentOrder;
645 if ( ( (*it)->isVisible() || includeInvisible ) &&
646 (group ==
true || (*it)->isTabGroup() ==
false) )
649 if ((*it)->isTabStop() && ((*it)->isTabGroup() == group))
651 currentOrder = (*it)->getTabOrder();
654 if (currentOrder == wanted)
664 if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
665 ||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
671 if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) )
681 if ( (reverse && closestOrder < currentOrder) || (!reverse && closestOrder > currentOrder) )
692 if ((*it)->getNextElement(startOrder, reverse, group, first, closest))
856 fw = (
f32)parentAbsolute.getWidth();
859 fh = (
f32)parentAbsolute.getHeight();
954 (*it)->recalculateAbsolutePosition(recursive);
Interface of an object which can receive events.
void grab() const
Grabs the object. Increments the reference counter by one.
void setDebugName(const c8 *newName)
Sets the debug name of the object.
Axis aligned bounding box in 3d dimensional space.
T Width
Width of the dimension.
T Height
Height of the dimension.
List iterator for const access.
dimension2d< T > getSize() const
Get the dimensions of the rectangle.
bool isPointInside(const position2d< T > &pos) const
Returns if a 2d point is within this rectangle.
void repair()
If the lower right corner of the rect is smaller then the upper left, the points are swapped.
void clipAgainst(const rect< T > &other)
Clips this rectangle with another one.
position2d< T > LowerRightCorner
Lower right corner.
position2d< T > UpperLeftCorner
Upper left corner.
T getHeight() const
Get height of rectangle.
T getWidth() const
Get width of rectangle.
Base class of all GUI elements.
core::rect< s32 > LastParentRect
for calculating the difference when resizing parent
core::rect< s32 > AbsoluteRect
absolute rect of element
virtual ~IGUIElement()
Destructor.
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
void setRelativePosition(const core::rect< s32 > &r)
Sets the relative rectangle of this element.
bool isTabStop() const
Returns true if this element can be focused by navigating with the tab key.
core::rect< s32 > AbsoluteClippingRect
absolute clipping rect of element
core::dimension2du MaxSize
maximum and minimum size of the element
bool IsSubElement
is a part of a larger whole and should not be serialized?
void setTabOrder(s32 index)
Sets the priority of focus when using the tab key to navigate between a group of elements.
virtual bool isPointInside(const core::position2d< s32 > &point) const
Returns true if a point is within this element.
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...
virtual void draw()
Draws the element and its children.
virtual const wchar_t * getText() const
Returns caption of this element.
virtual void addChild(IGUIElement *child)
Adds a GUI element as new child of this element.
virtual void setEnabled(bool enabled)
Sets the enabled state of this element.
virtual void removeChild(IGUIElement *child)
Removes a child.
core::rect< s32 > getRelativePosition() const
Returns the relative rectangle of this element.
virtual bool hasType(EGUI_ELEMENT_TYPE type) const
Returns true if the gui element supports the given type.
EGUI_ALIGNMENT AlignBottom
core::stringw ToolTipText
tooltip
void recalculateAbsolutePosition(bool recursive)
virtual void setName(const c8 *name)
Sets the name of the element.
virtual void setSubElement(bool subElement)
Sets whether this control was created as part of its parent.
IGUIElement * getTabGroup()
Returns the container element which holds all elements in this element's tab group.
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
virtual bool OnEvent(const SEvent &event)
Called if an event happened.
virtual void setID(s32 id)
Sets the id of this element.
void setTabStop(bool enable)
If set to true, the focus will visit this element when using the tab key to cycle through elements.
virtual void setName(const core::stringc &name)
Sets the name of the element.
virtual void setToolTipText(const wchar_t *text)
Sets the new caption of this element.
bool isTabGroup() const
Returns true if this element is a tab group.
bool isMyChild(IGUIElement *child) const
s32 ID
users can set this for identificating the element by integer
IGUIEnvironment * Environment
GUI Environment.
void setNotClipped(bool noClip)
Sets whether the element will ignore its parent's clipping rectangle.
virtual void move(core::position2d< s32 > absoluteMovement)
Moves this element.
virtual const core::list< IGUIElement * > & getChildren() const
Returns list with children of this element.
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
virtual void setText(const wchar_t *text)
Sets the new caption of this element.
bool NoClip
does this element ignore its parent's clipping rectangle?
core::list< IGUIElement * > Children
List of all children of this element.
bool isNotClipped() const
Gets whether the element will ignore its parent's clipping rectangle.
core::rect< s32 > getAbsolutePosition() const
Gets the absolute rectangle of this element.
virtual bool sendToBack(IGUIElement *child)
Moves a child to the back, so it's siblings are drawn on top of it.
virtual IGUIElement * getElementFromId(s32 id, bool searchchildren=false) const
Finds the first element with the given id.
virtual bool isVisible() const
Returns true if element is visible.
void setTabGroup(bool isGroup)
Sets whether this element is a container for a group of elements which can be navigated using the tab...
core::dimension2du MinSize
void setRelativePositionProportional(const core::rect< f32 > &r)
Sets the relative rectangle of this element as a proportion of its parent's area.
virtual bool isSubElement() const
Returns true if this element was created as part of its parent control.
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
void setRelativePosition(const core::position2di &position)
Sets the relative rectangle of this element, maintaining its current width and height.
bool IsEnabled
is enabled?
void addChildToEnd(IGUIElement *child)
virtual const core::stringw & getToolTipText() const
Returns caption of this element.
EGUI_ALIGNMENT AlignRight
virtual bool bringToFront(IGUIElement *element)
Brings a child to front.
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const
Writes attributes of the scene node.
virtual void OnPostRender(u32 timeMs)
animate the element and its children.
core::stringc Name
users can set this for identificating the element by string
EGUI_ELEMENT_TYPE Type
type of element
virtual void updateAbsolutePosition()
Updates the absolute position.
IGUIElement * Parent
Pointer to the parent.
core::rect< s32 > DesiredRect
bool IsVisible
is visible?
virtual bool isEnabled() const
Returns true if element is enabled.
void setMinSize(core::dimension2du size)
Sets the minimum size allowed for this element.
void setMaxSize(core::dimension2du size)
Sets the maximum size allowed for this element.
IGUIElement * getParent() const
Returns parent of this element.
IGUIElement * getElementFromPoint(const core::position2d< s32 > &point)
Returns the topmost GUI element at the specific position.
virtual const c8 * getName() const
Returns the name of the element.
EGUI_ELEMENT_TYPE getType() const
Returns the type of the gui element.
virtual void setVisible(bool visible)
Sets the visible state of this element.
core::rect< s32 > RelativeRect
relative rect of element
s32 getTabOrder() const
Returns the number in the tab order sequence.
core::stringw Text
caption
core::rect< s32 > getAbsoluteClippingRect() const
Returns the visible area of the element.
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)
Reads attributes of the scene node.
virtual s32 getID() const
Returns id. Can be used to identify the element.
virtual const c8 * getTypeName() const
Returns the type name of the gui element.
virtual void remove()
Removes this element from its parent.
core::rect< f32 > ScaleRect
relative scale of the element inside its parent
bool IsTabStop
tab stop like in windows
GUI Environment. Used as factory and manager of all other GUI elements.
An object which is able to serialize and deserialize its attributes into an attributes object.
Provides a generic interface for attributes and their values and the possiblity to serialize them.
virtual void addString(const c8 *attributeName, const c8 *value)=0
Adds an attribute as string.
virtual bool getAttributeAsBool(const c8 *attributeName)=0
virtual void addBool(const c8 *attributeName, bool value)=0
Adds an attribute as bool.
virtual core::rect< s32 > getAttributeAsRect(const c8 *attributeName)=0
virtual core::stringc getAttributeAsString(const c8 *attributeName)=0
virtual core::stringw getAttributeAsStringW(const c8 *attributeName)=0
virtual void addRect(const c8 *attributeName, core::rect< s32 > value)=0
Adds an attribute as rectangle.
virtual core::position2di getAttributeAsPosition2d(const c8 *attributeName)=0
virtual s32 getAttributeAsInt(const c8 *attributeName) const =0
virtual void addPosition2d(const c8 *attributeName, core::position2di value)=0
Adds an attribute as 2d position.
virtual const c8 * getAttributeAsEnumeration(const c8 *attributeName)=0
virtual void addEnum(const c8 *attributeName, const c8 *enumValue, const c8 *const *enumerationLiterals)=0
Adds an attribute as enum.
virtual void addInt(const c8 *attributeName, s32 value)=0
Adds an attribute as integer.
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
Defines a small statement to work around a microsoft compiler bug.
REALINLINE s32 floor32(f32 x)
REALINLINE s32 round32(f32 x)
@ EGUIA_SCALE
Stretched to fit parent.
@ EGUIA_LOWERRIGHT
Aligned to parent's bottom or right side.
@ EGUIA_UPPERLEFT
Aligned to parent's top or left side (default)
@ EGUIA_CENTER
Aligned to the center of parent.
const c8 *const GUIAlignmentNames[]
Names for alignments.
EGUI_ELEMENT_TYPE
List of all basic Irrlicht GUI elements.
const c8 *const GUIElementTypeNames[]
Names for built-in element types.
Everything in the Irrlicht Engine can be found in this namespace.
float f32
32 bit floating point variable.
unsigned int u32
32 bit unsigned variable.
char c8
8 bit character variable.
signed int s32
32 bit signed variable.
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
struct holding data describing options