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