Irrlicht 3D Engine
IGUIElement.h
Go to the documentation of this file.
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __I_GUI_ELEMENT_H_INCLUDED__
6#define __I_GUI_ELEMENT_H_INCLUDED__
7
9#include "irrList.h"
10#include "rect.h"
11#include "irrString.h"
12#include "IEventReceiver.h"
13#include "EGUIElementTypes.h"
14#include "EGUIAlignment.h"
15#include "IAttributes.h"
16
17namespace irr
18{
19namespace gui
20{
21
22class IGUIEnvironment;
23
26{
27public:
28
31 s32 id, const core::rect<s32>& rectangle)
32 : Parent(0), RelativeRect(rectangle), AbsoluteRect(rectangle),
33 AbsoluteClippingRect(rectangle), DesiredRect(rectangle),
34 MaxSize(0,0), MinSize(1,1), IsVisible(true), IsEnabled(true),
35 IsSubElement(false), NoClip(false), ID(id), IsTabStop(false), TabOrder(-1), IsTabGroup(false),
37 Environment(environment), Type(type)
38 {
39 #ifdef _DEBUG
40 setDebugName("IGUIElement");
41 #endif
42
43 // if we were given a parent to attach to
44 if (parent)
45 {
46 parent->addChildToEnd(this);
48 }
49 }
50
51
53 virtual ~IGUIElement()
54 {
55 // delete all children
57 for (; it != Children.end(); ++it)
58 {
59 (*it)->Parent = 0;
60 (*it)->drop();
61 }
62 }
63
64
67 {
68 return Parent;
69 }
70
71
74 {
75 return RelativeRect;
76 }
77
78
80
82 {
83 if (Parent)
84 {
86
87 core::dimension2df d((f32)(r2.getSize().Width), (f32)(r2.getSize().Height));
88
93 if (AlignTop == EGUIA_SCALE)
97 }
98
99 DesiredRect = r;
101 }
102
104
106 {
107 const core::dimension2di mySize = RelativeRect.getSize();
108 const core::rect<s32> rectangle(position.X, position.Y,
109 position.X + mySize.Width, position.Y + mySize.Height);
110 setRelativePosition(rectangle);
111 }
112
113
115
120 {
121 if (!Parent)
122 return;
123
125
131
132 ScaleRect = r;
133
135 }
136
137
140 {
141 return AbsoluteRect;
142 }
143
144
147 {
149 }
150
151
153
154 void setNotClipped(bool noClip)
155 {
156 NoClip = noClip;
158 }
159
160
162
163 bool isNotClipped() const
164 {
165 return NoClip;
166 }
167
168
170
172 {
173 MaxSize = size;
175 }
176
177
180 {
181 MinSize = size;
182 if (MinSize.Width < 1)
183 MinSize.Width = 1;
184 if (MinSize.Height < 1)
185 MinSize.Height = 1;
187 }
188
189
192 {
193 AlignLeft = left;
194 AlignRight = right;
195 AlignTop = top;
196 AlignBottom = bottom;
197
198 if (Parent)
199 {
201
202 core::dimension2df d((f32)r.getSize().Width, (f32)r.getSize().Height);
203
204 if (AlignLeft == EGUIA_SCALE)
206 if (AlignRight == EGUIA_SCALE)
208 if (AlignTop == EGUIA_SCALE)
212 }
213 }
214
215
218 {
220
221 // update all children
223 for (; it != Children.end(); ++it)
224 {
225 (*it)->updateAbsolutePosition();
226 }
227 }
228
229
231
242 IGUIElement* getElementFromPoint(const core::position2d<s32>& point)
243 {
244 IGUIElement* target = 0;
245
246 // we have to search from back to front, because later children
247 // might be drawn over the top of earlier ones.
248
250
251 if (isVisible())
252 {
253 while(it != Children.end())
254 {
255 target = (*it)->getElementFromPoint(point);
256 if (target)
257 return target;
258
259 --it;
260 }
261 }
262
263 if (isVisible() && isPointInside(point))
264 target = this;
265
266 return target;
267 }
268
269
271
272 virtual bool isPointInside(const core::position2d<s32>& point) const
273 {
275 }
276
277
279 virtual void addChild(IGUIElement* child)
280 {
281 addChildToEnd(child);
282 if (child)
283 {
284 child->updateAbsolutePosition();
285 }
286 }
287
289 virtual void removeChild(IGUIElement* child)
290 {
292 for (; it != Children.end(); ++it)
293 if ((*it) == child)
294 {
295 (*it)->Parent = 0;
296 (*it)->drop();
297 Children.erase(it);
298 return;
299 }
300 }
301
302
304 virtual void remove()
305 {
306 if (Parent)
307 Parent->removeChild(this);
308 }
309
310
312 virtual void draw()
313 {
314 if ( isVisible() )
315 {
317 for (; it != Children.end(); ++it)
318 (*it)->draw();
319 }
320 }
321
322
324 virtual void OnPostRender(u32 timeMs)
325 {
326 if ( isVisible() )
327 {
329 for (; it != Children.end(); ++it)
330 (*it)->OnPostRender( timeMs );
331 }
332 }
333
334
336 virtual void move(core::position2d<s32> absoluteMovement)
337 {
338 setRelativePosition(DesiredRect + absoluteMovement);
339 }
340
341
343 virtual bool isVisible() const
344 {
346 return IsVisible;
347 }
348
349
351 virtual void setVisible(bool visible)
352 {
353 IsVisible = visible;
354 }
355
356
358 virtual bool isSubElement() const
359 {
361 return IsSubElement;
362 }
363
364
366
368 virtual void setSubElement(bool subElement)
369 {
370 IsSubElement = subElement;
371 }
372
373
375
377 void setTabStop(bool enable)
378 {
379 IsTabStop = enable;
380 }
381
382
384 bool isTabStop() const
385 {
387 return IsTabStop;
388 }
389
390
392
394 void setTabOrder(s32 index)
395 {
396 // negative = autonumber
397 if (index < 0)
398 {
399 TabOrder = 0;
400 IGUIElement *el = getTabGroup();
401 while (IsTabGroup && el && el->Parent)
402 el = el->Parent;
403
404 IGUIElement *first=0, *closest=0;
405 if (el)
406 {
407 // find the highest element number
408 el->getNextElement(-1, true, IsTabGroup, first, closest, true);
409 if (first)
410 {
411 TabOrder = first->getTabOrder() + 1;
412 }
413 }
414
415 }
416 else
417 TabOrder = index;
418 }
419
420
423 {
424 return TabOrder;
425 }
426
427
429
431 void setTabGroup(bool isGroup)
432 {
433 IsTabGroup = isGroup;
434 }
435
436
438 bool isTabGroup() const
439 {
441 return IsTabGroup;
442 }
443
444
447 {
448 IGUIElement *ret=this;
449
450 while (ret && !ret->isTabGroup())
451 ret = ret->getParent();
452
453 return ret;
454 }
455
456
458
462 virtual bool isEnabled() const
463 {
464 if ( isSubElement() && IsEnabled && getParent() )
465 return getParent()->isEnabled();
466
468 return IsEnabled;
469 }
470
471
473 virtual void setEnabled(bool enabled)
474 {
475 IsEnabled = enabled;
476 }
477
478
480 virtual void setText(const wchar_t* text)
481 {
482 Text = text;
483 }
484
485
487 virtual const wchar_t* getText() const
488 {
489 return Text.c_str();
490 }
491
492
494 virtual void setToolTipText(const wchar_t* text)
495 {
496 ToolTipText = text;
497 }
498
499
501 virtual const core::stringw& getToolTipText() const
502 {
503 return ToolTipText;
504 }
505
506
508 virtual s32 getID() const
509 {
510 return ID;
511 }
512
513
515 virtual void setID(s32 id)
516 {
517 ID = id;
518 }
519
520
522 virtual bool OnEvent(const SEvent& event)
523 {
524 return Parent ? Parent->OnEvent(event) : false;
525 }
526
527
529
530 virtual bool bringToFront(IGUIElement* element)
531 {
533 for (; it != Children.end(); ++it)
534 {
535 if (element == (*it))
536 {
537 Children.erase(it);
538 Children.push_back(element);
539 return true;
540 }
541 }
542
544 return false;
545 }
546
547
549
550 virtual bool sendToBack(IGUIElement* child)
551 {
553 if (child == (*it)) // already there
554 return true;
555 for (; it != Children.end(); ++it)
556 {
557 if (child == (*it))
558 {
559 Children.erase(it);
560 Children.push_front(child);
561 return true;
562 }
563 }
564
566 return false;
567 }
568
571 {
572 return Children;
573 }
574
575
577
583 virtual IGUIElement* getElementFromId(s32 id, bool searchchildren=false) const
584 {
585 IGUIElement* e = 0;
586
588 for (; it != Children.end(); ++it)
589 {
590 if ((*it)->getID() == id)
591 return (*it);
592
593 if (searchchildren)
594 e = (*it)->getElementFromId(id, true);
595
596 if (e)
597 return e;
598 }
599
600 return e;
601 }
602
603
606 bool isMyChild(IGUIElement* child) const
607 {
608 if (!child)
609 return false;
610 do
611 {
612 if (child->Parent)
613 child = child->Parent;
614
615 } while (child->Parent && child != this);
616
618 return child == this;
619 }
620
621
623
630 bool getNextElement(s32 startOrder, bool reverse, bool group,
631 IGUIElement*& first, IGUIElement*& closest, bool includeInvisible=false) const
632 {
633 // we'll stop searching if we find this number
634 s32 wanted = startOrder + ( reverse ? -1 : 1 );
635 if (wanted==-2)
636 wanted = 1073741824; // maximum s32
637
639
640 s32 closestOrder, currentOrder;
641
642 while(it != Children.end())
643 {
644 // ignore invisible elements and their children
645 if ( ( (*it)->isVisible() || includeInvisible ) &&
646 (group == true || (*it)->isTabGroup() == false) )
647 {
648 // only check tab stops and those with the same group status
649 if ((*it)->isTabStop() && ((*it)->isTabGroup() == group))
650 {
651 currentOrder = (*it)->getTabOrder();
652
653 // is this what we're looking for?
654 if (currentOrder == wanted)
655 {
656 closest = *it;
657 return true;
658 }
659
660 // is it closer than the current closest?
661 if (closest)
662 {
663 closestOrder = closest->getTabOrder();
664 if ( ( reverse && currentOrder > closestOrder && currentOrder < startOrder)
665 ||(!reverse && currentOrder < closestOrder && currentOrder > startOrder))
666 {
667 closest = *it;
668 }
669 }
670 else
671 if ( (reverse && currentOrder < startOrder) || (!reverse && currentOrder > startOrder) )
672 {
673 closest = *it;
674 }
675
676 // is it before the current first?
677 if (first)
678 {
679 closestOrder = first->getTabOrder();
680
681 if ( (reverse && closestOrder < currentOrder) || (!reverse && closestOrder > currentOrder) )
682 {
683 first = *it;
684 }
685 }
686 else
687 {
688 first = *it;
689 }
690 }
691 // search within children
692 if ((*it)->getNextElement(startOrder, reverse, group, first, closest))
693 {
695 return true;
696 }
697 }
698 ++it;
699 }
701 return false;
702 }
703
704
706
711 {
712 return Type;
713 }
714
716
724 virtual bool hasType(EGUI_ELEMENT_TYPE type) const
725 {
726 return type == Type;
727 }
728
729
731
733 virtual const c8* getTypeName() const
734 {
736 }
737
739
740 virtual const c8* getName() const
741 {
742 return Name.c_str();
743 }
744
745
747
748 virtual void setName(const c8* name)
749 {
750 Name = name;
751 }
752
753
755
756 virtual void setName(const core::stringc& name)
757 {
758 Name = name;
759 }
760
761
763
766 {
767 out->addString("Name", Name.c_str());
768 out->addInt("Id", ID );
769 out->addString("Caption", getText());
770 out->addRect("Rect", DesiredRect);
773 out->addEnum("LeftAlign", AlignLeft, GUIAlignmentNames);
774 out->addEnum("RightAlign", AlignRight, GUIAlignmentNames);
775 out->addEnum("TopAlign", AlignTop, GUIAlignmentNames);
776 out->addEnum("BottomAlign", AlignBottom, GUIAlignmentNames);
777 out->addBool("Visible", IsVisible);
778 out->addBool("Enabled", IsEnabled);
779 out->addBool("TabStop", IsTabStop);
780 out->addBool("TabGroup", IsTabGroup);
781 out->addInt("TabOrder", TabOrder);
782 out->addBool("NoClip", NoClip);
783 }
784
785
787
790 {
791 setName(in->getAttributeAsString("Name"));
792 setID(in->getAttributeAsInt("Id"));
793 setText(in->getAttributeAsStringW("Caption").c_str());
794 setVisible(in->getAttributeAsBool("Visible"));
795 setEnabled(in->getAttributeAsBool("Enabled"));
796 IsTabStop = in->getAttributeAsBool("TabStop");
797 IsTabGroup = in->getAttributeAsBool("TabGroup");
798 TabOrder = in->getAttributeAsInt("TabOrder");
799
802
803 p = in->getAttributeAsPosition2d("MinSize");
805
810
812
813 setNotClipped(in->getAttributeAsBool("NoClip"));
814 }
815
816protected:
817 // not virtual because needed in constructor
819 {
820 if (child)
821 {
822 child->grab(); // prevent destruction when removed
823 child->remove(); // remove from old parent
825 child->Parent = this;
826 Children.push_back(child);
827 }
828 }
829
830 // not virtual because needed in constructor
831 void recalculateAbsolutePosition(bool recursive)
832 {
833 core::rect<s32> parentAbsolute(0,0,0,0);
834 core::rect<s32> parentAbsoluteClip;
835 f32 fw=0.f, fh=0.f;
836
837 if (Parent)
838 {
839 parentAbsolute = Parent->AbsoluteRect;
840
841 if (NoClip)
842 {
843 IGUIElement* p=this;
844 while (p && p->Parent)
845 p = p->Parent;
846 parentAbsoluteClip = p->AbsoluteClippingRect;
847 }
848 else
849 parentAbsoluteClip = Parent->AbsoluteClippingRect;
850 }
851
852 const s32 diffx = parentAbsolute.getWidth() - LastParentRect.getWidth();
853 const s32 diffy = parentAbsolute.getHeight() - LastParentRect.getHeight();
854
856 fw = (f32)parentAbsolute.getWidth();
857
859 fh = (f32)parentAbsolute.getHeight();
860
861 switch (AlignLeft)
862 {
863 case EGUIA_UPPERLEFT:
864 break;
865 case EGUIA_LOWERRIGHT:
866 DesiredRect.UpperLeftCorner.X += diffx;
867 break;
868 case EGUIA_CENTER:
869 DesiredRect.UpperLeftCorner.X += diffx/2;
870 break;
871 case EGUIA_SCALE:
873 break;
874 }
875
876 switch (AlignRight)
877 {
878 case EGUIA_UPPERLEFT:
879 break;
880 case EGUIA_LOWERRIGHT:
881 DesiredRect.LowerRightCorner.X += diffx;
882 break;
883 case EGUIA_CENTER:
884 DesiredRect.LowerRightCorner.X += diffx/2;
885 break;
886 case EGUIA_SCALE:
888 break;
889 }
890
891 switch (AlignTop)
892 {
893 case EGUIA_UPPERLEFT:
894 break;
895 case EGUIA_LOWERRIGHT:
896 DesiredRect.UpperLeftCorner.Y += diffy;
897 break;
898 case EGUIA_CENTER:
899 DesiredRect.UpperLeftCorner.Y += diffy/2;
900 break;
901 case EGUIA_SCALE:
903 break;
904 }
905
906 switch (AlignBottom)
907 {
908 case EGUIA_UPPERLEFT:
909 break;
910 case EGUIA_LOWERRIGHT:
911 DesiredRect.LowerRightCorner.Y += diffy;
912 break;
913 case EGUIA_CENTER:
914 DesiredRect.LowerRightCorner.Y += diffy/2;
915 break;
916 case EGUIA_SCALE:
918 break;
919 }
920
922
923 const s32 w = RelativeRect.getWidth();
924 const s32 h = RelativeRect.getHeight();
925
926 // make sure the desired rectangle is allowed
927 if (w < (s32)MinSize.Width)
929 if (h < (s32)MinSize.Height)
931 if (MaxSize.Width && w > (s32)MaxSize.Width)
933 if (MaxSize.Height && h > (s32)MaxSize.Height)
935
937
938 AbsoluteRect = RelativeRect + parentAbsolute.UpperLeftCorner;
939
940 if (!Parent)
941 parentAbsoluteClip = AbsoluteRect;
942
944 AbsoluteClippingRect.clipAgainst(parentAbsoluteClip);
945
946 LastParentRect = parentAbsolute;
947
948 if ( recursive )
949 {
950 // update all children
952 for (; it != Children.end(); ++it)
953 {
954 (*it)->recalculateAbsolutePosition(recursive);
955 }
956 }
957 }
958
959protected:
960
963
966
969
972
975
979
982
985
988
991
994
997
999 bool NoClip;
1000
1003
1006
1009
1012
1015
1018
1021
1024
1027
1030};
1031
1032
1033} // end namespace gui
1034} // end namespace irr
1035
1036#endif
1037
Interface of an object which can receive events.
void grab() const
Grabs the object. Increments the reference counter by one.
void setDebugName(const c8 *newName)
Sets the debug name of the object.
Specifies a 2 dimensional size.
Definition: dimension2d.h:21
T Width
Width of the dimension.
Definition: dimension2d.h:204
T Height
Height of the dimension.
Definition: dimension2d.h:206
List iterator for const access.
Definition: irrList.h:88
List iterator.
Definition: irrList.h:39
Doubly linked list template.
Definition: irrList.h:21
dimension2d< T > getSize() const
Get the dimensions of the rectangle.
Definition: rect.h:231
bool isPointInside(const position2d< T > &pos) const
Returns if a 2d point is within this rectangle.
Definition: rect.h:105
void repair()
If the lower right corner of the rect is smaller then the upper left, the points are swapped.
Definition: rect.h:196
void clipAgainst(const rect< T > &other)
Clips this rectangle with another one.
Definition: rect.h:126
position2d< T > LowerRightCorner
Lower right corner.
Definition: rect.h:267
position2d< T > UpperLeftCorner
Upper left corner.
Definition: rect.h:265
T getHeight() const
Get height of rectangle.
Definition: rect.h:190
T getWidth() const
Get width of rectangle.
Definition: rect.h:184
const T * c_str() const
Returns character string.
Definition: irrString.h:495
2d vector template class with lots of operators and methods.
Definition: vector2d.h:22
T X
X coordinate of vector.
Definition: vector2d.h:316
T Y
Y coordinate of vector.
Definition: vector2d.h:319
Base class of all GUI elements.
Definition: IGUIElement.h:26
core::rect< s32 > LastParentRect
for calculating the difference when resizing parent
Definition: IGUIElement.h:981
core::rect< s32 > AbsoluteRect
absolute rect of element
Definition: IGUIElement.h:971
virtual ~IGUIElement()
Destructor.
Definition: IGUIElement.h:53
EGUI_ALIGNMENT AlignLeft
tells the element how to act when its parent is resized
Definition: IGUIElement.h:1023
void setRelativePosition(const core::rect< s32 > &r)
Sets the relative rectangle of this element.
Definition: IGUIElement.h:81
bool isTabStop() const
Returns true if this element can be focused by navigating with the tab key.
Definition: IGUIElement.h:384
core::rect< s32 > AbsoluteClippingRect
absolute clipping rect of element
Definition: IGUIElement.h:974
core::dimension2du MaxSize
maximum and minimum size of the element
Definition: IGUIElement.h:987
bool IsSubElement
is a part of a larger whole and should not be serialized?
Definition: IGUIElement.h:996
void setTabOrder(s32 index)
Sets the priority of focus when using the tab key to navigate between a group of elements.
Definition: IGUIElement.h:394
virtual bool isPointInside(const core::position2d< s32 > &point) const
Returns true if a point is within this element.
Definition: IGUIElement.h:272
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:191
virtual void draw()
Draws the element and its children.
Definition: IGUIElement.h:312
virtual const wchar_t * getText() const
Returns caption of this element.
Definition: IGUIElement.h:487
virtual void addChild(IGUIElement *child)
Adds a GUI element as new child of this element.
Definition: IGUIElement.h:279
virtual void setEnabled(bool enabled)
Sets the enabled state of this element.
Definition: IGUIElement.h:473
virtual void removeChild(IGUIElement *child)
Removes a child.
Definition: IGUIElement.h:289
core::rect< s32 > getRelativePosition() const
Returns the relative rectangle of this element.
Definition: IGUIElement.h:73
virtual bool hasType(EGUI_ELEMENT_TYPE type) const
Returns true if the gui element supports the given type.
Definition: IGUIElement.h:724
EGUI_ALIGNMENT AlignBottom
Definition: IGUIElement.h:1023
core::stringw ToolTipText
tooltip
Definition: IGUIElement.h:1005
void recalculateAbsolutePosition(bool recursive)
Definition: IGUIElement.h:831
virtual void setName(const c8 *name)
Sets the name of the element.
Definition: IGUIElement.h:748
virtual void setSubElement(bool subElement)
Sets whether this control was created as part of its parent.
Definition: IGUIElement.h:368
IGUIElement * getTabGroup()
Returns the container element which holds all elements in this element's tab group.
Definition: IGUIElement.h:446
IGUIElement(EGUI_ELEMENT_TYPE type, IGUIEnvironment *environment, IGUIElement *parent, s32 id, const core::rect< s32 > &rectangle)
Constructor.
Definition: IGUIElement.h:30
virtual bool OnEvent(const SEvent &event)
Called if an event happened.
Definition: IGUIElement.h:522
virtual void setID(s32 id)
Sets the id of this element.
Definition: IGUIElement.h:515
void setTabStop(bool enable)
If set to true, the focus will visit this element when using the tab key to cycle through elements.
Definition: IGUIElement.h:377
virtual void setName(const core::stringc &name)
Sets the name of the element.
Definition: IGUIElement.h:756
virtual void setToolTipText(const wchar_t *text)
Sets the new caption of this element.
Definition: IGUIElement.h:494
bool isTabGroup() const
Returns true if this element is a tab group.
Definition: IGUIElement.h:438
bool isMyChild(IGUIElement *child) const
Definition: IGUIElement.h:606
s32 ID
users can set this for identificating the element by integer
Definition: IGUIElement.h:1011
IGUIEnvironment * Environment
GUI Environment.
Definition: IGUIElement.h:1026
void setNotClipped(bool noClip)
Sets whether the element will ignore its parent's clipping rectangle.
Definition: IGUIElement.h:154
virtual void move(core::position2d< s32 > absoluteMovement)
Moves this element.
Definition: IGUIElement.h:336
virtual const core::list< IGUIElement * > & getChildren() const
Returns list with children of this element.
Definition: IGUIElement.h:570
bool IsTabGroup
tab groups are containers like windows, use ctrl+tab to navigate
Definition: IGUIElement.h:1020
virtual void setText(const wchar_t *text)
Sets the new caption of this element.
Definition: IGUIElement.h:480
bool NoClip
does this element ignore its parent's clipping rectangle?
Definition: IGUIElement.h:999
core::list< IGUIElement * > Children
List of all children of this element.
Definition: IGUIElement.h:962
s32 TabOrder
tab order
Definition: IGUIElement.h:1017
bool isNotClipped() const
Gets whether the element will ignore its parent's clipping rectangle.
Definition: IGUIElement.h:163
core::rect< s32 > getAbsolutePosition() const
Gets the absolute rectangle of this element.
Definition: IGUIElement.h:139
virtual bool sendToBack(IGUIElement *child)
Moves a child to the back, so it's siblings are drawn on top of it.
Definition: IGUIElement.h:550
virtual IGUIElement * getElementFromId(s32 id, bool searchchildren=false) const
Finds the first element with the given id.
Definition: IGUIElement.h:583
virtual bool isVisible() const
Returns true if element is visible.
Definition: IGUIElement.h:343
void setTabGroup(bool isGroup)
Sets whether this element is a container for a group of elements which can be navigated using the tab...
Definition: IGUIElement.h:431
core::dimension2du MinSize
Definition: IGUIElement.h:987
void setRelativePositionProportional(const core::rect< f32 > &r)
Sets the relative rectangle of this element as a proportion of its parent's area.
Definition: IGUIElement.h:119
virtual bool isSubElement() const
Returns true if this element was created as part of its parent control.
Definition: IGUIElement.h:358
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
Definition: IGUIElement.h:630
void setRelativePosition(const core::position2di &position)
Sets the relative rectangle of this element, maintaining its current width and height.
Definition: IGUIElement.h:105
bool IsEnabled
is enabled?
Definition: IGUIElement.h:993
void addChildToEnd(IGUIElement *child)
Definition: IGUIElement.h:818
virtual const core::stringw & getToolTipText() const
Returns caption of this element.
Definition: IGUIElement.h:501
EGUI_ALIGNMENT AlignTop
Definition: IGUIElement.h:1023
EGUI_ALIGNMENT AlignRight
Definition: IGUIElement.h:1023
virtual bool bringToFront(IGUIElement *element)
Brings a child to front.
Definition: IGUIElement.h:530
virtual void serializeAttributes(io::IAttributes *out, io::SAttributeReadWriteOptions *options=0) const
Writes attributes of the scene node.
Definition: IGUIElement.h:765
virtual void OnPostRender(u32 timeMs)
animate the element and its children.
Definition: IGUIElement.h:324
core::stringc Name
users can set this for identificating the element by string
Definition: IGUIElement.h:1008
EGUI_ELEMENT_TYPE Type
type of element
Definition: IGUIElement.h:1029
virtual void updateAbsolutePosition()
Updates the absolute position.
Definition: IGUIElement.h:217
IGUIElement * Parent
Pointer to the parent.
Definition: IGUIElement.h:965
core::rect< s32 > DesiredRect
Definition: IGUIElement.h:978
bool IsVisible
is visible?
Definition: IGUIElement.h:990
virtual bool isEnabled() const
Returns true if element is enabled.
Definition: IGUIElement.h:462
void setMinSize(core::dimension2du size)
Sets the minimum size allowed for this element.
Definition: IGUIElement.h:179
void setMaxSize(core::dimension2du size)
Sets the maximum size allowed for this element.
Definition: IGUIElement.h:171
IGUIElement * getParent() const
Returns parent of this element.
Definition: IGUIElement.h:66
IGUIElement * getElementFromPoint(const core::position2d< s32 > &point)
Returns the topmost GUI element at the specific position.
Definition: IGUIElement.h:242
virtual const c8 * getName() const
Returns the name of the element.
Definition: IGUIElement.h:740
EGUI_ELEMENT_TYPE getType() const
Returns the type of the gui element.
Definition: IGUIElement.h:710
virtual void setVisible(bool visible)
Sets the visible state of this element.
Definition: IGUIElement.h:351
core::rect< s32 > RelativeRect
relative rect of element
Definition: IGUIElement.h:968
s32 getTabOrder() const
Returns the number in the tab order sequence.
Definition: IGUIElement.h:422
core::stringw Text
caption
Definition: IGUIElement.h:1002
core::rect< s32 > getAbsoluteClippingRect() const
Returns the visible area of the element.
Definition: IGUIElement.h:146
virtual void deserializeAttributes(io::IAttributes *in, io::SAttributeReadWriteOptions *options=0)
Reads attributes of the scene node.
Definition: IGUIElement.h:789
virtual s32 getID() const
Returns id. Can be used to identify the element.
Definition: IGUIElement.h:508
virtual const c8 * getTypeName() const
Returns the type name of the gui element.
Definition: IGUIElement.h:733
virtual void remove()
Removes this element from its parent.
Definition: IGUIElement.h:304
core::rect< f32 > ScaleRect
relative scale of the element inside its parent
Definition: IGUIElement.h:984
bool IsTabStop
tab stop like in windows
Definition: IGUIElement.h:1014
GUI Environment. Used as factory and manager of all other GUI elements.
An object which is able to serialize and deserialize its attributes into an attributes object.
Provides a generic interface for attributes and their values and the possiblity to serialize them.
Definition: IAttributes.h:42
virtual void addString(const c8 *attributeName, const c8 *value)=0
Adds an attribute as string.
virtual bool getAttributeAsBool(const c8 *attributeName)=0
virtual void addBool(const c8 *attributeName, bool value)=0
Adds an attribute as bool.
virtual core::rect< s32 > getAttributeAsRect(const c8 *attributeName)=0
virtual core::stringc getAttributeAsString(const c8 *attributeName)=0
virtual core::stringw getAttributeAsStringW(const c8 *attributeName)=0
virtual void addRect(const c8 *attributeName, core::rect< s32 > value)=0
Adds an attribute as rectangle.
virtual core::position2di getAttributeAsPosition2d(const c8 *attributeName)=0
virtual s32 getAttributeAsInt(const c8 *attributeName) const =0
virtual void addPosition2d(const c8 *attributeName, core::position2di value)=0
Adds an attribute as 2d position.
virtual const c8 * getAttributeAsEnumeration(const c8 *attributeName)=0
virtual void addEnum(const c8 *attributeName, const c8 *enumValue, const c8 *const *enumerationLiterals)=0
Adds an attribute as enum.
virtual void addInt(const c8 *attributeName, s32 value)=0
Adds an attribute as integer.
#define _IRR_IMPLEMENT_MANAGED_MARSHALLING_BUGFIX
Defines a small statement to work around a microsoft compiler bug.
Definition: irrTypes.h:207
REALINLINE s32 floor32(f32 x)
Definition: irrMath.h:613
REALINLINE s32 round32(f32 x)
Definition: irrMath.h:680
@ EGUIA_SCALE
Stretched to fit parent.
Definition: EGUIAlignment.h:21
@ EGUIA_LOWERRIGHT
Aligned to parent's bottom or right side.
Definition: EGUIAlignment.h:17
@ EGUIA_UPPERLEFT
Aligned to parent's top or left side (default)
Definition: EGUIAlignment.h:15
@ EGUIA_CENTER
Aligned to the center of parent.
Definition: EGUIAlignment.h:19
const c8 *const GUIAlignmentNames[]
Names for alignments.
Definition: EGUIAlignment.h:25
EGUI_ELEMENT_TYPE
List of all basic Irrlicht GUI elements.
const c8 *const GUIElementTypeNames[]
Names for built-in element types.
Everything in the Irrlicht Engine can be found in this namespace.
Definition: aabbox3d.h:13
float f32
32 bit floating point variable.
Definition: irrTypes.h:104
unsigned int u32
32 bit unsigned variable.
Definition: irrTypes.h:58
char c8
8 bit character variable.
Definition: irrTypes.h:31
signed int s32
32 bit signed variable.
Definition: irrTypes.h:66
SEvents hold information about an event. See irr::IEventReceiver for details on event handling.
struct holding data describing options