arsa  2.7
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
irr::gui::IGUIElement Class Reference

Base class of all GUI elements. More...

#include <IGUIElement.h>

Inheritance diagram for irr::gui::IGUIElement:
irr::io::IAttributeExchangingObject irr::IEventReceiver irr::IReferenceCounted irr::gui::IGUIButton irr::gui::IGUICheckBox irr::gui::IGUIColorSelectDialog irr::gui::IGUIComboBox irr::gui::IGUIContextMenu irr::gui::IGUIEditBox irr::gui::IGUIFileOpenDialog irr::gui::IGUIImage irr::gui::IGUIInOutFader irr::gui::IGUIListBox irr::gui::IGUIMeshViewer irr::gui::IGUIProfiler irr::gui::IGUIScrollBar irr::gui::IGUISpinBox irr::gui::IGUIStaticText irr::gui::IGUITab irr::gui::IGUITabControl irr::gui::IGUITable irr::gui::IGUIToolBar irr::gui::IGUITreeView irr::gui::IGUIWindow

Public Member Functions

 IGUIElement (EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
 Constructor. More...
 
virtual ~IGUIElement ()
 Destructor. More...
 
IGUIElementgetParent () const
 Returns parent of this element. More...
 
core::rect< s32getRelativePosition () const
 Returns the relative rectangle of this element. More...
 
void setRelativePosition (const core::rect< s32 > &r)
 Sets the relative rectangle of this element. More...
 
void setRelativePosition (const core::position2di &position)
 Sets the relative rectangle of this element, maintaining its current width and height. More...
 
void setRelativePositionProportional (const core::rect< f32 > &r)
 Sets the relative rectangle of this element as a proportion of its parent's area. More...
 
core::rect< s32getAbsolutePosition () const
 Gets the absolute rectangle of this element. More...
 
core::rect< s32getAbsoluteClippingRect () const
 Returns the visible area of the element. More...
 
void setNotClipped (bool noClip)
 Sets whether the element will ignore its parent's clipping rectangle. More...
 
bool isNotClipped () const
 Gets whether the element will ignore its parent's clipping rectangle. More...
 
void setMaxSize (core::dimension2du size)
 Sets the maximum size allowed for this element. More...
 
void setMinSize (core::dimension2du size)
 Sets the minimum size allowed for this element. More...
 
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 resized. More...
 
virtual void updateAbsolutePosition ()
 Updates the absolute position. More...
 
virtual IGUIElementgetElementFromPoint (const core::position2d< s32 > &point)
 Returns the topmost GUI element at the specific position. More...
 
virtual bool isPointInside (const core::position2d< s32 > &point) const
 Returns true if a point is within this element. More...
 
virtual void addChild (IGUIElement *child)
 Adds a GUI element as new child of this element. More...
 
virtual void removeChild (IGUIElement *child)
 Removes a child. More...
 
virtual void remove ()
 Removes this element from its parent. More...
 
virtual void draw ()
 Draws the element and its children. More...
 
virtual void OnPostRender (u32 timeMs)
 animate the element and its children. More...
 
virtual void move (core::position2d< s32 > absoluteMovement)
 Moves this element. More...
 
virtual bool isVisible () const
 Returns true if element is visible. More...
 
virtual bool isTrulyVisible () const
 Check whether the element is truly visible, taking into accounts its parents' visibility. More...
 
virtual void setVisible (bool visible)
 Sets the visible state of this element. More...
 
virtual bool isSubElement () const
 Returns true if this element was created as part of its parent control. More...
 
virtual void setSubElement (bool subElement)
 Sets whether this control was created as part of its parent. More...
 
void setTabStop (bool enable)
 If set to true, the focus will visit this element when using the tab key to cycle through elements. More...
 
bool isTabStop () const
 Returns true if this element can be focused by navigating with the tab key. More...
 
void setTabOrder (s32 index)
 Sets the priority of focus when using the tab key to navigate between a group of elements. More...
 
s32 getTabOrder () const
 Returns the number in the tab order sequence. More...
 
void setTabGroup (bool isGroup)
 Sets whether this element is a container for a group of elements which can be navigated using the tab key. More...
 
bool isTabGroup () const
 Returns true if this element is a tab group. More...
 
IGUIElementgetTabGroup ()
 Returns the container element which holds all elements in this element's tab group. More...
 
virtual bool isEnabled () const
 Returns true if element is enabled. More...
 
virtual void setEnabled (bool enabled)
 Sets the enabled state of this element. More...
 
virtual void setText (const wchar_t *text)
 Sets the new caption of this element. More...
 
virtual const wchar_t * getText () const
 Returns caption of this element. More...
 
virtual void setToolTipText (const wchar_t *text)
 Sets the new caption of this element. More...
 
virtual const core::stringwgetToolTipText () const
 Returns caption of this element. More...
 
virtual s32 getID () const
 Returns id. Can be used to identify the element. More...
 
virtual void setID (s32 id)
 Sets the id of this element. More...
 
virtual bool OnEvent (const SEvent &event) _IRR_OVERRIDE_
 Called if an event happened. More...
 
virtual bool bringToFront (IGUIElement *element)
 Brings a child to front. More...
 
virtual bool sendToBack (IGUIElement *child)
 Moves a child to the back, so it's siblings are drawn on top of it. More...
 
virtual const core::list< IGUIElement * > & getChildren () const
 Returns list with children of this element. More...
 
virtual IGUIElementgetElementFromId (s32 id, bool searchchildren=false) const
 Finds the first element with the given id. More...
 
bool isMyChild (IGUIElement *child) const
 
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 More...
 
EGUI_ELEMENT_TYPE getType () const
 Returns the type of the gui element. More...
 
virtual bool hasType (EGUI_ELEMENT_TYPE type) const
 Returns true if the gui element supports the given type. More...
 
virtual const c8getTypeName () const
 Returns the type name of the gui element. More...
 
virtual const c8getName () const
 Returns the name of the element. More...
 
virtual void setName (const c8 *name)
 Sets the name of the element. More...
 
virtual void setName (const core::stringc &name)
 Sets the name of the element. More...
 
virtual void serializeAttributes (io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const _IRR_OVERRIDE_
 Writes attributes of the scene node. More...
 
virtual void deserializeAttributes (io::IAttributes *in, io::SAttributeReadWriteOptions *options=0) _IRR_OVERRIDE_
 Reads attributes of the scene node. More...
 
- Public Member Functions inherited from irr::IReferenceCounted
 IReferenceCounted ()
 Constructor. More...
 
virtual ~IReferenceCounted ()
 Destructor. More...
 
void grab () const
 Grabs the object. Increments the reference counter by one. More...
 
bool drop () const
 Drops the object. Decrements the reference counter by one. More...
 
s32 getReferenceCount () const
 Get the reference count. More...
 
const c8getDebugName () const
 Returns the debug name of the object. More...
 
- Public Member Functions inherited from irr::IEventReceiver
virtual ~IEventReceiver ()
 Destructor. More...
 

Protected Member Functions

void addChildToEnd (IGUIElement *child)
 
void recalculateAbsolutePosition (bool recursive)
 
- Protected Member Functions inherited from irr::IReferenceCounted
void setDebugName (const c8 *newName)
 Sets the debug name of the object. More...
 

Protected Attributes

core::list< IGUIElement * > Children
 List of all children of this element. More...
 
IGUIElementParent
 Pointer to the parent. More...
 
core::rect< s32RelativeRect
 relative rect of element More...
 
core::rect< s32AbsoluteRect
 absolute rect of element More...
 
core::rect< s32AbsoluteClippingRect
 absolute clipping rect of element More...
 
core::rect< s32DesiredRect
 
core::rect< s32LastParentRect
 for calculating the difference when resizing parent More...
 
core::rect< f32ScaleRect
 relative scale of the element inside its parent More...
 
core::dimension2du MaxSize
 maximum and minimum size of the element More...
 
core::dimension2du MinSize
 
bool IsVisible
 is visible? More...
 
bool IsEnabled
 is enabled? More...
 
bool IsSubElement
 is a part of a larger whole and should not be serialized? More...
 
bool NoClip
 does this element ignore its parent's clipping rectangle? More...
 
core::stringw Text
 caption More...
 
core::stringw ToolTipText
 tooltip More...
 
core::stringc Name
 users can set this for identifying the element by string More...
 
s32 ID
 users can set this for identifying the element by integer More...
 
bool IsTabStop
 tab stop like in windows More...
 
s32 TabOrder
 tab order More...
 
bool IsTabGroup
 tab groups are containers like windows, use ctrl+tab to navigate More...
 
EGUI_ALIGNMENT AlignLeft
 tells the element how to act when its parent is resized More...
 
EGUI_ALIGNMENT AlignRight
 
EGUI_ALIGNMENT AlignTop
 
EGUI_ALIGNMENT AlignBottom
 
IGUIEnvironmentEnvironment
 GUI Environment. More...
 
EGUI_ELEMENT_TYPE Type
 type of element More...
 

Detailed Description

Base class of all GUI elements.

Definition at line 23 of file IGUIElement.h.

Constructor & Destructor Documentation

◆ IGUIElement()

irr::gui::IGUIElement::IGUIElement ( EGUI_ELEMENT_TYPE  type,
IGUIEnvironment environment,
IGUIElement parent,
s32  id,
const core::rect< s32 > &  rectangle 
)
inline

Constructor.

Definition at line 28 of file IGUIElement.h.

30  : Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle),
31  AbsoluteClippingRect(rectangle), DesiredRect(rectangle),
32  MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true),
33  IsSubElement(false), NoClip(false), ID(id), IsTabStop(false), TabOrder(-1), IsTabGroup(false),
35  Environment(environment), Type(type)
36  {
37  #ifdef _DEBUG
38  setDebugName("IGUIElement");
39  #endif
40 
41  // if we were given a parent to attach to
42  if (parent)
43  {
44  parent->addChildToEnd(this);
46  }
47  }
EGUI_ALIGNMENT AlignTop
Definition: IGUIElement.h:1032
s32 TabOrder
tab order
Definition: IGUIElement.h:1026
bool IsVisible
is visible?
Definition: IGUIElement.h:999
EGUI_ALIGNMENT AlignBottom
Definition: IGUIElement.h:1032
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
bool IsEnabled
is enabled?
Definition: IGUIElement.h:1002
core::rect< s32 > RelativeRect
relative rect of element
Definition: IGUIElement.h:977
Aligned to parent's top or left side (default)
Definition: EGUIAlignment.h:15
EGUI_ALIGNMENT AlignRight
Definition: IGUIElement.h:1032
core::dimension2du MinSize
Definition: IGUIElement.h:996
core::dimension2du MaxSize
maximum and minimum size of the element
Definition: IGUIElement.h:996
void recalculateAbsolutePosition(bool recursive)
Definition: IGUIElement.h:840
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition: IGUIElement.h:1032
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition: IGUIElement.h:1029
bool IsSubElement
is a part of a larger whole and should not be serialized?
Definition: IGUIElement.h:1005
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974
IGUIEnvironment * Environment
GUI Environment.
Definition: IGUIElement.h:1035
bool IsTabStop
tab stop like in windows
Definition: IGUIElement.h:1023
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition: IGUIElement.h:1008
core::rect< s32 > AbsoluteClippingRect
absolute clipping rect of element
Definition: IGUIElement.h:983
EGUI_ELEMENT_TYPE Type
type of element
Definition: IGUIElement.h:1038
void setDebugName(const c8 *newName)
Sets the debug name of the object.
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
s32 ID
users can set this for identifying the element by integer
Definition: IGUIElement.h:1020
core::rect< s32 > AbsoluteRect
absolute rect of element
Definition: IGUIElement.h:980

