5 #ifndef __I_GUI_ELEMENT_H_INCLUDED__ 6 #define __I_GUI_ELEMENT_H_INCLUDED__ 222 (*it)->updateAbsolutePosition();
252 target = (*it)->getElementFromPoint(point);
278 if ( child && child !=
this )
327 (*it)->OnPostRender( timeMs );
333 virtual void move(core::position2d<s32> absoluteMovement)
540 if (element == (*it))
593 if ((*it)->getID() ==
id)
618 }
while (child->
Parent && child !=
this);
621 return child ==
this;
636 bool includeDisabled=
false)
const 639 s32 wanted = startOrder + ( reverse ? -1 : 1 );
645 s32 closestOrder, currentOrder;
650 if ( ( (*it)->isVisible() || includeInvisible ) &&
651 (
group ==
true || (*it)->isTabGroup() ==
false) )
654 if ( (*it)->isEnabled() || includeDisabled )
657 if ((*it)->isTabStop() && ((*it)->isTabGroup() ==
group))
659 currentOrder = (*it)->getTabOrder();
662 if (currentOrder == wanted)
672 if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
673 ||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
679 if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) )
687 closestOrder =
first->getTabOrder();
689 if ( (reverse && closestOrder < currentOrder) || (!reverse && closestOrder > currentOrder) )
701 if ((*it)->getNextElement(startOrder, reverse,
group,
first, closest))
855 parentAbsoluteClip =
p->AbsoluteClippingRect;
963 (*it)->recalculateAbsolutePosition(recursive);
virtual bool isVisible() const
Returns true if element is visible.
virtual const core::list< IGUIElement * > & getChildren() const
Returns list with children of this element.
virtual IGUIElement * getElementFromPoint(const core::position2d< s32 > &point)
Returns the topmost GUI element at the specific position.
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 possibility 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?
GLdouble GLdouble GLdouble r
float f32
32 bit floating point variable.
core::rect< s32 > RelativeRect
relative rect of element
virtual bool OnEvent(const SEvent &event) _IRR_OVERRIDE_
Called if an event happened.
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...
GLfloat GLfloat GLfloat GLfloat h
char c8
8 bit character variable.
position2d< T > UpperLeftCorner
Upper left corner.
Aligned to parent's top or left side (default)
virtual void remove()
Removes this element from its parent.
struct holding data describing options
T Y
Y coordinate of vector.
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 identifying 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.
core::dimension2du MinSize
virtual void addRect(const c8 *attributeName, const core::rect< s32 > &value)=0
Adds an attribute as rectangle.
GLuint const GLchar * name
core::dimension2du MaxSize
maximum and minimum size of the element
virtual void addBool(const c8 *attributeName, bool value)=0
Adds an attribute as bool.
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)
Very simple string class with some useful features.
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.
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const _IRR_OVERRIDE_
Writes attributes of the scene node.
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.
virtual bool isTrulyVisible() const
Check whether the element is truly visible, taking into accounts its parents' visibility.
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.
virtual void addPosition2d(const c8 *attributeName, const core::position2di &value)=0
Adds an attribute as 2d position.
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 deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) _IRR_OVERRIDE_
Reads attributes of the scene node.
void setRelativePosition(const core::position2di &position)
Sets the relative rectangle of this element, maintaining its current width and height.
GLenum GLenum GLsizei const GLuint GLboolean enabled
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.
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.
GLdouble GLdouble GLdouble GLdouble top
void grab() const
Grabs the object. Increments the reference counter by one.
#define _IRR_OVERRIDE_
Defines an override macro, to protect virtual functions from typos and other mismatches.
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.
GLuint GLuint GLsizei GLenum type
GLubyte GLubyte GLubyte GLubyte w
virtual void setVisible(bool visible)
Sets the visible state of this element.
T Height
Height of the dimension.
REALINLINE s32 floor32(f32 x)
virtual IGUIElement * getElementFromId(s32 id, bool searchchildren=false) const
Finds the first element with the given id.
s32 ID
users can set this for identifying the element by integer
void repair()
If the lower right corner of the rect is smaller then the upper left, the points are swapped.
bool getNextElement(s32 startOrder, bool reverse, bool group, IGUIElement *&first, IGUIElement *&closest, bool includeInvisible=false, bool includeDisabled=false) const
searches elements to find the closest next element to tab to
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.