Class TGUIElement

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type TGUIElement = class(TAttributeExchangingObject, IEventReceiver)

Description

Base class of all GUI elements.

Hierarchy

Overview

Methods

Public function BringToFront(Element: TGUIElement): Boolean; inline;
Public function GetAbsoluteClippingRect: TRect; inline;
Public function GetAbsolutePosition: TRect; inline;
Public function GetChildren: TGUIElementIterator; inline;
Public function GetContainingTabGroup: TGUIElement; inline;
Public function GetElementFromID(ID: LongInt; Recursive: Boolean=False): TGUIElement; inline;
Public function GetElementFromPoint(const Position: TPoint): TGUIElement; inline;
Public function GetNextElement(StartOrder: LongInt; Reverse, Group: Boolean; var First, Closest: TGUIElement; IncludeInvisible: Boolean = False): Boolean; inline;
Public function GetParent: TGUIElement; inline;
Public function HandleEvent(Event: TIrrlichtEvent): Boolean; virtual;
Public function HasType(EType: TGUIElementType): Boolean; inline;
Public function IsMyChild(Child: TGUIElement): Boolean; inline;
Public function IsPointInside(const Point: TPoint): Boolean; inline;
Public procedure AddChild(Child: TGUIElement); inline;
Public procedure Draw; inline;
Public procedure HandlePostRender(TimeMs: LongWord); inline;
Public procedure Move(const AbsoluteMovement: TPoint); inline;
Public procedure Remove; inline;
Public procedure RemoveChild(Child: TGUIElement); inline;
Public procedure SetAlignment(Left, Right, Top, Bottom: TGUIAlignment); inline;
Public procedure SetMaxSize(const Size: TSize); inline;
Public procedure SetMinSize(const Size: TSize); inline;
Public procedure SetRelativePosition(const Position: TPoint); overload; inline;
Public procedure SetRelativePositionProportional(const Rect: TFloatRect); inline;
Public procedure UpdateAbsolutePosition; inline;

Properties

Public property ElementType: TGUIElementType read GetElementType;
Public property Enabled: Boolean read IsEnabled write SetEnabled;
Public property ID: LongInt read GetID;
Public property IgnoreClipping: Boolean read IsNotClipped write SetNotClipped;
Public property RelativePosition: TRect read GetRelativePosition write SetRelativePosition;
Public property SubElement: Boolean read IsSubElement write SetSubElement;
Public property TabGroup: Boolean read IsTabGroup write SetTabGroup;
Public property TabOrder: LongInt read GetTabOrder write SetTabOrder;
Public property TabStop: Boolean read IsTabStop write SetTabStop;
Public property Text: StringType read GetText write SetText;
Public property ToolTipText: StringType read GetToolTipText write SetToolTipText;
Public property TypeName: AnsiString read GetTypeName;
Public property Visible: Boolean read IsVisible write SetVisible;

Description

Methods

Public function BringToFront(Element: TGUIElement): Boolean; inline;

Brings a child to front.

Public function GetAbsoluteClippingRect: TRect; inline;

Returns the visible area of the element.

Public function GetAbsolutePosition: TRect; inline;

Gets the absolute rectangle of this element.

Public function GetChildren: TGUIElementIterator; inline;

Returns an iterator object for all child elements.

Public function GetContainingTabGroup: TGUIElement; inline;

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

Public function GetElementFromID(ID: LongInt; Recursive: Boolean=False): TGUIElement; inline;

Finds the first element with the given id.

Parameters
ID
The ID to look for.
Recursive
Set this to true, if also children of this element may contain the element with the searched id and they should be searched too.
Public function GetElementFromPoint(const Position: TPoint): TGUIElement; inline;

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 GUIEnvironment.GetRoot. 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
Position
The 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.

Public function GetNextElement(StartOrder: LongInt; Reverse, Group: Boolean; var First, Closest: TGUIElement; IncludeInvisible: Boolean = False): Boolean; inline;

Searches elements to find the closest element to tab to.