◆ ~IGUIElement()

virtual irr::gui::IGUIElement::~IGUIElement ( )
inlinevirtual

Destructor.

Definition at line 51 of file IGUIElement.h.

52  {
53  // delete all children
54  core::list<IGUIElement*>::Iterator it = Children.begin();
55  for (; it != Children.end(); ++it)
56  {
57  (*it)->Parent = 0;
58  (*it)->drop();
59  }
60  }
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

Member Function Documentation

◆ addChild()

virtual void irr::gui::IGUIElement::addChild ( IGUIElement child)
inlinevirtual

Adds a GUI element as new child of this element.

Definition at line 276 of file IGUIElement.h.

277  {
278  if ( child && child != this )
279  {
280  addChildToEnd(child);
281  child->updateAbsolutePosition();
282  }
283  }
void addChildToEnd(IGUIElement *child)
Definition: IGUIElement.h:827

◆ addChildToEnd()

void irr::gui::IGUIElement::addChildToEnd ( IGUIElement child)
inlineprotected

Definition at line 827 of file IGUIElement.h.

828  {
829  if (child)
830  {
831  child->grab(); // prevent destruction when removed
832  child->remove(); // remove from old parent
833  child->LastParentRect = getAbsolutePosition();
834  child->Parent = this;
835  Children.push_back(child);
836  }
837  }
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971
core::rect< s32 > getAbsolutePosition() const
Gets the absolute rectangle of this element.
Definition: IGUIElement.h:136

◆ bringToFront()

virtual bool irr::gui::IGUIElement::bringToFront ( IGUIElement element)
inlinevirtual

Brings a child to front.

Returns
True if successful, false if not.

Definition at line 535 of file IGUIElement.h.

536  {
537  core::list<IGUIElement*>::Iterator it = Children.begin();
538  for (; it != Children.end(); ++it)
539  {
540  if (element == (*it))
541  {
542  Children.erase(it);
543  Children.push_back(element);
544  return true;
545  }
546  }
547 
548  return false;
549  }
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

◆ deserializeAttributes()

virtual void irr::gui::IGUIElement::deserializeAttributes ( io::IAttributes in,
io::SAttributeReadWriteOptions options = 0 
)
inlinevirtual

Reads attributes of the scene node.

Implement this to set the attributes of your scene node for scripting languages, editors, debuggers or xml deserialization purposes.

Reimplemented from irr::io::IAttributeExchangingObject.

Definition at line 797 of file IGUIElement.h.

