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