Parameters
StartOrder
The TabOrder of the current element, -1 if none
Reverse
True if searching for a lower number
Group
True if searching for a higher one
First
Element with the highest/lowest known tab order depending on search direction.
Closest
The closest match, depending on tab order and direction
IncludeInvisible
Includes invisible elements in the search (default: False)
Returns

True if successfully found an element, False to continue searching/fail

Public function GetParent: TGUIElement; inline;

Returns parent of this element.

Public function HandleEvent(Event: TIrrlichtEvent): Boolean; virtual;

Handles an event.
This is the wrapped version of IGUIElement::OnEvent.
If you want to post an event, use TGUIEnvironment.PostEventFromUser instead.

Public function HasType(EType: TGUIElementType): Boolean; inline;

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 inherited HasType, but you have to do an explicit comparison check, because otherwise the base class usually just checks for the membervariable Type which contains the type of your derived class.

Public function IsMyChild(Child: TGUIElement): Boolean; inline;

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

Public function IsPointInside(const Point: TPoint): Boolean; inline;

Returns true if a point is within this element.
Elements with a shape other than a rectangle should override this method.

Public procedure AddChild(Child: TGUIElement); inline;

Adds a GUI element as new child of this element.

Public procedure Draw; inline;

Draws the element and its children.

Public procedure HandlePostRender(TimeMs: LongWord); inline;

Animate the element and its children.
This is the wrapped version of IGUIElement::OnPostRender.

Public procedure Move(const AbsoluteMovement: TPoint); inline;

Moves the element to a new position.

Public procedure Remove; inline;

Removes this element from its parent.

Public procedure RemoveChild(Child: TGUIElement); inline;

Removes a child.

Public procedure SetAlignment(Left, Right, Top, Bottom: TGUIAlignment); inline;

Realigns this element within its parent.

Public procedure SetMaxSize(const Size: TSize); inline;

Sets the maximum size allowed for this element.
If set to 0,0, there is no maximum size. }

Public procedure SetMinSize(const Size: TSize); inline;

Sets the minimum size allowed for this element.

Public procedure SetRelativePosition(const Position: TPoint); overload; inline;

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

Parameters
Position
The new relative position to set. Width and height will not be changed.
Public procedure SetRelativePositionProportional(const Rect: TFloatRect); inline;

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

Parameters
Rect
The 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.
Public procedure UpdateAbsolutePosition; inline;

Updates the absolute position.

Properties

Public property ElementType: TGUIElementType read GetElementType;

The type of this element.

Public property Enabled: Boolean read IsEnabled write SetEnabled;
 
Public property ID: LongInt read GetID;

An user-defined ID for identifying the element.

Public property IgnoreClipping: Boolean read IsNotClipped write SetNotClipped;

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

Public property RelativePosition: TRect read GetRelativePosition write SetRelativePosition;

The relative rectangle of this element.

Public property SubElement: Boolean read IsSubElement write SetSubElement;

True if this element was created as part of its parent control.
For example, it is True when a scrollbar is part of a listbox. SubElements are not saved to disk when calling TGUIEnvironment.SaveGUI.

Public property TabGroup: Boolean read IsTabGroup write SetTabGroup;

True if this element is a tab group. For example, windows are tab groups. Groups can be navigated using ctrl+tab, providing TabStop is true.

Public property TabOrder: LongInt read GetTabOrder write SetTabOrder;

The number in the tab order sequence.
See TabGroup and TabGroup for information on tab groups. Elements with a lower number are focused first

Public property TabStop: Boolean read IsTabStop write SetTabStop;

True if this element can be focused by navigating with the tab key.
If this element is a tab group (see TabGroup) then ctrl+tab will be used instead.

Public property Text: StringType read GetText write SetText;

The caption of this element.

Public property ToolTipText: StringType read GetToolTipText write SetToolTipText;

The tool tip text. Appears on hovering the element.

Public property TypeName: AnsiString read GetTypeName;

Returns the type name of the gui element.
This is needed for serializing elements. For serializing your own elements, override the appropriate function and return your own type name which is created by your TGUIElementFactory.

Public property Visible: Boolean read IsVisible write SetVisible;

True if this element is visible.


Generated by PasDoc 0.12.1 on 2012-09-14 17:32:22