798  {
799  setName(in->getAttributeAsString("Name", Name));
800  setID(in->getAttributeAsInt("Id", ID));
801  setText(in->getAttributeAsStringW("Caption", Text).c_str());
802  setToolTipText(in->getAttributeAsStringW("ToolTip").c_str());
803  setVisible(in->getAttributeAsBool("Visible", IsVisible));
804  setEnabled(in->getAttributeAsBool("Enabled", IsEnabled));
805  IsTabStop = in->getAttributeAsBool("TabStop", IsTabStop);
806  IsTabGroup = in->getAttributeAsBool("TabGroup", IsTabGroup);
807  TabOrder = in->getAttributeAsInt("TabOrder", TabOrder);
808 
809  core::position2di p = in->getAttributeAsPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
811 
812  p = in->getAttributeAsPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
814 
815  setAlignment((EGUI_ALIGNMENT) in->getAttributeAsEnumeration("LeftAlign", GUIAlignmentNames, AlignLeft),
816  (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("RightAlign", GUIAlignmentNames, AlignRight),
817  (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("TopAlign", GUIAlignmentNames, AlignTop),
818  (EGUI_ALIGNMENT)in->getAttributeAsEnumeration("BottomAlign", GUIAlignmentNames, AlignBottom));
819 
820  setRelativePosition(in->getAttributeAsRect("Rect", DesiredRect));
821 
822  setNotClipped(in->getAttributeAsBool("NoClip", NoClip));
823  }
EGUI_ALIGNMENT AlignTop
Definition: IGUIElement.h:1032
dimension2d< u32 > dimension2du
Typedef for an unsigned integer dimension.
Definition: dimension2d.h:212
s32 TabOrder
tab order
Definition: IGUIElement.h:1026
bool IsVisible
is visible?
Definition: IGUIElement.h:999
EGUI_ALIGNMENT AlignBottom
Definition: IGUIElement.h:1032
virtual void setToolTipText(const wchar_t *text)
Sets the new caption of this element.
Definition: IGUIElement.h:499
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
const c8 *const GUIAlignmentNames[]
Names for alignments.
Definition: EGUIAlignment.h:25
bool IsEnabled
is enabled?
Definition: IGUIElement.h:1002
core::stringw Text
caption
Definition: IGUIElement.h:1011
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:188
GLfloat GLfloat p
EGUI_ALIGNMENT AlignRight
Definition: IGUIElement.h:1032
core::stringc Name
users can set this for identifying the element by string
Definition: IGUIElement.h:1017
core::dimension2du MinSize
Definition: IGUIElement.h:996
core::dimension2du MaxSize
maximum and minimum size of the element
Definition: IGUIElement.h:996
void setMaxSize(core::dimension2du size)
Sets the maximum size allowed for this element.
Definition: IGUIElement.h:168
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition: IGUIElement.h:1032
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition: IGUIElement.h:1029
virtual void setID(s32 id)
Sets the id of this element.
Definition: IGUIElement.h:520
void setNotClipped(bool noClip)
Sets whether the element will ignore its parent's clipping rectangle.
Definition: IGUIElement.h:151
void setRelativePosition(const core::rect< s32 > &r)
Sets the relative rectangle of this element.
Definition: IGUIElement.h:78
bool IsTabStop
tab stop like in windows
Definition: IGUIElement.h:1023
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition: IGUIElement.h:1008
T Width
Width of the dimension.
Definition: dimension2d.h:204
virtual void setEnabled(bool enabled)
Sets the enabled state of this element.
Definition: IGUIElement.h:478
void setMinSize(core::dimension2du size)
Sets the minimum size allowed for this element.
Definition: IGUIElement.h:176
virtual void setText(const wchar_t *text)
Sets the new caption of this element.
Definition: IGUIElement.h:485
vector2d< s32 > position2di
Definition: position2d.h:24
virtual void setVisible(bool visible)
Sets the visible state of this element.
Definition: IGUIElement.h:360
T Height
Height of the dimension.
Definition: dimension2d.h:206
GLuint in
s32 ID
users can set this for identifying the element by integer
Definition: IGUIElement.h:1020
virtual void setName(const c8 *name)
Sets the name of the element.
Definition: IGUIElement.h:755

◆ draw()

virtual void irr::gui::IGUIElement::draw ( )
inlinevirtual

Draws the element and its children.

Definition at line 309 of file IGUIElement.h.

310  {
311  if ( isVisible() )
312  {
313  core::list<IGUIElement*>::Iterator it = Children.begin();
314  for (; it != Children.end(); ++it)
315  (*it)->draw();
316  }
317  }
virtual bool isVisible() const
Returns true if element is visible.
Definition: IGUIElement.h:340
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

◆ getAbsoluteClippingRect()

core::rect<s32> irr::gui::IGUIElement::getAbsoluteClippingRect ( ) const
inline

Returns the visible area of the element.

Definition at line 143 of file IGUIElement.h.

144  {
145  return AbsoluteClippingRect;
146  }
core::rect< s32 > AbsoluteClippingRect
absolute clipping rect of element
Definition: IGUIElement.h:983

◆ getAbsolutePosition()

core::rect<s32> irr::gui::IGUIElement::getAbsolutePosition ( ) const
inline

Gets the absolute rectangle of this element.

Definition at line 136 of file IGUIElement.h.

137  {
138  return AbsoluteRect;
139  }
core::rect< s32 > AbsoluteRect
absolute rect of element
Definition: IGUIElement.h:980

◆ getChildren()

virtual const core::list<IGUIElement*>& irr::gui::IGUIElement::getChildren ( ) const
inlinevirtual

Returns list with children of this element.

Definition at line 573 of file IGUIElement.h.

574  {
575  return Children;
576  }
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

◆ getElementFromId()

virtual IGUIElement* irr::gui::IGUIElement::getElementFromId ( s32  id,
bool  searchchildren = false 
) const
inlinevirtual

Finds the first element with the given id.

Parameters
idId to search for.
searchchildrenSet this to true, if also children of this element may contain the element with the searched id and they should be searched too.
Returns
Returns the first element with the given id. If no element with this id was found, 0 is returned.

Definition at line 586 of file IGUIElement.h.

587  {
588  IGUIElement* e = 0;
589 
590  core::list<IGUIElement*>::ConstIterator it = Children.begin();
591  for (; it != Children.end(); ++it)
592  {
593  if ((*it)->getID() == id)
594  return (*it);
595 
596  if (searchchildren)
597  e = (*it)->getElementFromId(id, true);
598 
599  if (e)
600  return e;
601  }
602 
603  return e;
604  }
GLuint id
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
Definition: IGUIElement.h:28
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

◆ getElementFromPoint()

virtual IGUIElement* irr::gui::IGUIElement::getElementFromPoint ( const core::position2d< s32 > &  point)
inlinevirtual

Returns the topmost GUI element at the specific position.

This will check this GUI element and all of its descendants, so it may return this GUI element. To check all GUI elements, call this function on device->getGUIEnvironment()->getRootGUIElement(). Note that the root element is the size of the screen, so doing so (with an on-screen point) will always return the root element if no other element is above it at that point.

Parameters
pointThe point at which to find a GUI element.
Returns
The topmost GUI element at that point, or 0 if there are no candidate elements at this point.

Definition at line 239 of file IGUIElement.h.

240  {
241  IGUIElement* target = 0;
242 
243  // we have to search from back to front, because later children
244  // might be drawn over the top of earlier ones.
245 
246  core::list<IGUIElement*>::ConstIterator it = Children.getLast();
247 
248  if (isVisible())
249  {
250  while(it != Children.end())
251  {
252  target = (*it)->getElementFromPoint(point);
253  if (target)
254  return target;
255 
256  --it;
257  }
258  }
259 
260  if (isVisible() && isPointInside(point))
261  target = this;
262 
263  return target;
264  }
virtual bool isVisible() const
Returns true if element is visible.
Definition: IGUIElement.h:340
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
Definition: IGUIElement.h:28
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971
virtual bool isPointInside(const core::position2d< s32 > &point) const
Returns true if a point is within this element.
Definition: IGUIElement.h:269
GLenum target

◆ getID()

virtual s32 irr::gui::IGUIElement::getID ( ) const
inlinevirtual

Returns id. Can be used to identify the element.

Definition at line 513 of file IGUIElement.h.

514  {
515  return ID;
516  }
s32 ID
users can set this for identifying the element by integer
Definition: IGUIElement.h:1020

◆ getName()

virtual const c8* irr::gui::IGUIElement::getName ( ) const
inlinevirtual

Returns the name of the element.

Returns
Name as character string.

Definition at line 747 of file IGUIElement.h.

748  {
749  return Name.c_str();
750  }
core::stringc Name
users can set this for identifying the element by string
Definition: IGUIElement.h:1017
const T * c_str() const
Returns character string.
Definition: irrString.h:526

◆ getNextElement()

bool irr::gui::IGUIElement::getNextElement ( s32  startOrder,
bool  reverse,
bool  group,
IGUIElement *&  first,
IGUIElement *&  closest,
bool  includeInvisible = false,
bool  includeDisabled = false 
) const
inline

searches elements to find the closest next element to tab to

Parameters
startOrderThe TabOrder of the current element, -1 if none
reversetrue if searching for a lower number
grouptrue if searching for a higher one
firstelement with the highest/lowest known tab order depending on search direction
closestthe closest match, depending on tab order and direction
includeInvisibleincludes invisible elements in the search (default=false)
includeDisabledincludes disabled elements in the search (default=false)
Returns
true if successfully found an element, false to continue searching/fail

Definition at line 634 of file IGUIElement.h.

637  {
638  // we'll stop searching if we find this number
639  s32 wanted = startOrder + ( reverse ? -1 : 1 );
640  if (wanted==-2)
641  wanted = 1073741824; // maximum s32
642 
643  core::list<IGUIElement*>::ConstIterator it = Children.begin();
644 
645  s32 closestOrder, currentOrder;
646 
647  while(it != Children.end())
648  {
649  // ignore invisible elements and their children
650  if ( ( (*it)->isVisible() || includeInvisible ) &&
651  (group == true || (*it)->isTabGroup() == false) )
652  {
653  // ignore disabled, but children are checked (disabled is currently per element ignoring parent states)
654  if ( (*it)->isEnabled() || includeDisabled )
655  {
656  // only check tab stops and those with the same group status
657  if ((*it)->isTabStop() && ((*it)->isTabGroup() == group))
658  {
659  currentOrder = (*it)->getTabOrder();
660 
661  // is this what we're looking for?
662  if (currentOrder == wanted)
663  {
664  closest = *it;
665  return true;
666  }
667 
668  // is it closer than the current closest?
669  if (closest)
670  {
671  closestOrder = closest->getTabOrder();
672  if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
673  ||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
674  {
675  closest = *it;
676  }
677  }
678  else
679  if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) )
680  {
681  closest = *it;
682  }
683 
684  // is it before the current first?
685  if (first)
686  {
687  closestOrder = first->getTabOrder();
688 
689  if ( (reverse && closestOrder < currentOrder) || (!reverse && closestOrder > currentOrder) )
690  {
691  first = *it;
692  }
693  }
694  else
695  {
696  first = *it;
697  }
698  }
699  }
700  // search within children
701  if ((*it)->getNextElement(startOrder, reverse, group, first, closest))
702  {
703  return true;
704  }
705  }
706  ++it;
707  }
708  return false;
709  }
GLboolean GLuint group
const GLint * first
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70

◆ getParent()

IGUIElement* irr::gui::IGUIElement::getParent ( ) const
inline

Returns parent of this element.

Definition at line 64 of file IGUIElement.h.

65  {
66  return Parent;
67  }
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974

◆ getRelativePosition()

core::rect<s32> irr::gui::IGUIElement::getRelativePosition ( ) const
inline

Returns the relative rectangle of this element.

Definition at line 70 of file IGUIElement.h.

71  {
72  return RelativeRect;
73  }
core::rect< s32 > RelativeRect
relative rect of element
Definition: IGUIElement.h:977

◆ getTabGroup()

IGUIElement* irr::gui::IGUIElement::getTabGroup ( )
inline

Returns the container element which holds all elements in this element's tab group.

Definition at line 452 of file IGUIElement.h.

453  {
454  IGUIElement *ret=this;
455 
456  while (ret && !ret->isTabGroup())
457  ret = ret->getParent();
458 
459  return ret;
460  }
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
Definition: IGUIElement.h:28

◆ getTabOrder()

s32 irr::gui::IGUIElement::getTabOrder ( ) const
inline

Returns the number in the tab order sequence.

Definition at line 429 of file IGUIElement.h.

430  {
431  return TabOrder;
432  }
s32 TabOrder
tab order
Definition: IGUIElement.h:1026

◆ getText()

virtual const wchar_t* irr::gui::IGUIElement::getText ( ) const
inlinevirtual

Returns caption of this element.

Definition at line 492 of file IGUIElement.h.

493  {
494  return Text.c_str();
495  }
core::stringw Text
caption
Definition: IGUIElement.h:1011
const T * c_str() const
Returns character string.
Definition: irrString.h:526

◆ getToolTipText()

virtual const core::stringw& irr::gui::IGUIElement::getToolTipText ( ) const
inlinevirtual

Returns caption of this element.

Definition at line 506 of file IGUIElement.h.

507  {
508  return ToolTipText;
509  }
core::stringw ToolTipText
tooltip
Definition: IGUIElement.h:1014

◆ getType()

EGUI_ELEMENT_TYPE irr::gui::IGUIElement::getType ( ) const
inline

Returns the type of the gui element.

This is needed for the .NET wrapper but will be used later for serializing and deserializing. If you wrote your own GUIElements, you need to set the type for your element as first parameter in the constructor of IGUIElement. For own (=unknown) elements, simply use EGUIET_ELEMENT as type

Definition at line 717 of file IGUIElement.h.

718  {
719  return Type;
720  }
EGUI_ELEMENT_TYPE Type
type of element
Definition: IGUIElement.h:1038

◆ getTypeName()

virtual const c8* irr::gui::IGUIElement::getTypeName ( ) const
inlinevirtual

Returns the type name of the gui element.

This is needed serializing elements. For serializing your own elements, override this function and return your own type name which is created by your IGUIElementFactory

Definition at line 740 of file IGUIElement.h.

741  {
742  return GUIElementTypeNames[Type];
743  }
EGUI_ELEMENT_TYPE Type
type of element
Definition: IGUIElement.h:1038
const c8 *const GUIElementTypeNames[]
Names for built-in element types.

◆ hasType()

virtual bool irr::gui::IGUIElement::hasType ( EGUI_ELEMENT_TYPE  type) const
inlinevirtual

Returns true if the gui element supports the given type.

This is mostly used to check if you can cast a gui element to the class that goes with the type. Most gui elements will only support their own type, but if you derive your own classes from interfaces you can overload this function and add a check for the type of the base-class additionally. This allows for checks comparable to the dynamic_cast of c++ with enabled rtti. Note that you can't do that by calling BaseClass::hasType(type), but you have to do an explicit comparison check, because otherwise the base class usually just checks for the member variable Type which contains the type of your derived class.

Definition at line 731 of file IGUIElement.h.

732  {
733  return type == Type;
734  }
EGUI_ELEMENT_TYPE Type
type of element
Definition: IGUIElement.h:1038
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571

◆ isEnabled()

virtual bool irr::gui::IGUIElement::isEnabled ( ) const
inlinevirtual

Returns true if element is enabled.

Currently elements do not care about parent-states. So if you want to affect children you have to enable/disable them all. The only exception to this are sub-elements which also check their parent.

Definition at line 468 of file IGUIElement.h.

469  {
470  if ( isSubElement() && IsEnabled && getParent() )
471  return getParent()->isEnabled();
472 
473  return IsEnabled;
474  }
bool IsEnabled
is enabled?
Definition: IGUIElement.h:1002
virtual bool isEnabled() const
Returns true if element is enabled.
Definition: IGUIElement.h:468
virtual bool isSubElement() const
Returns true if this element was created as part of its parent control.
Definition: IGUIElement.h:367
IGUIElement * getParent() const
Returns parent of this element.
Definition: IGUIElement.h:64

◆ isMyChild()

bool irr::gui::IGUIElement::isMyChild ( IGUIElement child) const
inline

returns true if the given element is a child of this one.

Parameters
childThe child element to check

Definition at line 609 of file IGUIElement.h.

610  {
611  if (!child)
612  return false;
613  do
614  {
615  if (child->Parent)
616  child = child->Parent;
617 
618  } while (child->Parent && child != this);
619 
620 
621  return child == this;
622  }

◆ isNotClipped()

bool irr::gui::IGUIElement::isNotClipped ( ) const
inline

Gets whether the element will ignore its parent's clipping rectangle.

Returns
true if the element is not clipped by its parent's clipping rectangle.

Definition at line 160 of file IGUIElement.h.

161  {
162  return NoClip;
163  }
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition: IGUIElement.h:1008

◆ isPointInside()

virtual bool irr::gui::IGUIElement::isPointInside ( const core::position2d< s32 > &  point) const
inlinevirtual

Returns true if a point is within this element.

Elements with a shape other than a rectangle should override this method

Definition at line 269 of file IGUIElement.h.

270  {
271  return AbsoluteClippingRect.isPointInside(point);
272  }
core::rect< s32 > AbsoluteClippingRect
absolute clipping rect of element
Definition: IGUIElement.h:983
bool isPointInside(const position2d< T > &pos) const
Returns if a 2d point is within this rectangle.
Definition: rect.h:110

◆ isSubElement()

virtual bool irr::gui::IGUIElement::isSubElement ( ) const
inlinevirtual

Returns true if this element was created as part of its parent control.

Definition at line 367 of file IGUIElement.h.

368  {
369  return IsSubElement;
370  }
bool IsSubElement
is a part of a larger whole and should not be serialized?
Definition: IGUIElement.h:1005

◆ isTabGroup()

bool irr::gui::IGUIElement::isTabGroup ( ) const
inline

Returns true if this element is a tab group.

Definition at line 445 of file IGUIElement.h.

446  {
447  return IsTabGroup;
448  }
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition: IGUIElement.h:1029

◆ isTabStop()

bool irr::gui::IGUIElement::isTabStop ( ) const
inline

Returns true if this element can be focused by navigating with the tab key.

Definition at line 392 of file IGUIElement.h.

393  {
394  return IsTabStop;
395  }
bool IsTabStop
tab stop like in windows
Definition: IGUIElement.h:1023

◆ isTrulyVisible()

virtual bool irr::gui::IGUIElement::isTrulyVisible ( ) const
inlinevirtual

Check whether the element is truly visible, taking into accounts its parents' visibility.

Returns
true if the element and all its parents are visible, false if this or any parent element is invisible.

Definition at line 348 of file IGUIElement.h.

349  {
350  if(!IsVisible)
351  return false;
352 
353  if(!Parent)
354  return true;
355 
356  return Parent->isTrulyVisible();
357  }
bool IsVisible
is visible?
Definition: IGUIElement.h:999
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974
virtual bool isTrulyVisible() const
Check whether the element is truly visible, taking into accounts its parents' visibility.
Definition: IGUIElement.h:348

◆ isVisible()

virtual bool irr::gui::IGUIElement::isVisible ( ) const
inlinevirtual

Returns true if element is visible.

Definition at line 340 of file IGUIElement.h.

341  {
342  return IsVisible;
343  }
bool IsVisible
is visible?
Definition: IGUIElement.h:999

◆ move()

virtual void irr::gui::IGUIElement::move ( core::position2d< s32 absoluteMovement)
inlinevirtual

Moves this element.

Definition at line 333 of file IGUIElement.h.

334  {
335  setRelativePosition(DesiredRect + absoluteMovement);
336  }
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
void setRelativePosition(const core::rect< s32 > &r)
Sets the relative rectangle of this element.
Definition: IGUIElement.h:78

◆ OnEvent()

virtual bool irr::gui::IGUIElement::OnEvent ( const SEvent event)
inlinevirtual

Called if an event happened.

Implements irr::IEventReceiver.

Definition at line 527 of file IGUIElement.h.

528  {
529  return Parent ? Parent->OnEvent(event) : false;
530  }
virtual bool OnEvent(const SEvent &event) _IRR_OVERRIDE_
Called if an event happened.
Definition: IGUIElement.h:527
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974
struct _cl_event * event

◆ OnPostRender()

virtual void irr::gui::IGUIElement::OnPostRender ( u32  timeMs)
inlinevirtual

animate the element and its children.

Definition at line 321 of file IGUIElement.h.

322  {
323  if ( isVisible() )
324  {
325  core::list<IGUIElement*>::Iterator it = Children.begin();
326  for (; it != Children.end(); ++it)
327  (*it)->OnPostRender( timeMs );
328  }
329  }
virtual bool isVisible() const
Returns true if element is visible.
Definition: IGUIElement.h:340
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

◆ recalculateAbsolutePosition()

void irr::gui::IGUIElement::recalculateAbsolutePosition ( bool  recursive)
inlineprotected

Definition at line 840 of file IGUIElement.h.

841  {
842  core::rect<s32> parentAbsolute(0,0,0,0);
843  core::rect<s32> parentAbsoluteClip;
844  f32 fw=0.f, fh=0.f;
845 
846  if (Parent)
847  {
848  parentAbsolute = Parent->AbsoluteRect;
849 
850  if (NoClip)
851  {
852  IGUIElement* p=this;
853  while (p->Parent)
854  p = p->Parent;
855  parentAbsoluteClip = p->AbsoluteClippingRect;
856  }
857  else
858  parentAbsoluteClip = Parent->AbsoluteClippingRect;
859  }
860 
861  const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
862  const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
863 
865  fw = (f32)parentAbsolute.getWidth();
866 
868  fh = (f32)parentAbsolute.getHeight();
869 
870  switch (AlignLeft)
871  {
872  case EGUIA_UPPERLEFT:
873  break;
874  case EGUIA_LOWERRIGHT:
875  DesiredRect.UpperLeftCorner.X += diffx;
876  break;
877  case EGUIA_CENTER:
878  DesiredRect.UpperLeftCorner.X += diffx/2;
879  break;
880  case EGUIA_SCALE:
882  break;
883  }
884 
885  switch (AlignRight)
886  {
887  case EGUIA_UPPERLEFT:
888  break;
889  case EGUIA_LOWERRIGHT:
890  DesiredRect.LowerRightCorner.X += diffx;
891  break;
892  case EGUIA_CENTER:
893  DesiredRect.LowerRightCorner.X += diffx/2;
894  break;
895  case EGUIA_SCALE:
897  break;
898  }
899 
900  switch (AlignTop)
901  {
902  case EGUIA_UPPERLEFT:
903  break;
904  case EGUIA_LOWERRIGHT:
905  DesiredRect.UpperLeftCorner.Y += diffy;
906  break;
907  case EGUIA_CENTER:
908  DesiredRect.UpperLeftCorner.Y += diffy/2;
909  break;
910  case EGUIA_SCALE:
912  break;
913  }
914 
915  switch (AlignBottom)
916  {
917  case EGUIA_UPPERLEFT:
918  break;
919  case EGUIA_LOWERRIGHT:
920  DesiredRect.LowerRightCorner.Y += diffy;
921  break;
922  case EGUIA_CENTER:
923  DesiredRect.LowerRightCorner.Y += diffy/2;
924  break;
925  case EGUIA_SCALE:
927  break;
928  }
929 
931 
932  const s32 w = RelativeRect.getWidth();
933  const s32 h = RelativeRect.getHeight();
934 
935  // make sure the desired rectangle is allowed
936  if (w < (s32)MinSize.Width)
938  if (h < (s32)MinSize.Height)
940  if (MaxSize.Width && w > (s32)MaxSize.Width)
942  if (MaxSize.Height && h > (s32)MaxSize.Height)
944 
946 
947  AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
948 
949  if (!Parent)
950  parentAbsoluteClip = AbsoluteRect;
951 
953  AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
954 
955  LastParentRect = parentAbsolute;
956 
957  if ( recursive )
958  {
959  // update all children
960  core::list<IGUIElement*>::Iterator it = Children.begin();
961  for (; it != Children.end(); ++it)
962  {
963  (*it)->recalculateAbsolutePosition(recursive);
964  }
965  }
966  }
EGUI_ALIGNMENT AlignTop
Definition: IGUIElement.h:1032
REALINLINE s32 round32(f32 x)
Definition: irrMath.h:657
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
Definition: IGUIElement.h:28
EGUI_ALIGNMENT AlignBottom
Definition: IGUIElement.h:1032
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
core::rect< s32 > RelativeRect
relative rect of element
Definition: IGUIElement.h:977
GLfloat GLfloat GLfloat GLfloat h
position2d< T > UpperLeftCorner
Upper left corner.
Definition: rect.h:270
GLfloat GLfloat p
Aligned to parent's top or left side (default)
Definition: EGUIAlignment.h:15
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971
EGUI_ALIGNMENT AlignRight
Definition: IGUIElement.h:1032
core::dimension2du MinSize
Definition: IGUIElement.h:996
core::dimension2du MaxSize
maximum and minimum size of the element
Definition: IGUIElement.h:996
Stretched to fit parent.
Definition: EGUIAlignment.h:21
position2d< T > LowerRightCorner
Lower right corner.
Definition: rect.h:272
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition: IGUIElement.h:1032
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974
signed int s32
32 bit signed variable.
Definition: irrTypes.h:70
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition: IGUIElement.h:1008
T getHeight() const
Get height of rectangle.
Definition: rect.h:195
core::rect< s32 > AbsoluteClippingRect
absolute clipping rect of element
Definition: IGUIElement.h:983
T getWidth() const
Get width of rectangle.
Definition: rect.h:189
T Width
Width of the dimension.
Definition: dimension2d.h:204
void clipAgainst(const rect< T > &other)
Clips this rectangle with another one.
Definition: rect.h:131
Aligned to the center of parent.
Definition: EGUIAlignment.h:19
Aligned to parent's bottom or right side.
Definition: EGUIAlignment.h:17
core::rect< f32 > ScaleRect
relative scale of the element inside its parent
Definition: IGUIElement.h:993
core::rect< s32 > LastParentRect
for calculating the difference when resizing parent
Definition: IGUIElement.h:990
GLubyte GLubyte GLubyte GLubyte w
T Height
Height of the dimension.
Definition: dimension2d.h:206
void repair()
If the lower right corner of the rect is smaller then the upper left, the points are swapped.
Definition: rect.h:201
core::rect< s32 > AbsoluteRect
absolute rect of element
Definition: IGUIElement.h:980

◆ remove()

virtual void irr::gui::IGUIElement::remove ( )
inlinevirtual

Removes this element from its parent.

Definition at line 301 of file IGUIElement.h.

302  {
303  if (Parent)
304  Parent->removeChild(this);
305  }
virtual void removeChild(IGUIElement *child)
Removes a child.
Definition: IGUIElement.h:286
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974

◆ removeChild()

virtual void irr::gui::IGUIElement::removeChild ( IGUIElement child)
inlinevirtual

Removes a child.

Definition at line 286 of file IGUIElement.h.

287  {
288  core::list<IGUIElement*>::Iterator it = Children.begin();
289  for (; it != Children.end(); ++it)
290  if ((*it) == child)
291  {
292  (*it)->Parent = 0;
293  (*it)->drop();
294  Children.erase(it);
295  return;
296  }
297  }
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

◆ sendToBack()

virtual bool irr::gui::IGUIElement::sendToBack ( IGUIElement child)
inlinevirtual

Moves a child to the back, so it's siblings are drawn on top of it.

Returns
True if successful, false if not.

Definition at line 554 of file IGUIElement.h.

555  {
556  core::list<IGUIElement*>::Iterator it = Children.begin();
557  if (child == (*it)) // already there
558  return true;
559  for (; it != Children.end(); ++it)
560  {
561  if (child == (*it))
562  {
563  Children.erase(it);
564  Children.push_front(child);
565  return true;
566  }
567  }
568 
569  return false;
570  }
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971

◆ serializeAttributes()

virtual void irr::gui::IGUIElement::serializeAttributes ( io::IAttributes out,
io::SAttributeReadWriteOptions options = 0 
) const
inlinevirtual

Writes attributes of the scene node.

Implement this to expose the attributes of your scene node for scripting languages, editors, debuggers or xml serialization purposes.

Reimplemented from irr::io::IAttributeExchangingObject.

Definition at line 772 of file IGUIElement.h.

773  {
774  out->addString("Name", Name.c_str());
775  out->addInt("Id", ID );
776  out->addString("Caption", getText());
777  out->addString("ToolTip", getToolTipText().c_str());
778  out->addRect("Rect", DesiredRect);
779  out->addPosition2d("MinSize", core::position2di(MinSize.Width, MinSize.Height));
780  out->addPosition2d("MaxSize", core::position2di(MaxSize.Width, MaxSize.Height));
781  out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);
782  out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);
783  out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);
784  out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames);
785  out->addBool("Visible", IsVisible);
786  out->addBool("Enabled", IsEnabled);
787  out->addBool("TabStop", IsTabStop);
788  out->addBool("TabGroup", IsTabGroup);
789  out->addInt("TabOrder", TabOrder);
790  out->addBool("NoClip", NoClip);
791  }
EGUI_ALIGNMENT AlignTop
Definition: IGUIElement.h:1032
s32 TabOrder
tab order
Definition: IGUIElement.h:1026
bool IsVisible
is visible?
Definition: IGUIElement.h:999
EGUI_ALIGNMENT AlignBottom
Definition: IGUIElement.h:1032
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
const c8 *const GUIAlignmentNames[]
Names for alignments.
Definition: EGUIAlignment.h:25
bool IsEnabled
is enabled?
Definition: IGUIElement.h:1002
EGUI_ALIGNMENT AlignRight
Definition: IGUIElement.h:1032
core::stringc Name
users can set this for identifying the element by string
Definition: IGUIElement.h:1017
core::dimension2du MinSize
Definition: IGUIElement.h:996
core::dimension2du MaxSize
maximum and minimum size of the element
Definition: IGUIElement.h:996
virtual const wchar_t * getText() const
Returns caption of this element.
Definition: IGUIElement.h:492
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition: IGUIElement.h:1032
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition: IGUIElement.h:1029
virtual const core::stringw & getToolTipText() const
Returns caption of this element.
Definition: IGUIElement.h:506
const T * c_str() const
Returns character string.
Definition: irrString.h:526
bool IsTabStop
tab stop like in windows
Definition: IGUIElement.h:1023
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition: IGUIElement.h:1008
T Width
Width of the dimension.
Definition: dimension2d.h:204
vector2d< s32 > position2di
Definition: position2d.h:24
T Height
Height of the dimension.
Definition: dimension2d.h:206
s32 ID
users can set this for identifying the element by integer
Definition: IGUIElement.h:1020

◆ setAlignment()

void irr::gui::IGUIElement::setAlignment ( EGUI_ALIGNMENT  left,
EGUI_ALIGNMENT  right,
EGUI_ALIGNMENT  top,
EGUI_ALIGNMENT  bottom 
)
inline

The alignment defines how the borders of this element will be positioned when the parent element is resized.

Definition at line 188 of file IGUIElement.h.

189  {
190  AlignLeft = left;
191  AlignRight = right;
192  AlignTop = top;
194 
195  if (Parent)
196  {
197  core::rect<s32> r(Parent->getAbsolutePosition());
198 
199  core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
200 
201  if (AlignLeft == EGUIA_SCALE)
203  if (AlignRight == EGUIA_SCALE)
205  if (AlignTop == EGUIA_SCALE)
207  if (AlignBottom == EGUIA_SCALE)
209  }
210  }
EGUI_ALIGNMENT AlignTop
Definition: IGUIElement.h:1032
EGUI_ALIGNMENT AlignBottom
Definition: IGUIElement.h:1032
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
position2d< T > UpperLeftCorner
Upper left corner.
Definition: rect.h:270
EGUI_ALIGNMENT AlignRight
Definition: IGUIElement.h:1032
Stretched to fit parent.
Definition: EGUIAlignment.h:21
GLint GLint bottom
position2d< T > LowerRightCorner
Lower right corner.
Definition: rect.h:272
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition: IGUIElement.h:1032
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974
dimension2d< f32 > dimension2df
Typedef for an f32 dimension.
Definition: dimension2d.h:210
core::rect< s32 > getAbsolutePosition() const
Gets the absolute rectangle of this element.
Definition: IGUIElement.h:136
GLdouble GLdouble GLdouble GLdouble top
GLint left
core::rect< f32 > ScaleRect
relative scale of the element inside its parent
Definition: IGUIElement.h:993
GLdouble GLdouble right

◆ setEnabled()

virtual void irr::gui::IGUIElement::setEnabled ( bool  enabled)
inlinevirtual

Sets the enabled state of this element.

Definition at line 478 of file IGUIElement.h.

479  {
480  IsEnabled = enabled;
481  }
bool IsEnabled
is enabled?
Definition: IGUIElement.h:1002
GLenum GLenum GLsizei const GLuint GLboolean enabled

◆ setID()

virtual void irr::gui::IGUIElement::setID ( s32  id)
inlinevirtual

Sets the id of this element.

Definition at line 520 of file IGUIElement.h.

521  {
522  ID = id;
523  }
GLuint id
s32 ID
users can set this for identifying the element by integer
Definition: IGUIElement.h:1020

◆ setMaxSize()

void irr::gui::IGUIElement::setMaxSize ( core::dimension2du  size)
inline

Sets the maximum size allowed for this element.

If set to 0,0, there is no maximum size

Definition at line 168 of file IGUIElement.h.

169  {
170  MaxSize = size;
172  }
core::dimension2du MaxSize
maximum and minimum size of the element
Definition: IGUIElement.h:996
GLsizeiptr size
virtual void updateAbsolutePosition()
Updates the absolute position.
Definition: IGUIElement.h:214

◆ setMinSize()

void irr::gui::IGUIElement::setMinSize ( core::dimension2du  size)
inline

Sets the minimum size allowed for this element.

Definition at line 176 of file IGUIElement.h.

177  {
178  MinSize = size;
179  if (MinSize.Width < 1)
180  MinSize.Width = 1;
181  if (MinSize.Height < 1)
182  MinSize.Height = 1;
184  }
core::dimension2du MinSize
Definition: IGUIElement.h:996
GLsizeiptr size
virtual void updateAbsolutePosition()
Updates the absolute position.
Definition: IGUIElement.h:214
T Width
Width of the dimension.
Definition: dimension2d.h:204
T Height
Height of the dimension.
Definition: dimension2d.h:206

◆ setName() [1/2]

virtual void irr::gui::IGUIElement::setName ( const c8 name)
inlinevirtual

Sets the name of the element.

Parameters
nameNew name of the gui element.

Definition at line 755 of file IGUIElement.h.

756  {
757  Name = name;
758  }
core::stringc Name
users can set this for identifying the element by string
Definition: IGUIElement.h:1017
GLuint const GLchar * name

◆ setName() [2/2]

virtual void irr::gui::IGUIElement::setName ( const core::stringc name)
inlinevirtual

Sets the name of the element.

Parameters
nameNew name of the gui element.

Definition at line 763 of file IGUIElement.h.

764  {
765  Name = name;
766  }
core::stringc Name
users can set this for identifying the element by string
Definition: IGUIElement.h:1017
GLuint const GLchar * name

◆ setNotClipped()

void irr::gui::IGUIElement::setNotClipped ( bool  noClip)
inline

Sets whether the element will ignore its parent's clipping rectangle.

Parameters
noClipIf true, the element will not be clipped by its parent's clipping rectangle.

Definition at line 151 of file IGUIElement.h.

152  {
153  NoClip = noClip;
155  }
virtual void updateAbsolutePosition()
Updates the absolute position.
Definition: IGUIElement.h:214
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition: IGUIElement.h:1008

◆ setRelativePosition() [1/2]

void irr::gui::IGUIElement::setRelativePosition ( const core::rect< s32 > &  r)
inline

Sets the relative rectangle of this element.

Parameters
rThe absolute position to set

Definition at line 78 of file IGUIElement.h.

79  {
80  if (Parent)
81  {
82  const core::rect<s32>& r2 = Parent->getAbsolutePosition();
83 
84  core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
85 
86  if (AlignLeft == EGUIA_SCALE)
87  ScaleRect.UpperLeftCorner.X = (f32)r.UpperLeftCorner.X / d.Width;
88  if (AlignRight == EGUIA_SCALE)
89  ScaleRect.LowerRightCorner.X = (f32)r.LowerRightCorner.X / d.Width;
90  if (AlignTop == EGUIA_SCALE)
91  ScaleRect.UpperLeftCorner.Y = (f32)r.UpperLeftCorner.Y / d.Height;
92  if (AlignBottom == EGUIA_SCALE)
93  ScaleRect.LowerRightCorner.Y = (f32)r.LowerRightCorner.Y / d.Height;
94  }
95 
96  DesiredRect = r;
98  }
EGUI_ALIGNMENT AlignTop
Definition: IGUIElement.h:1032
EGUI_ALIGNMENT AlignBottom
Definition: IGUIElement.h:1032
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
position2d< T > UpperLeftCorner
Upper left corner.
Definition: rect.h:270
EGUI_ALIGNMENT AlignRight
Definition: IGUIElement.h:1032
Stretched to fit parent.
Definition: EGUIAlignment.h:21
virtual void updateAbsolutePosition()
Updates the absolute position.
Definition: IGUIElement.h:214
position2d< T > LowerRightCorner
Lower right corner.
Definition: rect.h:272
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition: IGUIElement.h:1032
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974
dimension2d< f32 > dimension2df
Typedef for an f32 dimension.
Definition: dimension2d.h:210
core::rect< s32 > getAbsolutePosition() const
Gets the absolute rectangle of this element.
Definition: IGUIElement.h:136
core::rect< f32 > ScaleRect
relative scale of the element inside its parent
Definition: IGUIElement.h:993

◆ setRelativePosition() [2/2]

void irr::gui::IGUIElement::setRelativePosition ( const core::position2di position)
inline

Sets the relative rectangle of this element, maintaining its current width and height.

Parameters
positionThe new relative position to set. Width and height will not be changed.

Definition at line 102 of file IGUIElement.h.

103  {
104  const core::dimension2di mySize = RelativeRect.getSize();
105  const core::rect<s32> rectangle(position.X, position.Y,
106  position.X + mySize.Width, position.Y + mySize.Height);
107  setRelativePosition(rectangle);
108  }
dimension2d< s32 > dimension2di
Typedef for an integer dimension.
Definition: dimension2d.h:217
core::rect< s32 > RelativeRect
relative rect of element
Definition: IGUIElement.h:977
dimension2d< T > getSize() const
Get the dimensions of the rectangle.
Definition: rect.h:236
void setRelativePosition(const core::rect< s32 > &r)
Sets the relative rectangle of this element.
Definition: IGUIElement.h:78

◆ setRelativePositionProportional()

void irr::gui::IGUIElement::setRelativePositionProportional ( const core::rect< f32 > &  r)
inline

Sets the relative rectangle of this element as a proportion of its parent's area.

Note
This method used to be 'void setRelativePosition(const core::rect<f32>& r)'
Parameters
rThe rectangle to set, interpreted as a proportion of the parent's area. Meaningful values are in the range [0...1], unless you intend this element to spill outside its parent.

Definition at line 116 of file IGUIElement.h.

117  {
118  if (!Parent)
119  return;
120 
122 
123  DesiredRect = core::rect<s32>(
124  core::floor32((f32)d.Width * r.UpperLeftCorner.X),
125  core::floor32((f32)d.Height * r.UpperLeftCorner.Y),
126  core::floor32((f32)d.Width * r.LowerRightCorner.X),
127  core::floor32((f32)d.Height * r.LowerRightCorner.Y));
128 
129  ScaleRect = r;
130 
132  }
dimension2d< s32 > dimension2di
Typedef for an integer dimension.
Definition: dimension2d.h:217
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:987
GLdouble GLdouble GLdouble r
Definition: SDL_opengl.h:2079
float f32
32 bit floating point variable.
Definition: irrTypes.h:108
virtual void updateAbsolutePosition()
Updates the absolute position.
Definition: IGUIElement.h:214
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:974
dimension2d< T > getSize() const
Get the dimensions of the rectangle.
Definition: rect.h:236
core::rect< s32 > getAbsolutePosition() const
Gets the absolute rectangle of this element.
Definition: IGUIElement.h:136
core::rect< f32 > ScaleRect
relative scale of the element inside its parent
Definition: IGUIElement.h:993
REALINLINE s32 floor32(f32 x)
Definition: irrMath.h:646

◆ setSubElement()

virtual void irr::gui::IGUIElement::setSubElement ( bool  subElement)
inlinevirtual

Sets whether this control was created as part of its parent.

For example, it is true when a scrollbar is part of a listbox. SubElements are not saved to disk when calling guiEnvironment->saveGUI()

Definition at line 376 of file IGUIElement.h.

377  {
378  IsSubElement = subElement;
379  }
bool IsSubElement
is a part of a larger whole and should not be serialized?
Definition: IGUIElement.h:1005

◆ setTabGroup()

void irr::gui::IGUIElement::setTabGroup ( bool  isGroup)
inline

Sets whether this element is a container for a group of elements which can be navigated using the tab key.

For example, windows are tab groups. Groups can be navigated using ctrl+tab, providing isTabStop is true.

Definition at line 438 of file IGUIElement.h.

439  {
440  IsTabGroup = isGroup;
441  }
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition: IGUIElement.h:1029

◆ setTabOrder()

void irr::gui::IGUIElement::setTabOrder ( s32  index)
inline

Sets the priority of focus when using the tab key to navigate between a group of elements.

See setTabGroup, isTabGroup and getTabGroup for information on tab groups. Elements with a lower number are focused first

Definition at line 401 of file IGUIElement.h.

402  {
403  // negative = autonumber
404  if (index < 0)
405  {
406  TabOrder = 0;
407  IGUIElement *el = getTabGroup();
408  while (IsTabGroup && el && el->Parent)
409  el = el->Parent;
410 
411  IGUIElement *first=0, *closest=0;
412  if (el)
413  {
414  // find the highest element number
415  el->getNextElement(-1, true, IsTabGroup, first, closest, true);
416  if (first)
417  {
418  TabOrder = first->getTabOrder() + 1;
419  }
420  }
421 
422  }
423  else
424  TabOrder = index;
425  }
s32 TabOrder
tab order
Definition: IGUIElement.h:1026
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
Definition: IGUIElement.h:28
const GLint * first
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition: IGUIElement.h:1029
GLuint index
IGUIElement * getTabGroup()
Returns the container element which holds all elements in this element's tab group.
Definition: IGUIElement.h:452

◆ setTabStop()

void irr::gui::IGUIElement::setTabStop ( bool  enable)
inline

If set to true, the focus will visit this element when using the tab key to cycle through elements.

If this element is a tab group (see isTabGroup/setTabGroup) then ctrl+tab will be used instead.

Definition at line 385 of file IGUIElement.h.

386  {
387  IsTabStop = enable;
388  }
bool IsTabStop
tab stop like in windows
Definition: IGUIElement.h:1023
GLboolean enable

◆ setText()

virtual void irr::gui::IGUIElement::setText ( const wchar_t *  text)
inlinevirtual

Sets the new caption of this element.

Definition at line 485 of file IGUIElement.h.

486  {
487  Text = text;
488  }
core::stringw Text
caption
Definition: IGUIElement.h:1011

◆ setToolTipText()

virtual void irr::gui::IGUIElement::setToolTipText ( const wchar_t *  text)
inlinevirtual

Sets the new caption of this element.

Definition at line 499 of file IGUIElement.h.

500  {
501  ToolTipText = text;
502  }
core::stringw ToolTipText
tooltip
Definition: IGUIElement.h:1014

◆ setVisible()

virtual void irr::gui::IGUIElement::setVisible ( bool  visible)
inlinevirtual

Sets the visible state of this element.

Definition at line 360 of file IGUIElement.h.

361  {
362  IsVisible = visible;
363  }
bool IsVisible
is visible?
Definition: IGUIElement.h:999

◆ updateAbsolutePosition()

virtual void irr::gui::IGUIElement::updateAbsolutePosition ( )
inlinevirtual

Updates the absolute position.

Definition at line 214 of file IGUIElement.h.

215  {
217 
218  // update all children
219  core::list<IGUIElement*>::Iterator it = Children.begin();
220  for (; it != Children.end(); ++it)
221  {
222  (*it)->updateAbsolutePosition();
223  }
224  }
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:971
void recalculateAbsolutePosition(bool recursive)
Definition: IGUIElement.h:840

Member Data Documentation

◆ AbsoluteClippingRect

core::rect<s32> irr::gui::IGUIElement::AbsoluteClippingRect
protected

absolute clipping rect of element

Definition at line 983 of file IGUIElement.h.

◆ AbsoluteRect

core::rect<s32> irr::gui::IGUIElement::AbsoluteRect
protected

absolute rect of element

Definition at line 980 of file IGUIElement.h.

◆ AlignBottom

EGUI_ALIGNMENT irr::gui::IGUIElement::AlignBottom
protected

Definition at line 1032 of file IGUIElement.h.

◆ AlignLeft

EGUI_ALIGNMENT irr::gui::IGUIElement::AlignLeft
protected

tells the element how to act when its parent is resized

Definition at line 1032 of file IGUIElement.h.

◆ AlignRight

EGUI_ALIGNMENT irr::gui::IGUIElement::AlignRight
protected

Definition at line 1032 of file IGUIElement.h.

◆ AlignTop

EGUI_ALIGNMENT irr::gui::IGUIElement::AlignTop
protected

Definition at line 1032 of file IGUIElement.h.

◆ Children

core::list<IGUIElement*> irr::gui::IGUIElement::Children
protected

List of all children of this element.

Definition at line 971 of file IGUIElement.h.

◆ DesiredRect

core::rect<s32> irr::gui::IGUIElement::DesiredRect
protected

the rectangle the element would prefer to be, if it was not constrained by parent or max/min size

Definition at line 987 of file IGUIElement.h.

◆ Environment

IGUIEnvironment* irr::gui::IGUIElement::Environment
protected

GUI Environment.

Definition at line 1035 of file IGUIElement.h.

◆ ID

s32 irr::gui::IGUIElement::ID
protected

users can set this for identifying the element by integer

Definition at line 1020 of file IGUIElement.h.

◆ IsEnabled

bool irr::gui::IGUIElement::IsEnabled
protected

is enabled?

Definition at line 1002 of file IGUIElement.h.

◆ IsSubElement

bool irr::gui::IGUIElement::IsSubElement
protected

is a part of a larger whole and should not be serialized?

Definition at line 1005 of file IGUIElement.h.

◆ IsTabGroup

bool irr::gui::IGUIElement::IsTabGroup
protected

tab groups are containers like windows, use ctrl+tab to navigate

Definition at line 1029 of file IGUIElement.h.

◆ IsTabStop

bool irr::gui::IGUIElement::IsTabStop
protected

tab stop like in windows

Definition at line 1023 of file IGUIElement.h.

◆ IsVisible

bool irr::gui::IGUIElement::IsVisible
protected

is visible?

Definition at line 999 of file IGUIElement.h.

◆ LastParentRect

core::rect<s32> irr::gui::IGUIElement::LastParentRect
protected

for calculating the difference when resizing parent

Definition at line 990 of file IGUIElement.h.

◆ MaxSize

core::dimension2du irr::gui::IGUIElement::MaxSize
protected

maximum and minimum size of the element

Definition at line 996 of file IGUIElement.h.

◆ MinSize

core::dimension2du irr::gui::IGUIElement::MinSize
protected

Definition at line 996 of file IGUIElement.h.

◆ Name

core::stringc irr::gui::IGUIElement::Name
protected

users can set this for identifying the element by string

Definition at line 1017 of file IGUIElement.h.

◆ NoClip

bool irr::gui::IGUIElement::NoClip
protected

does this element ignore its parent's clipping rectangle?

Definition at line 1008 of file IGUIElement.h.

◆ Parent

IGUIElement* irr::gui::IGUIElement::Parent
protected

Pointer to the parent.

Definition at line 974 of file IGUIElement.h.

◆ RelativeRect

core::rect<s32> irr::gui::IGUIElement::RelativeRect
protected

relative rect of element

Definition at line 977 of file IGUIElement.h.

◆ ScaleRect

core::rect<f32> irr::gui::IGUIElement::ScaleRect
protected

relative scale of the element inside its parent

Definition at line 993 of file IGUIElement.h.

◆ TabOrder

s32 irr::gui::IGUIElement::TabOrder
protected

tab order

Definition at line 1026 of file IGUIElement.h.

◆ Text

core::stringw irr::gui::IGUIElement::Text
protected

caption

Definition at line 1011 of file IGUIElement.h.

◆ ToolTipText

core::stringw irr::gui::IGUIElement::ToolTipText
protected

tooltip

Definition at line 1014 of file IGUIElement.h.

◆ Type

EGUI_ELEMENT_TYPE irr::gui::IGUIElement::Type
protected

type of element

Definition at line 1038 of file IGUIElement.h.


The documentation for this class was generated from the following file: