Class TCastleImageControl

Unit

Declaration

type TCastleImageControl = class(TCastleUserInterface)

Description

Image control. Size is automatically adjusted to the image size, if Stretch is False (default). You should set TCastleImageControl.Left, TCastleImageControl.Bottom properties, and load your image by setting TCastleImageControl.Url property or straight TCastleImageControl.Image.

We automatically use alpha test or alpha blending based on loaded image alpha channel (see TDrawableImage.Alpha). You can influence this by AlphaChannel property.

Source: ui/castlecontrols_imagecontrol.inc (line 40).

Hierarchy

Show Additional Members:

Overview

Constants

Public DefaultWidth = 100.0;
Public DefaultHeight = 100.0;

Methods

Protected function GetInternalText: String; virtual;
Protected procedure SetInternalText(const Value: String); virtual;
Protected procedure SetName(const Value: TComponentName); override;
Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); virtual;
Public destructor Destroy; override;
Public procedure CustomSerialization(const SerializationProcess: TSerializationProcess); virtual;
Public function PropertySections(const PropertyName: String): TPropertySections; virtual;
Public procedure SetTransient;
Public procedure AddNonVisualComponent(const NonVisualComponent: TComponent);
Public procedure InsertNonVisualComponent(const Index: Integer; const NonVisualComponent: TComponent);
Public procedure RemoveNonVisualComponent(const NonVisualComponent: TComponent);
Public function NonVisualComponentsIndexOf(const NonVisualComponent: TComponent): Integer;
Public function NonVisualComponentsCount: Integer;
Public function NonVisualComponentsEnumerate: TNonVisualComponentsEnumerator;
Public function ValueIsStreamed: Boolean; virtual;
Public procedure DesignerInfo(const SList: TStrings); virtual;
Public procedure DesignerWarnings(const SList: TStrings); virtual;
Protected procedure Loaded; override;
Protected function ContainerWidth: Cardinal; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledWidth" or "Container.PixelsWidth" after checking "Container <> nil"';
Protected function ContainerHeight: Cardinal; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledHeight" or "Container.PixelsHeight" after checking "Container <> nil"';
Protected function ContainerRect: TRectangle; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledRect" or "Container.PixelsRect" after checking "Container <> nil"';
Protected function ContainerSizeKnown: boolean; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledWidth/Height" or "Container.PixelsWidth/Height" after checking "Container <> nil"';
Protected procedure DoCursorChange; virtual; deprecated 'better override VisibleChange and watch for chCursor in Changes';
Protected procedure DefineProperties(Filer: TFiler); override;
Protected procedure UIScaleChanged; virtual;
Protected procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); virtual;
Protected procedure BeforeSizing; virtual;
Protected procedure DoInternalMouseEnter; virtual;
Protected procedure DoInternalMouseLeave; virtual;
Protected function Theme: TCastleTheme;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;
Public procedure DesignerInfo(const SList: TStrings); override;
Public procedure DesignerWarnings(const SList: TStrings); override;
Public function GetEnumerator: TEnumerator;
Public procedure InternalSetContainer(const Value: TCastleContainer); virtual;
Public function Press(const Event: TInputPressRelease): boolean; virtual;
Public function Release(const Event: TInputPressRelease): boolean; virtual;
Public function PreviewPress(const Event: TInputPressRelease): boolean; virtual;
Public function PreviewRelease(const Event: TInputPressRelease): boolean; virtual;
Public function Motion(const Event: TInputMotion): boolean; virtual;
Public function SensorRotation(const X, Y, Z, Angle: Double; const SecondsPassed: Single): boolean; virtual;
Public function SensorTranslation(const X, Y, Z, Length: Double; const SecondsPassed: Single): boolean; virtual;
Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); virtual;
Public procedure VisibleChange(const Changes: TCastleUserInterfaceChanges; const ChangeInitiatedByChildren: boolean = false); overload; virtual;
Public function AllowSuspendForInput: boolean; virtual;
Public procedure Resize; virtual;
Public function ControlsCount: Integer;
Public procedure InsertFront(const NewItem: TCastleUserInterface); overload;
Public procedure InsertFrontIfNotExists(const NewItem: TCastleUserInterface);
Public procedure InsertFront(const NewItems: TCastleUserInterfaceList); overload;
Public procedure InsertBack(const NewItem: TCastleUserInterface); overload;
Public procedure InsertBackIfNotExists(const NewItem: TCastleUserInterface);
Public procedure InsertBack(const NewItems: TCastleUserInterfaceList); overload;
Public procedure InsertControl(const Index: Integer; const NewItem: TCastleUserInterface);
Public procedure RemoveControl(const Item: TCastleUserInterface);
Public function IndexOfControl(const Item: TCastleUserInterface): Integer;
Public procedure ClearControls;
Public procedure MoveToFront;
Public function CapturesEventsAtPosition(const Position: TVector2): boolean; virtual;
Public procedure BeforeRender; virtual;
Public procedure Render; virtual;
Public procedure RenderOverChildren; virtual;
Public function TooltipExists: Boolean; virtual; deprecated 'use TooltipControl to customize tooltip look';
Public procedure TooltipRender(const TooltipPosition: TVector2); virtual; deprecated 'use TooltipControl to customize tooltip look';
Public procedure GLContextOpen; virtual;
Public procedure GLContextClose; virtual;
Public procedure SetFocused(const Value: boolean); virtual;
Public function EffectiveRect: TFloatRectangle;
Public function EffectiveWidth: Single;
Public function EffectiveHeight: Single;
Public function EffectiveWidthForChildren: Single;
Public function EffectiveHeightForChildren: Single;
Public function CalculatedWidth: Cardinal; deprecated 'use EffectiveWidth';
Public function CalculatedHeight: Cardinal; deprecated 'use EffectiveHeight';
Public function CalculatedRect: TRectangle; deprecated 'use EffectiveRect';
Public function RenderRect: TFloatRectangle;
Public function RenderRectWithBorder: TFloatRectangle;
Public function ScreenRect: TRectangle; deprecated 'use RenderRect';
Public function ContainerToLocalPosition(ContainerPosition: TVector2; const ContainerPositionScaled: Boolean = true): TVector2;
Public function LocalToContainerPosition(const LocalPosition: TVector2; const ContainerPositionScaled: Boolean = true): TVector2;
Public function ParentRect: TFloatRectangle;
Public procedure Anchor(const AHorizontalAnchor: THorizontalPosition; const TranslationX: Single = 0); overload;
Public procedure Anchor( const AHorizontalAnchorSelf, AHorizontalAnchorParent: THorizontalPosition; const TranslationX: Single = 0); overload;
Public procedure Anchor(const AVerticalAnchor: TVerticalPosition; const TranslationY: Single = 0); overload;
Public procedure Anchor( const AVerticalAnchorSelf, AVerticalAnchorParent: TVerticalPosition; const TranslationY: Single = 0); overload;
Public procedure AlignHorizontal( const ControlPosition: TPositionRelative = prMiddle; const ContainerPosition: TPositionRelative = prMiddle; const X: Single = 0); deprecated 'use Anchor';
Public procedure Align( const ControlPosition: THorizontalPosition; const ContainerPosition: THorizontalPosition; const X: Single = 0); overload; deprecated 'use Anchor';
Public procedure AlignVertical( const ControlPosition: TPositionRelative = prMiddle; const ContainerPosition: TPositionRelative = prMiddle; const Y: Single = 0); deprecated 'use Anchor';
Public procedure Align( const ControlPosition: TVerticalPosition; const ContainerPosition: TVerticalPosition; const Y: Single = 0); overload; deprecated 'use Anchor';
Public procedure Center; deprecated 'use Anchor(hpMiddle); Anchor(vpMiddle); to reliably center the control';
Public function UIScale: Single; virtual;
Public procedure EditorAllowResize(out ResizeWidth, ResizeHeight: Boolean; out Reason: String); virtual;
Public function EffectiveFullSize: Boolean;
Protected procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure Render; override;
Public procedure GLContextOpen; override;
Public procedure EditorAllowResize( out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;
Public procedure ImageChanged;

Properties

Public property NonVisualComponents [const Index: Integer]: TComponent read GetNonVisualComponents;
Public property IsLoading: Boolean read FIsLoading;
Public property OnVisibleChange: TCastleUserInterfaceChangeEvent read FOnVisibleChange write FOnVisibleChange;
Public property Container: TCastleContainer read FContainer;
Public property OnCursorChange: TNotifyEvent read FOnCursorChange write FOnCursorChange; deprecated 'use OnVisibleChange (or override VisibleChange) and watch for Changes that include chCursor';
Public property ExclusiveEvents: boolean read FExclusiveEvents write FExclusiveEvents default true; deprecated 'do not use this; supporting this property was complicated and had no real benefit; everything now works as if ExclusiveEvents=true, always';
Public property Controls [const Index: Integer]: TCastleUserInterface read GetControls write SetControls;
Public property GetExists: Boolean read FExists; deprecated 'use Exists';
Public property GLInitialized: boolean read FGLInitialized default false;
Public property Focused: boolean read FFocused write SetFocused;
Public property Parent: TCastleUserInterface read FParent ;
Public property FloatWidth: Single read FWidth write SetWidth stored false; deprecated 'use Width';
Public property FloatHeight: Single read FHeight write SetHeight stored false; deprecated 'use Height';
Public property AnchorDelta: TVector2 read FTranslation write SetTranslation; deprecated 'use Translation';
Public property Translation: TVector2 read FTranslation write SetTranslation;
Public property KeepInFront: boolean read FKeepInFront write FKeepInFront default false;
Public property BorderColor: TCastleColor read FBorderColor write SetBorderColor;
Public property HasHorizontalAnchor: boolean read FHasHorizontalAnchor write FHasHorizontalAnchor stored false; deprecated 'this property does not do anything anymore, anchors are always active';
Public property HasVerticalAnchor: boolean read FHasVerticalAnchor write FHasVerticalAnchor stored false; deprecated 'this property does not do anything anymore, anchors are always active';
Public property HorizontalAnchorDelta: Single read GetHorizontalAnchorDelta write SetHorizontalAnchorDelta default 0; deprecated 'use Translation.X';
Public property VerticalAnchorDelta: Single read GetVerticalAnchorDelta write SetVerticalAnchorDelta default 0; deprecated 'use Translation.Y';
Public property Visible: Boolean read FVisible;
Public property EnableUIScaling: boolean read FEnableUIScaling write SetEnableUIScaling default true;
Public property CapturesEvents: boolean read FCapturesEvents write FCapturesEvents default true;
Public property OnInternalMouseEnter: TUiNotifyEvent read FOnInternalMouseEnter write FOnInternalMouseEnter;
Public property OnInternalMouseLeave: TUiNotifyEvent read FOnInternalMouseLeave write FOnInternalMouseLeave;
Published property Cursor: TMouseCursor read FCursor write SetCursor default mcDefault;
Published property OnUpdate: TUiUpdateEvent read FOnUpdate write FOnUpdate;
Published property OnPress: TUiPressReleaseEvent read FOnPress write FOnPress;
Published property OnRelease: TUiPressReleaseEvent read FOnRelease write FOnRelease;
Published property OnMotion: TUiMotionEvent read FOnMotion write FOnMotion;
Published property OnRender: TUiNotifyEvent read FOnRender write FOnRender;
Published property Exists: boolean read FExists write SetExists default true;
Published property Left: Single read FLeft write SetLeft stored false default 0; deprecated 'use Translation.X';
Published property Bottom: Single read FBottom write SetBottom default 0; deprecated 'use Translation.Y';
Published property FullSize: boolean read FFullSize write SetFullSize default false;
Published property Width: Single read FWidth write SetWidth default DefaultWidth;
Published property Height: Single read FHeight write SetHeight default DefaultHeight;
Published property WidthFraction: Single read FWidthFraction write SetWidthFraction default 0.0;
Published property HeightFraction: Single read FHeightFraction write SetHeightFraction default 0.0;
Published property AutoSizeToChildren: Boolean read FAutoSizeToChildren write SetAutoSizeToChildren default false;
Published property AutoSizeToChildrenPaddingRight: Single read FAutoSizeToChildrenPaddingRight write SetAutoSizeToChildrenPaddingRight default 0;
Published property AutoSizeToChildrenPaddingTop: Single read FAutoSizeToChildrenPaddingTop write SetAutoSizeToChildrenPaddingTop default 0;
Published property HorizontalAnchorSelf: THorizontalPosition read FHorizontalAnchorSelf write SetHorizontalAnchorSelf default hpLeft;
Published property HorizontalAnchorParent: THorizontalPosition read FHorizontalAnchorParent write SetHorizontalAnchorParent default hpLeft;
Published property VerticalAnchorSelf: TVerticalPosition read FVerticalAnchorSelf write SetVerticalAnchorSelf default vpBottom;
Published property VerticalAnchorParent: TVerticalPosition read FVerticalAnchorParent write SetVerticalAnchorParent default vpBottom;
Published property Culling: Boolean read FCulling write SetCulling default false;
Published property ClipChildren: Boolean read FClipChildren write SetClipChildren default false;
Published property Border: TBorder read FBorder;
Published property CustomTheme: TCastleTheme read FCustomTheme write SetCustomTheme;
Published property TooltipControl: TCastleUserInterface read FTooltipControl write SetTooltipControl;
Published property EditorSelectOnHover: Boolean read FEditorSelectOnHover write FEditorSelectOnHover default true;
Published property BorderColorPersistent: TCastleColorPersistent read FBorderColorPersistent ;
Published property TranslationPersistent: TCastleVector2Persistent read FTranslationPersistent ;
Public property Image: TEncodedImage read GetImage write SetImage;
Public property OwnsImage: boolean read GetOwnsImage write SetOwnsImage default true;
Public property DrawableImage: TDrawableImage read GetDrawableImage write SetDrawableImage;
Public property OwnsDrawableImage: boolean read GetOwnsDrawableImage write SetOwnsDrawableImage default true;
Public property Color: TCastleColor read GetColor write SetColor;
Public property Corners: TVector4Integer read GetCorners write SetCorners; deprecated 'use ProtectedSides';
Public property CenterX: Single read GetCenterX write SetCenterX default 0.5; deprecated 'use RotationCenter';
Public property CenterY: Single read GetCenterY write SetCenterY default 0.5; deprecated 'use RotationCenter';
Public property RotationCenter: TVector2 read GetRotationCenter write SetRotationCenter;
Public property ClipLine: TVector3 read GetClipLine write SetClipLine;
Public property Region: TFloatRectangle read GetRegion write SetRegion;
Public property CustomShader: TGLSLProgram read GetCustomShader write SetCustomShader;
Public property Blending: boolean read GetBlending write SetBlending stored false; deprecated 'use AlphaChannel';
Public property Proportional: boolean read GetProportional write SetProportional stored false default false; deprecated 'use ProportionalScaling';
Public property FileName: string read GetUrl write SetUrl stored false; deprecated 'use Url';
Published property Content: TCastleImagePersistent read FContent;
Published property Url: String read GetUrl write SetUrl stored false;
Published property AlphaChannel: TAutoAlphaChannel read GetAlphaChannel write SetAlphaChannel stored false default acAuto;
Published property SmoothScaling: boolean read GetSmoothScaling write SetSmoothScaling stored false default true;
Published property Stretch: boolean read FStretch write SetStretch default false;
Published property ProportionalScaling: TProportionalScaling read FProportionalScaling write SetProportionalScaling default psNone;
Published property Cache: boolean read GetCache write SetCache stored false default true;
Published property FlipHorizontal: Boolean read GetFlipHorizontal write SetFlipHorizontal stored false default false;
Published property FlipVertical: Boolean read GetFlipVertical write SetFlipVertical stored false default false;
Published property ProtectedSides: TBorder read GetProtectedSides stored false;
Published property DetectScaleFromUrl: Boolean read FDetectScaleFromUrl write SetDetectScaleFromUrl default false;
Published property Rotation: Single read GetRotation write SetRotation stored false default 0;
Published property Clip: boolean read GetClip write SetClip stored false default false;
Published property ColorPersistent: TCastleColorPersistent read FColorPersistent stored false;
Published property ClipLinePersistent: TCastleVector3Persistent read FClipLinePersistent stored false;
Published property RotationCenterPersistent: TCastleVector2Persistent read FRotationCenterPersistent stored false;
Published property RegionPersistent: TFloatRectanglePersistent read FRegionPersistent stored false;

Description

Constants

Public DefaultWidth = 100.0;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 310).

Public DefaultHeight = 100.0;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 311).

Methods

Protected function GetInternalText: String; virtual;

This item has no description.

Source: base/castleclassutils.pas (line 575).

Protected procedure SetInternalText(const Value: String); virtual;

This item has no description.

Source: base/castleclassutils.pas (line 576).

Protected procedure SetName(const Value: TComponentName); override;

This item has no description.

Source: base/castleclassutils.pas (line 577).

Protected procedure TranslateProperties(const TranslatePropertyEvent: TTranslatePropertyEvent); virtual;

Enumerate all properties that are possible to translate in this component. E.g. in TCastleLabel it will return TCastleLabel.Caption, in TCastleEdit it will return TCastleEdit.Text and TCastleEdit.Placeholder.

Returns only non-empty properties, thus assuming that if current (by convention, English) text is empty, then there is no point in translating it. Moreover descendants may define boolean properties to exclude particular text from translating, e.g. TCastleLabel.CaptionTranslate, TCastleEdit.TextTranslate, TCastleEdit.PlaceholderTranslate.

It is not recursive (it doesn't enumerate children properties). Use global TranslateProperties procedure to call this on a hierarchy of TComponent.

You usually don't want to call this method (it is called by other engine routines). But you may find it useful to override this, if you define new component.

Source: base/castleclassutils.pas (line 598).

Public destructor Destroy; override;

This item has no description.

Source: base/castleclassutils.pas (line 604).

Public procedure CustomSerialization(const SerializationProcess: TSerializationProcess); virtual;

Override this method to call various methods of SerializationProcess, which in turn allows to serialize/deserialize things that are not published. This allows to serialize/deserialize with more freedom, e.g. to serialize/deserialize some private field.

Source: base/castleclassutils.pas (line 610).

Public function PropertySections(const PropertyName: String): TPropertySections; virtual;

Section where to show property in the editor.

Source: base/castleclassutils.pas (line 631).

Public procedure SetTransient;

Ignore this component when serializing parent's TCastleUserInterface.Controls list or TCastleTransform.List, and do not show this component in CGE editor. This simply sets csTransient flag in ComponentStyle.

This is useful for children that are automatically managed by the parent, and should not be modified by user code. For example, TCastleCheckbox is internally composed from TCastleImageControl and TCastleLabel children, but we don't want to serialize or even show these children to user.

Note that if you want to prevent this component from serializing as part of TCastleUserInterface.Controls list or TCastleTransform.List, but you still want it to be visible in CGE editor, then make it a "subcomponent" instead, by SetSubComponent(true).

Note that both csSubComponent and csTransient only disable the component serialization as part of parent's lists enumerated by CustomSerialization (see internal TCastleUserInterface.SerializeChildrenEnumerate , TCastleTransform.SerializeChildrenEnumerate, TCastleTransform.SerializeBehaviorsEnumerate).

If you will make the component published in its own property (which is normal for "subcomponents") then it will be serialized anyway, just as part of it's own property (like TCastleScrollView.ScrollArea). So to really avoid serializing a children component make it csSubComponent and/or csTransient, and do not publish it.

Source: base/castleclassutils.pas (line 663).

Public procedure AddNonVisualComponent(const NonVisualComponent: TComponent);

Add non-visual component to this component. This is used to organize non-visual components in a tree hierarchy, in CGE designs and editor.

See also
NonVisualComponentsCount
Count of components added by AddNonVisualComponent.
NonVisualComponents
Components added by AddNonVisualComponent.
NonVisualComponentsEnumerate
You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do ....

Source: base/castleclassutils.pas (line 672).

Public procedure InsertNonVisualComponent(const Index: Integer; const NonVisualComponent: TComponent);

Insert non-visual component to this component. This is used to organize non-visual components in a tree hierarchy, in CGE designs and editor.

See also
NonVisualComponentsCount
Count of components added by AddNonVisualComponent.
NonVisualComponents
Components added by AddNonVisualComponent.
NonVisualComponentsEnumerate
You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do ....

Source: base/castleclassutils.pas (line 681).

Public procedure RemoveNonVisualComponent(const NonVisualComponent: TComponent);

Removes the component previously added by AddNonVisualComponent.

Source: base/castleclassutils.pas (line 684).

Public function NonVisualComponentsIndexOf(const NonVisualComponent: TComponent): Integer;

Index of the previously added non-visual component. Returns -1 if the component was not found.

Source: base/castleclassutils.pas (line 688).

Public function NonVisualComponentsCount: Integer;

Count of components added by AddNonVisualComponent.

See also
AddNonVisualComponent
Add non-visual component to this component.
NonVisualComponents
Components added by AddNonVisualComponent.
NonVisualComponentsEnumerate
You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do ....

Source: base/castleclassutils.pas (line 695).

Public function NonVisualComponentsEnumerate: TNonVisualComponentsEnumerator;

You can enumerate current non-visual components using loop like for C in MyComponent.NonVisualComponentsEnumerate do .... Do not call this method in other contexts, it is only useful for "for..in" construction.

See also
AddNonVisualComponent
Add non-visual component to this component.

Source: base/castleclassutils.pas (line 705).

Public function ValueIsStreamed: Boolean; virtual;

Whether the current value of this object should be written to the stream. This should be True if anything inside this object should be serialized (which means it has non-default value or "stored" specifier indicates that it should be serialized).

This is used by CastleComponentSerialize, which is used in Castle Game Engine for all serialization.

In simple cases, this just says whether the current value of this object equals to some default value.

The default implementation of this class returns True (so always write).

Descendants that override this to sometimes return False (so no need to write) must be very careful: any addition of a new field requires extending this method, otherwise new field may not be saved sometimes (when all other fields are default). Descentants of such classes must also be aware of it. This check must include everything that is inside this object in JSON, including subcomponents and children objects (as done e.g. by TSerializationProcess.ReadWriteList). In practice, overriding this method is only reasonable for simple classes that will not change much in the future, like TCastleVector3Persistent.

The name of this method is consistent with TPropertyEditor.ValueIsStreamed in LCL.

Source: base/castleclassutils.pas (line 739).

Public procedure DesignerInfo(const SList: TStrings); virtual;

Override to add information that should be visible at design-time. Call SList.Add for each new line of information.

Source: base/castleclassutils.pas (line 743).

Public procedure DesignerWarnings(const SList: TStrings); virtual;

Override to add warnings that should be visible at design-time. Call SList.Add for each new warning.

Source: base/castleclassutils.pas (line 747).

Protected procedure Loaded; override;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 249).

Protected function ContainerWidth: Cardinal; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledWidth" or "Container.PixelsWidth" after checking "Container <> nil"';

Warning: this symbol is deprecated: arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledWidth" or "Container.PixelsWidth" after checking "Container <> nil"

Container sizes.

Source: ui/castleuicontrols_userinterface.inc (line 261).

Protected function ContainerHeight: Cardinal; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledHeight" or "Container.PixelsHeight" after checking "Container <> nil"';

Warning: this symbol is deprecated: arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledHeight" or "Container.PixelsHeight" after checking "Container <> nil"

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 262).

Protected function ContainerRect: TRectangle; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledRect" or "Container.PixelsRect" after checking "Container <> nil"';

Warning: this symbol is deprecated: arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledRect" or "Container.PixelsRect" after checking "Container <> nil"

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 263).

Protected function ContainerSizeKnown: boolean; virtual; deprecated 'arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledWidth/Height" or "Container.PixelsWidth/Height" after checking "Container <> nil"';

Warning: this symbol is deprecated: arrange UI using anchors, FullSize and friends; if you really need container size, use "Container.UnscaledWidth/Height" or "Container.PixelsWidth/Height" after checking "Container <> nil"

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 264).

Protected procedure DoCursorChange; virtual; deprecated 'better override VisibleChange and watch for chCursor in Changes';

Warning: this symbol is deprecated: better override VisibleChange and watch for chCursor in Changes

Called when Cursor changed. In TCastleUserInterface class, just calls OnCursorChange.

Source: ui/castleuicontrols_userinterface.inc (line 270).

Protected procedure DefineProperties(Filer: TFiler); override;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 274).

Protected procedure UIScaleChanged; virtual;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 276).

Protected procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); virtual;

Controls that have a preferred size should override this. By default this contains values derived from Width, WidthFraction, Height, HeightFraction, with Border subtracted.

Note that the arguments should be already scaled, i.e. multiplied by UIScale, i.e. expressed in final device pixels.

Note that the returned PreferredWidth and PreferredHeight must not include the space for Border. Border size will be added later.

Source: ui/castleuicontrols_userinterface.inc (line 291).

Protected procedure BeforeSizing; virtual;

Called right before calculating size. This is your only chance to adjust e.g. children size, if you need them to be synchronized with something, and you may use AutoSizeToChildren.

In most use-cases, you rather adjust preferred size by overriding PreferredSize.

Source: ui/castleuicontrols_userinterface.inc (line 300).

Protected procedure DoInternalMouseEnter; virtual;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 302).

Protected procedure DoInternalMouseLeave; virtual;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 303).

Protected function Theme: TCastleTheme;

Theme that should be used by this control. Either CustomTheme or global Theme.

Source: ui/castleuicontrols_userinterface.inc (line 307).

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 313).

Public destructor Destroy; override;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 314).

Public procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override;

This item has no description. Showing description inherited from TCastleComponent.CustomSerialization.

Override this method to call various methods of SerializationProcess, which in turn allows to serialize/deserialize things that are not published. This allows to serialize/deserialize with more freedom, e.g. to serialize/deserialize some private field.

Source: ui/castleuicontrols_userinterface.inc (line 315).

Public function PropertySections(const PropertyName: String): TPropertySections; override;

This item has no description. Showing description inherited from TCastleComponent.PropertySections.

Section where to show property in the editor.

Source: ui/castleuicontrols_userinterface.inc (line 316).

Public procedure DesignerInfo(const SList: TStrings); override;

This item has no description. Showing description inherited from TCastleComponent.DesignerInfo.

Override to add information that should be visible at design-time. Call SList.Add for each new line of information.

Source: ui/castleuicontrols_userinterface.inc (line 317).

Public procedure DesignerWarnings(const SList: TStrings); override;

This item has no description. Showing description inherited from TCastleComponent.DesignerWarnings.

Override to add warnings that should be visible at design-time. Call SList.Add for each new warning.

Source: ui/castleuicontrols_userinterface.inc (line 318).

Public function GetEnumerator: TEnumerator;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 319).

Public procedure InternalSetContainer(const Value: TCastleContainer); virtual;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 320).

Public function Press(const Event: TInputPressRelease): boolean; virtual;

Override this method to react to user pressing a key, mouse button or mouse wheel. Return True if the event was handled, which prevents from passing this event to other UI controls.

When implementing in descendants it is best to override it like this:

function TMyControl.Press(const Event: TInputPressRelease): boolean;
begin
  Result := inherited;
  if Result then Exit; // exit if ancestor already handled this event

  if Event.IsKey(keyEnter) then
  begin
    // do something in reaction to Enter key
    ...
    // let engine know that this input event was handled
    Exit(true);
  end;

  if Event.IsMouseButton(buttonLeft) then
  begin
    // do something in reaction to left mouse button press
    ...
    // let engine know that this input event was handled
    Exit(true);
  end;
end;

These events are generated for all UI controls, whether they are considered "interactive" or not. These events are generated for non-interactive controls like TCastleRectangleControl or TCastleLabel as well. For example, these events ignore the TCastleButton.Enabled state, they are generated always (see https://github.com/castle-engine/castle-engine/issues/413 ). Use instead TCastleButton.OnClick to detect clicks on a button in a way that honors the TCastleButton.Enabled state.

When a control returns True from Press, it means it starts to "capture" subsequent mouse events: subsequent mouse moves and release will be send to this control even if mouse will move outside of this control.

The events Press and Release are passed to the parent only after the children had a chance to process this event. Overriding them makes sense if you draw something that "looks clickable" in TCastleUserInterface.Render, which is the standard place you should draw stuff. For example our TCastleButton draws there.

In contrast, the events PreviewPress and PreviewRelease are passed first to the parent control, before children have a chance to process this event. In partcular, overriding them makes sense if you draw something that "looks clickable" in TCastleUserInterface.RenderOverChildren.

Source: ui/castleuicontrols_userinterface.inc (line 376).

Public function Release(const Event: TInputPressRelease): boolean; virtual;

Override this method to react to user releasing a key, mouse button. Return True if the event was handled, which prevents from passing this event to other UI controls.

This is counterpart to Press method. See Press for more details.

Note: We'd like this method to also be called when user releases a mouse wheel. But currently releasing of the mouse wheel is not reported now by any backend. Only releasing of keys and mouse buttons is reported.

See also
Press
Override this method to react to user pressing a key, mouse button or mouse wheel.

Source: ui/castleuicontrols_userinterface.inc (line 391).

Public function PreviewPress(const Event: TInputPressRelease): boolean; virtual;

Similar to Press but allows the parent control to preview the event before it is passed to children UI controls.

See also
Press
Override this method to react to user pressing a key, mouse button or mouse wheel.

Source: ui/castleuicontrols_userinterface.inc (line 397).

Public function PreviewRelease(const Event: TInputPressRelease): boolean; virtual;

Similar to Release but allows the parent control to preview the event before it is passed to children UI controls.

See also
Press
Override this method to react to user pressing a key, mouse button or mouse wheel.

Source: ui/castleuicontrols_userinterface.inc (line 403).

Public function Motion(const Event: TInputMotion): boolean; virtual;

Motion of mouse or touch.

Source: ui/castleuicontrols_userinterface.inc (line 406).

Public function SensorRotation(const X, Y, Z, Angle: Double; const SecondsPassed: Single): boolean; virtual;

Rotation detected by 3D sensor. Used for example by 3Dconnexion devices.

Parameters
X
X axis (tilt forward/backwards)
Y
Y axis (rotate)
Z
Z axis (tilt sidewards)
Angle
Angle of rotation (in radians)
SecondsPassed
The time passed since last SensorRotation call. This is necessary because some sensors, e.g. 3Dconnexion, may *not* reported as often as normal Update calls.

Source: ui/castleuicontrols_userinterface.inc (line 418).

Public function SensorTranslation(const X, Y, Z, Length: Double; const SecondsPassed: Single): boolean; virtual;

Translation detected by 3D sensor. Used for example by 3Dconnexion devices.

Parameters
X
X axis (move left/right)
Y
Y axis (move up/down)
Z
Z axis (move forward/backwards)
Length
Length of the vector consisting of the above
SecondsPassed
The time passed since last SensorRotation call. This is necessary because some sensors, e.g. 3Dconnexion, may *not* reported as often as normal Update calls.

Source: ui/castleuicontrols_userinterface.inc (line 430).

Public procedure Update(const SecondsPassed: Single; var HandleInput: boolean); virtual;

Control may do here anything that must be continuously repeated. E.g. camera handles here falling down due to gravity, rotating model in Examine mode, and many more.

This method may be used, among many other things, to continuously react to the fact that user pressed some key (or mouse button). For example, if holding some key should move some 3D object, you should do something like:

if HandleInput then
begin
  if Container.Pressed[keyArrowRight] then
  begin
    Transform.Position := Transform.Position + Vector3(SecondsPassed * 10, 0, 0);
    HandleInput := false;
  end;
end;

Instead of directly using a key code, consider also using TInputShortcut that makes the input key nicely configurable. See engine tutorial about handling inputs.

Multiplying movement by SecondsPassed makes your operation frame-rate independent. Object will move by 10 units in a second, regardless of how many FPS your game has.

The code related to HandleInput is important if you write a generally-useful control that should nicely cooperate with all other controls, even when placed on top of them or under them. The correct approach is to only look at pressed keys/mouse buttons if HandleInput is True. Moreover, if you did check that HandleInput is True, and you did actually handle some keys, then you have to set HandleInput := false. This will prevent the other controls (behind the current control) from handling the keys (they will get HandleInput = False). And this is important to avoid doubly-processing the same key press, e.g. if two controls react to the same key, only the one on top should process it.

Note that to handle a single press / release (like "switch light on when pressing a key") you should rather use Press and Release methods. Use this method only for continuous handling (like "holding this key makes the light brighter and brighter").

To understand why such HandleInput approach is needed, realize that the "Update" events are called differently than simple mouse and key events like "Press" and "Release". "Press" and "Release" events return whether the event was somehow "handled", and the container passes them only to the controls under the mouse (decided by TCastleUserInterface.CapturesEventsAtPosition). And as soon as some control says it "handled" the event, other controls (even if under the mouse) will not receive the event.

This approach is not suitable for Update events. Some controls need to do the Update job all the time, regardless of whether the control is under the mouse and regardless of what other controls already did. So all controls (well, all controls that exist, in case of TCastleUserInterface, see TCastleUserInterface.Exists) receive Update calls.

So the "handled" status is passed through HandleInput. If a control is not under the mouse, it will receive HandleInput = False. If a control is under the mouse, it will receive HandleInput = True as long as no other control on top of it didn't already change it to False.

Parameters
SecondsPassed
Should be calculated like TFramesPerSecond.SecondsPassed, and usually it's in fact just taken from TCastleWindow.Fps.SecondsPassed.

Source: ui/castleuicontrols_userinterface.inc (line 504).

Public procedure VisibleChange(const Changes: TCastleUserInterfaceChanges; const ChangeInitiatedByChildren: boolean = false); overload; virtual;

Called always when something important inside this control (or it's children) changed. To be more precise, this is called when something mentioned among the TCastleUserInterfaceChange enumerated items changed.

This is always called with Changes <> [] (non-empty set).

Source: ui/castleuicontrols_userinterface.inc (line 512).

Public function AllowSuspendForInput: boolean; virtual;

Allow window containing this control to suspend waiting for user input. Typically you want to override this to return False when you do something in the overridden Update method.

In this class, this simply returns always True.

See also
TCastleWindow.AllowSuspendForInput
Is it allowed to suspend (for an indefinite amount of time) waiting for user input.

Source: ui/castleuicontrols_userinterface.inc (line 534).

Public procedure Resize; virtual;

Event called when the container (component or window with OpenGL context) size changes.

You can resize/reposition your component here to react to parent size changes. This is called only when the rendering context of the container is initialized, so you can be sure that this is called only between GLContextOpen and GLContextClose.

We also call this once when inserting into the controls list (like TCastleWindow.Controls or TCastleControl.Controls or inside parent TCastleUserInterface), if inserting into the container/parent with already initialized OpenGL context. If inserting into the container/parent without OpenGL context initialized, it will be called later, when OpenGL context will get initialized, right after GLContextOpen.

In other words, this is always called to let the control know the size of the container, if and only if the OpenGL context is initialized.

Source: ui/castleuicontrols_userinterface.inc (line 556).

Public function ControlsCount: Integer;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 587).

Public procedure InsertFront(const NewItem: TCastleUserInterface); overload;

Add child control, at the front of other children.

Source: ui/castleuicontrols_userinterface.inc (line 590).

Public procedure InsertFrontIfNotExists(const NewItem: TCastleUserInterface);

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 591).

Public procedure InsertFront(const NewItems: TCastleUserInterfaceList); overload;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 592).

Public procedure InsertBack(const NewItem: TCastleUserInterface); overload;

Add child control, at the back of other children.

Source: ui/castleuicontrols_userinterface.inc (line 595).

Public procedure InsertBackIfNotExists(const NewItem: TCastleUserInterface);

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 596).

Public procedure InsertBack(const NewItems: TCastleUserInterfaceList); overload;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 597).

Public procedure InsertControl(const Index: Integer; const NewItem: TCastleUserInterface);

Add child control at specified position. It is usually easier to use InsertFront or InsertBack, if possible.

Source: ui/castleuicontrols_userinterface.inc (line 602).

Public procedure RemoveControl(const Item: TCastleUserInterface);

Remove control added by InsertFront or InsertBack.

Note that this method does not free the Item instance. This method merely removes Item from our controls, so that Item is no longer rendered as part of this parent. It is still the caller's responsibility to make sure the Item is freed at some point.

See https://castle-engine.io/modern_pascal#_freeing_classes for description how to free instances in Pascal. As TCastleUserInterface descends from TComponent, a simple and proper solution is often just to create it with some "owner" (like TCastleView.FreeAtStop or Application) that will take care of freeing it.

Source: ui/castleuicontrols_userinterface.inc (line 617).

Public function IndexOfControl(const Item: TCastleUserInterface): Integer;

Index of child control, or -1 if not present.

Source: ui/castleuicontrols_userinterface.inc (line 620).

Public procedure ClearControls;

Remove all child controls added by InsertFront or InsertBack.

Note that, just like RemoveControl, this method does not free the children controls. This method merely removes children controls, so they are no longer rendered as part of the parent. It is still the caller's responsibility to make sure the children controls are freed at some point.

See https://castle-engine.io/modern_pascal#_freeing_classes for description how to free instances in Pascal. As TCastleUserInterface descends from TComponent, a simple and proper solution is often just to create it with some "owner" (like TCastleView.FreeAtStop or Application) that will take care of freeing it.

Source: ui/castleuicontrols_userinterface.inc (line 635).

Public procedure MoveToFront;

Move to become the front-most control within the parent.

This works when this control is a child of another control (has Parent assigned) or when it's a direct child of the container (in which case Parent is not assigned by Container is, which means the control is directly on TCastleContainer.Controls list).

This is ignored if this control is not within any container (so, also not within any parent).

Source: ui/castleuicontrols_userinterface.inc (line 646).

Public function CapturesEventsAtPosition(const Position: TVector2): boolean; virtual;

Does this control capture events under this container position. The default implementation simply checks whether Position is inside RenderRect. It also checks whether CapturesEvents is True.

Always treated like False when Exists returns False, so the implementation of this method only needs to make checks assuming that Exists = True.

Source: ui/castleuicontrols_userinterface.inc (line 660).

Public procedure BeforeRender; virtual;

Prepare your resources, right before drawing. Called only when Exists and GLInitialized.

Do not explicitly call this method. Instead, render controls by adding them to the TCastleContainer.Controls list, or render them explicitly (for off-screen rendering) by TCastleContainer.RenderControl.

Source: ui/castleuicontrols_userinterface.inc (line 670).

Public procedure Render; virtual;

Render a control. Called only when Exists and render context is initialized.

Do not call this method. It will be automatically called by the engine when needed. It will be called when UI is part of TCastleContainer.Controls list or rendered (e.g. for off-screen rendering) by TCastleContainer.RenderControl.

You should only override this method.

See https://castle-engine.io/manual_2d_ui_custom_drawn.php for examples what you can put here.

You can depend on some OpenGL state being set before calling this method. You can depend on it being set, and you can carelessly change it. This state we set:

  • Viewport is set to include whole container.

  • Depth test is off.

  • For ancient fixed-function pipeline (see TGLFeatures.RequestCapabilities):

    • The 2D orthographic projection is always set at the beginning. Useful for 2D controls.

    • The modelview matrix is set to identity. The matrix mode is always modelview.

    • The raster position is set to (0,0). The (deprecated) WindowPos is also set to (0,0).

    • Texturing, lighting, fog is off.

Beware that GLSL RenderContext.CurrentProgram has undefined value when this is called. You should always set it, before making direct OpenGL drawing calls (all the engine drawing routines do it already, this is only a concern if you make direct OpenGL / OpenGLES calls).

Source: ui/castleuicontrols_userinterface.inc (line 714).

Public procedure RenderOverChildren; virtual;

Render a control contents over the children controls. This is analogous to Render, but it executes after children are drawn. You should usually prefer to override Render instead of this method, as the convention is that the parent is underneath children.

You should only override this method (do not call it, it will be called by the engine).

See https://castle-engine.io/manual_2d_ui_custom_drawn.php for examples what you can put here.

Source: ui/castleuicontrols_userinterface.inc (line 725).

Public function TooltipExists: Boolean; virtual; deprecated 'use TooltipControl to customize tooltip look';

Warning: this symbol is deprecated: use TooltipControl to customize tooltip look

Render a tooltip of this control. If you want to have tooltip for this control detected, you have to override TooltipExists. Then the TooltipRender will be called.

TooltipRender is called in the same way as Render. TooltipRender is always called as a last (front-most) control. Argument TooltipPosition is the left-bottom (in screen space, regardless of UIScaling) suggested position of the tooltip.

It is simplest to descend from TCastleUserInterfaceFont, that implements simple TCastleUserInterfaceFont.Tooltip property and overrides these two methods as necessary.

Source: ui/castleuicontrols_userinterface.inc (line 741).

Public procedure TooltipRender(const TooltipPosition: TVector2); virtual; deprecated 'use TooltipControl to customize tooltip look';

Warning: this symbol is deprecated: use TooltipControl to customize tooltip look

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 742).

Public procedure GLContextOpen; virtual;

Initialize your OpenGL resources.

This is called when OpenGL context of the container is created, or when the control is added to the already existing context. In other words, this is the moment when you can initialize OpenGL resources, like display lists, VBOs, OpenGL texture names, etc.

As an exception, this is called regardless of the Exists value. This way a control can prepare it's resources, regardless if it exists now.

Source: ui/castleuicontrols_userinterface.inc (line 754).

Public procedure GLContextClose; virtual;

Destroy your OpenGL resources.

Called when OpenGL context of the container is destroyed. Also called when controls is removed from the container Controls list. Also called from the destructor.

You should release here any resources that are tied to the OpenGL context. In particular, the ones created in GLContextOpen.

As an exception, this is called regardless of the Exists value. This way a control can release it's resources, regardless if it exists now.

Source: ui/castleuicontrols_userinterface.inc (line 767).

Public procedure SetFocused(const Value: boolean); virtual;

Called when this control becomes or stops being focused, that is: under the mouse cursor and will receive events.

This updates Focused property. This also calls OnInternalMouseEnter / OnInternalMouseLeave.

Source: ui/castleuicontrols_userinterface.inc (line 813).

Public function EffectiveRect: TFloatRectangle;

Control position and size. Use this to base other controls size/position on this control's calculated size/position.

The algorithm that determines control position and size is like this:

The above describes the size of the content and border, summed. The content itself may be a little smaller, when the Border is used. The size of the "content itself" is returned only by RenderRect (in already-scaled coordinates, i.e. using final device pixels).

The anchors (see Anchor) also affect the final position of the control.

Note that some descendants do auto-sizing by default. This means that some of these properties may be ignored, and instead the calculated size (EffectiveWidth, EffectiveHeight) depends on some core values of the control.

For example:

Consult the documentation of each descendant for the exact specification of the size behavior.

This method returns the rectangle in local coordinates (relative to the parent 2D control). The returned rectangle size includes the border size. The returned rectangle size uses "unscaled" coordinates, which means that they correspond to the sizes you set e.g. in TCastleUserInterface.Width, TCastleUserInterface.Height, and translation units you use with e.g. TCastleUserInterface.Anchor.

If you're looking for a way to query the size of the control in final scaled coordinates (in real device pixels), and not relative to the parent position, use RenderRect or RenderRectWithBorder instead.

This method ignores the current value of the Exists method and Exists property, that is: the result of this function assumes that control does exist.

See also
TCastleUserInterface.EffectiveWidth
Calculated width of the control, without UI scaling.
TCastleUserInterface.EffectiveHeight
Calculated height of the control, without UI scaling.

Source: ui/castleuicontrols_userinterface.inc (line 927).

Public function EffectiveWidth: Single;

Calculated width of the control, without UI scaling. Useful if you want to base other controls size/position on this control calculated size.

Unlike the Width property, this is the effective size, not the desired size. So this is already processed by any auto-sizing mechanism (e.g. TCastleImageControl may adjust it's own size to the underlying image, depending on settings), it is changed by FullSize and so on.

It is always equal to just EffectiveRect.Width. It is 0 when EffectiveRect is empty.

See also
EffectiveRect
Control position and size.

Source: ui/castleuicontrols_userinterface.inc (line 943).

Public function EffectiveHeight: Single;

Calculated height of the control, without UI scaling. Useful if you want to base other controls size/position on this control calculated size.

Unlike the Height property, this is the effective size, not the desired size. So this is already processed by any auto-sizing mechanism (e.g. TCastleImageControl may adjust it's own size to the underlying image, depending on settings), it is changed by FullSize and so on.

It is always equal to just EffectiveRect.Height. It is 0 when EffectiveRect is empty.

See also
EffectiveRect
Control position and size.

Source: ui/castleuicontrols_userinterface.inc (line 959).

Public function EffectiveWidthForChildren: Single;

EffectiveWidth without Border size.

Source: ui/castleuicontrols_userinterface.inc (line 962).

Public function EffectiveHeightForChildren: Single;

EffectiveHeight without Border size.

Source: ui/castleuicontrols_userinterface.inc (line 964).

Public function CalculatedWidth: Cardinal; deprecated 'use EffectiveWidth';

Warning: this symbol is deprecated: use EffectiveWidth

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 966).

Public function CalculatedHeight: Cardinal; deprecated 'use EffectiveHeight';

Warning: this symbol is deprecated: use EffectiveHeight

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 967).

Public function CalculatedRect: TRectangle; deprecated 'use EffectiveRect';

Warning: this symbol is deprecated: use EffectiveRect

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 968).

Public function RenderRect: TFloatRectangle;

Position and size of this control, assuming it exists, in container coordinates (in final device pixels). The primary use of this is inside Render. A proper UI control should adjust to draw precisely in this rectangle.

Source: ui/castleuicontrols_userinterface.inc (line 974).

Public function RenderRectWithBorder: TFloatRectangle;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 975).

Public function ScreenRect: TRectangle; deprecated 'use RenderRect';

Warning: this symbol is deprecated: use RenderRect

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 977).

Public function ContainerToLocalPosition(ContainerPosition: TVector2; const ContainerPositionScaled: Boolean = true): TVector2;

Convert position relative to container (in final device coordinates, without UI scaling, by default) into position relative to this UI control (in coordinates with UI scaling). Useful e.g. to convert mouse/touch position from TInputPressRelease.Position into position useful for children of this UI control.

The exact definition is that using the result of this to set our child Translation, assuming the child is anchored to the left-bottom (the default state) and child has Left = Bottom = 0, sets child position exactly to the indicated point on the container.

Parameters
ContainerPositionScaled
If True (default) then the container position (the ContainerPosition parameter) is assumed to be in final device pixels, i.e. the window area in X is from 0 to TCastleContainer.Width, in Y from 0 and TCastleContainer.Height. This is useful when the parameter comes e.g. from TInputPressRelease.Position.

If False then the container position (the ContainerPosition parameter) is assumed to be in unscaled device pixels, i.e. the window area in X is from 0 to TCastleContainer.UnscaledWidth, in Y from 0 and TCastleContainer.UnscaledHeight.

Source: ui/castleuicontrols_userinterface.inc (line 1003).

Public function LocalToContainerPosition(const LocalPosition: TVector2; const ContainerPositionScaled: Boolean = true): TVector2;

Convert position relative to this UI control (in coordinates with UI scaling) into relative to container (in final device coordinates, without UI scaling, by default). Reverses ContainerToLocalPosition.

Parameters
ContainerPositionScaled
If True (default) then the container position (the result of this method) is assumed to be in final device pixels, i.e. the window area in X is from 0 to TCastleContainer.Width, in Y from 0 and TCastleContainer.Height.

If False then the container position (the result of this method) is assumed to be in unscaled device pixels, i.e. the window area in X is from 0 to TCastleContainer.UnscaledWidth, in Y from 0 and TCastleContainer.UnscaledHeight.

Source: ui/castleuicontrols_userinterface.inc (line 1022).

Public function ParentRect: TFloatRectangle;

Rectangle filling the parent control (or container), in local coordinates. Since this is in local coordinates, the returned rectangle Left and Bottom are always zero, unless parent has Border (the returned rectangle is shrunk by Parent.Border). This is already scaled by UI scaling.

Source: ui/castleuicontrols_userinterface.inc (line 1030).

Public procedure Anchor(const AHorizontalAnchor: THorizontalPosition; const TranslationX: Single = 0); overload;

Adjust position to align us with the parent horizontally. The resulting EffectiveRect and RenderRect and RenderRectWithBorder will immediately reflect the new position.

Note that position set here (anchors, Translation) are ignored when FullSize is set to true. In case of FullSize, the control fills the parent perfectly.

This utility method sets HorizontalAnchorSelf, HorizontalAnchorParent, Translation.X.

Source: ui/castleuicontrols_userinterface.inc (line 1042).

Public procedure Anchor( const AHorizontalAnchorSelf, AHorizontalAnchorParent: THorizontalPosition; const TranslationX: Single = 0); overload;

Adjust position to align us with the parent horizontally. The resulting EffectiveRect and RenderRect and RenderRectWithBorder will immediately reflect the new position.

Note that position set here (anchors, Translation) are ignored when FullSize is set to true. In case of FullSize, the control fills the parent perfectly.

This utility method sets HorizontalAnchorSelf, HorizontalAnchorParent, Translation.X.

Source: ui/castleuicontrols_userinterface.inc (line 1055).

Public procedure Anchor(const AVerticalAnchor: TVerticalPosition; const TranslationY: Single = 0); overload;

Adjust position to align us to the parent vertically. The resulting EffectiveRect and RenderRect and RenderRectWithBorder will immediately reflect the new position.

Note that position set here (anchors, Translation) are ignored when FullSize is set to true. In case of FullSize, the control fills the parent perfectly.

This utility method sets VerticalAnchorSelf, VerticalAnchorParent, Translation.Y.

Source: ui/castleuicontrols_userinterface.inc (line 1069).

Public procedure Anchor( const AVerticalAnchorSelf, AVerticalAnchorParent: TVerticalPosition; const TranslationY: Single = 0); overload;

Adjust position to align us to the parent vertically. The resulting EffectiveRect and RenderRect and RenderRectWithBorder will immediately reflect the new position.

Note that position set here (anchors, Translation) are ignored when FullSize is set to true. In case of FullSize, the control fills the parent perfectly.

This utility method sets VerticalAnchorSelf, VerticalAnchorParent, Translation.Y.

Source: ui/castleuicontrols_userinterface.inc (line 1082).

Public procedure AlignHorizontal( const ControlPosition: TPositionRelative = prMiddle; const ContainerPosition: TPositionRelative = prMiddle; const X: Single = 0); deprecated 'use Anchor';

Warning: this symbol is deprecated: use Anchor

Immediately position the control with respect to the parent by adjusting Left. Deprecated, use Align with THorizontalPosition.

Source: ui/castleuicontrols_userinterface.inc (line 1091).

Public procedure Align( const ControlPosition: THorizontalPosition; const ContainerPosition: THorizontalPosition; const X: Single = 0); overload; deprecated 'use Anchor';

Warning: this symbol is deprecated: use Anchor

Immediately position the control with respect to the parent by adjusting Left.

Note that using Anchor is often more comfortable than this method, since you only need to set anchor once (for example, right after creating the control). In contrast, adjusting position using this method will typically need to be repeated at each window on resize, like in TCastleUserInterface.Resize.

Source: ui/castleuicontrols_userinterface.inc (line 1104).

Public procedure AlignVertical( const ControlPosition: TPositionRelative = prMiddle; const ContainerPosition: TPositionRelative = prMiddle; const Y: Single = 0); deprecated 'use Anchor';

Warning: this symbol is deprecated: use Anchor

Immediately position the control with respect to the parent by adjusting Bottom. Deprecated, use Align with TVerticalPosition.

Source: ui/castleuicontrols_userinterface.inc (line 1112).

Public procedure Align( const ControlPosition: TVerticalPosition; const ContainerPosition: TVerticalPosition; const Y: Single = 0); overload; deprecated 'use Anchor';

Warning: this symbol is deprecated: use Anchor

Immediately position the control with respect to the parent by adjusting Bottom.

Note that using Anchor is often more comfortable than this method, since you only need to set anchor once (for example, right after creating the control). In contrast, adjusting position using this method will typically need to be repeated at each window on resize, like in TCastleUserInterface.Resize.

Source: ui/castleuicontrols_userinterface.inc (line 1125).

Public procedure Center; deprecated 'use Anchor(hpMiddle); Anchor(vpMiddle); to reliably center the control';

Warning: this symbol is deprecated: use Anchor(hpMiddle); Anchor(vpMiddle); to reliably center the control

Immediately center the control within the parent, both horizontally and vertically.

Note that using Anchor is often more comfortable than this method, since you only need to set anchor once. For example, right after creating the control call Anchor(hpMiddle); Anchor(vpMiddle);. In contrast, adjusting position using this method will typically need to be repeated at each window on resize, like in TCastleUserInterface.Resize.

Source: ui/castleuicontrols_userinterface.inc (line 1141).

Public function UIScale: Single; virtual;

UI scale of this control, derived from container (see TCastleContainer.UIScaling and EnableUIScaling).

Source: ui/castleuicontrols_userinterface.inc (line 1145).

Public procedure EditorAllowResize(out ResizeWidth, ResizeHeight: Boolean; out Reason: String); virtual;

Override this to prevent resizing some dimension in CGE editor.

Source: ui/castleuicontrols_userinterface.inc (line 1148).

Public function EffectiveFullSize: Boolean;

Is the FullSize actually active. Checks FullSize and not AutoSizeToChildren, i.e. it accounts that AutoSizeToChildren overrides FullSize (since they cannot both work at the same time).

Source: ui/castleuicontrols_userinterface.inc (line 1254).

Protected procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override;

This item has no description. Showing description inherited from TCastleUserInterface.PreferredSize.

Controls that have a preferred size should override this. By default this contains values derived from Width, WidthFraction, Height, HeightFraction, with Border subtracted.

Note that the arguments should be already scaled, i.e. multiplied by UIScale, i.e. expressed in final device pixels.

Note that the returned PreferredWidth and PreferredHeight must not include the space for Border. Border size will be added later.

Source: ui/castlecontrols_imagecontrol.inc (line 102).

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Source: ui/castlecontrols_imagecontrol.inc (line 104).

Public destructor Destroy; override;

This item has no description.

Source: ui/castlecontrols_imagecontrol.inc (line 105).

Public procedure Render; override;

This item has no description. Showing description inherited from TCastleUserInterface.Render.

Render a control. Called only when Exists and render context is initialized.

Do not call this method. It will be automatically called by the engine when needed. It will be called when UI is part of TCastleContainer.Controls list or rendered (e.g. for off-screen rendering) by TCastleContainer.RenderControl.

You should only override this method.

See https://castle-engine.io/manual_2d_ui_custom_drawn.php for examples what you can put here.

You can depend on some OpenGL state being set before calling this method. You can depend on it being set, and you can carelessly change it. This state we set:

  • Viewport is set to include whole container.

  • Depth test is off.

  • For ancient fixed-function pipeline (see TGLFeatures.RequestCapabilities):

    • The 2D orthographic projection is always set at the beginning. Useful for 2D controls.

    • The modelview matrix is set to identity. The matrix mode is always modelview.

    • The raster position is set to (0,0). The (deprecated) WindowPos is also set to (0,0).

    • Texturing, lighting, fog is off.

Beware that GLSL RenderContext.CurrentProgram has undefined value when this is called. You should always set it, before making direct OpenGL drawing calls (all the engine drawing routines do it already, this is only a concern if you make direct OpenGL / OpenGLES calls).

Source: ui/castlecontrols_imagecontrol.inc (line 106).

Public procedure GLContextOpen; override;

This item has no description. Showing description inherited from TCastleUserInterface.GLContextOpen.

Initialize your OpenGL resources.

This is called when OpenGL context of the container is created, or when the control is added to the already existing context. In other words, this is the moment when you can initialize OpenGL resources, like display lists, VBOs, OpenGL texture names, etc.

As an exception, this is called regardless of the Exists value. This way a control can prepare it's resources, regardless if it exists now.

Source: ui/castlecontrols_imagecontrol.inc (line 107).

Public procedure EditorAllowResize( out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override;

This item has no description. Showing description inherited from TCastleUserInterface.EditorAllowResize.

Override this to prevent resizing some dimension in CGE editor.

Source: ui/castlecontrols_imagecontrol.inc (line 108).

Public function PropertySections(const PropertyName: String): TPropertySections; override;

This item has no description. Showing description inherited from TCastleComponent.PropertySections.

Section where to show property in the editor.

Source: ui/castlecontrols_imagecontrol.inc (line 110).

Public procedure ImageChanged;

If you modified the Image contents (colors, or maybe even image size) you need to call this.

See also
TCastleImagePersistent.ImageChanged
If you modified the Image contents (colors, or maybe even image size) you need to call this.

Source: ui/castlecontrols_imagecontrol.inc (line 176).

Properties

Public property NonVisualComponents [const Index: Integer]: TComponent read GetNonVisualComponents;

Components added by AddNonVisualComponent.

Source: base/castleclassutils.pas (line 698).

Public property IsLoading: Boolean read FIsLoading;

Is the component during deserialization now.

Note: We can't use csLoading in ComponentState because in Delphi it is not possible to control it from CastleComponentSerialize.

Source: base/castleclassutils.pas (line 711).

Public property OnVisibleChange: TCastleUserInterfaceChangeEvent read FOnVisibleChange write FOnVisibleChange;

Called always when something important inside this control (or it's children) changed. See VisibleChange for details about when and how this is called.

Be careful when handling this event. Various changes may cause this, so be prepared to handle it at any moment, even in the middle when UI control is changing. It may also occur very often. It's usually safest to only set a boolean flag like "something should be recalculated" when this event happens, and do the actual recalculation later.

Source: ui/castleuicontrols_userinterface.inc (line 524).

Public property Container: TCastleContainer read FContainer;

Container of this control. When adding control to container's Controls list (like TCastleWindow.Controls) container will automatically set itself here, and when removing from container this will be changed back to Nil.

May be Nil if this control is not yet inserted into any container.

Source: ui/castleuicontrols_userinterface.inc (line 564).

Public property OnCursorChange: TNotifyEvent read FOnCursorChange write FOnCursorChange; deprecated 'use OnVisibleChange (or override VisibleChange) and watch for Changes that include chCursor';

Warning: this symbol is deprecated: use OnVisibleChange (or override VisibleChange) and watch for Changes that include chCursor

Event called when the Cursor property changes. This event is, in normal circumstances, used by the Container, so you should not use it in your own programs.

Source: ui/castleuicontrols_userinterface.inc (line 570).

Public property ExclusiveEvents: boolean read FExclusiveEvents write FExclusiveEvents default true; deprecated 'do not use this; supporting this property was complicated and had no real benefit; everything now works as if ExclusiveEvents=true, always';

Warning: this symbol is deprecated: do not use this; supporting this property was complicated and had no real benefit; everything now works as if ExclusiveEvents=true, always

Should we disable further mouse / keys handling for events that we already handled in this control. If True, then our events will return True for mouse and key events handled.

This means that events will not be simultaneously handled by both this control and some other (or camera or normal window callbacks), which is usually more sensible, but sometimes somewhat limiting.

Source: ui/castleuicontrols_userinterface.inc (line 582).

Public property Controls [const Index: Integer]: TCastleUserInterface read GetControls write SetControls;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 586).

Public property GetExists: Boolean read FExists; deprecated 'use Exists';

Warning: this symbol is deprecated: use Exists

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 649).

Public property GLInitialized: boolean read FGLInitialized default false;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 769).

Public property Focused: boolean read FFocused write SetFocused;

See SetFocused.

Source: ui/castleuicontrols_userinterface.inc (line 816).

Public property Parent: TCastleUserInterface read FParent ;

Visual parent control. This control is rendered within the parent, and it's anchors and coordinates are relative to the parent. Parent may be Nil, which means that the Container (if set) is our direct parent.

Note that this property doesn't have a setter, as it could be confusing: the order in which children are inserted into parent sometimes matters, for back-and-front order. If you want to change the parent, you can use code like this:

if Control.Parent <> nil then
  Control.Parent.RemoveControl(Control);
if NewParent <> nil then
  NewParent.InsertFront(Control); // or InsertBack, as InsertControl...

Source: ui/castleuicontrols_userinterface.inc (line 834).

Public property FloatWidth: Single read FWidth write SetWidth stored false; deprecated 'use Width';

Warning: this symbol is deprecated: use Width

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 1152).

Public property FloatHeight: Single read FHeight write SetHeight stored false; deprecated 'use Height';

Warning: this symbol is deprecated: use Height

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 1154).

Public property AnchorDelta: TVector2 read FTranslation write SetTranslation; deprecated 'use Translation';

Warning: this symbol is deprecated: use Translation

Position of the control, relative to the anchor at parent (by default, relative to left-bottom corner of the parent).

Source: ui/castleuicontrols_userinterface.inc (line 1160).

Public property Translation: TVector2 read FTranslation write SetTranslation;

Position of the control, relative to the anchor at parent (by default, relative to left-bottom corner of the parent).

Source: ui/castleuicontrols_userinterface.inc (line 1165).

Public property KeepInFront: boolean read FKeepInFront write FKeepInFront default false;

Keep the control in front of other controls (with KeepInFront=False) when inserting.

TODO: Do not change this property while the control is already a child of something.

Source: ui/castleuicontrols_userinterface.inc (line 1172).

Public property BorderColor: TCastleColor read FBorderColor write SetBorderColor;

Color of the Border, by default completely transparent black.

Source: ui/castleuicontrols_userinterface.inc (line 1176).

Public property HasHorizontalAnchor: boolean read FHasHorizontalAnchor write FHasHorizontalAnchor stored false; deprecated 'this property does not do anything anymore, anchors are always active';

Warning: this symbol is deprecated: this property does not do anything anymore, anchors are always active

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 1179).

Public property HasVerticalAnchor: boolean read FHasVerticalAnchor write FHasVerticalAnchor stored false; deprecated 'this property does not do anything anymore, anchors are always active';

Warning: this symbol is deprecated: this property does not do anything anymore, anchors are always active

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 1182).

Public property HorizontalAnchorDelta: Single read GetHorizontalAnchorDelta write SetHorizontalAnchorDelta default 0; deprecated 'use Translation.X';

Warning: this symbol is deprecated: use Translation.X

Delta between our border and parent.

See also
Anchor
Adjust position to align us to the parent vertically.

Source: ui/castleuicontrols_userinterface.inc (line 1189).

Public property VerticalAnchorDelta: Single read GetVerticalAnchorDelta write SetVerticalAnchorDelta default 0; deprecated 'use Translation.Y';

Warning: this symbol is deprecated: use Translation.Y

Delta between our border and parent.

See also
Anchor
Adjust position to align us to the parent vertically.

Source: ui/castleuicontrols_userinterface.inc (line 1194).

Public property Visible: Boolean read FVisible;

Is the control possibly visible. This is always True when Culling is False (the default).

Source: ui/castleuicontrols_userinterface.inc (line 1200).

Public property EnableUIScaling: boolean read FEnableUIScaling write SetEnableUIScaling default true;

Enable or disable UI scaling for this particular control. See more about UI scaling on TCastleContainer.UIScaling and TCastleUserInterface.UIScale. Setting this to False forces TCastleUserInterface.UIScale to always return 1.0.

Note that this does not work recursively, i.e. it does not affect the children of this control. Setting this to False does not prevent UI scaling on children (you have to turn it off explicitly for children too, if you need to disable UI scaling recursively).

The use-cases for changing this property to "false" are very rare. Usually you should use UI scaling for 100% of your UI.

Source: ui/castleuicontrols_userinterface.inc (line 1214).

Public property CapturesEvents: boolean read FCapturesEvents write FCapturesEvents default true;

Capture input events (keyboard, mouse, joystick). If False, then the methods like Press and Release will never be called, and Update will always be called with HandleInput = False. The control will never behave like focused.

The only exception is when this control is set as TCastleContainer.ForceCaptureInput. In this case, the control will receive inputs. In other words, TCastleContainer.ForceCaptureInput overrides the intent of this property.

This property may be replaced by something like "CaptureInput" or just universal "Enabled" in the future.

Source: ui/castleuicontrols_userinterface.inc (line 1229).

Public property OnInternalMouseEnter: TUiNotifyEvent read FOnInternalMouseEnter write FOnInternalMouseEnter;

Called when control starts being under the mouse cursor and will receive events. See SetFocused, this is called when Focused changes from False to True.

This is called "Internal" now, because we do not guarantee it's 100% always paired with OnInternalMouseLeave. A different approach to this may be done in the future releases.

Source: ui/castleuicontrols_userinterface.inc (line 1238).

Public property OnInternalMouseLeave: TUiNotifyEvent read FOnInternalMouseLeave write FOnInternalMouseLeave;

Called when control stops being under the mouse cursor and will receive events. See SetFocused, this is called when Focused changes from True to False.

This is called "Internal" now, because we do not guarantee it's 100% always paired with OnInternalMouseEnter. A different approach to this may be done in the future releases.

Source: ui/castleuicontrols_userinterface.inc (line 1247).

Published property Cursor: TMouseCursor read FCursor write SetCursor default mcDefault;

Mouse cursor over this control. When user moves mouse over the Container, the currently focused (topmost under the cursor) control determines the mouse cursor look.

Source: ui/castleuicontrols_userinterface.inc (line 1263).

Published property OnUpdate: TUiUpdateEvent read FOnUpdate write FOnUpdate;

Event that occurs continuously on each control. See Update for details.

Source: ui/castleuicontrols_userinterface.inc (line 1267).

Published property OnPress: TUiPressReleaseEvent read FOnPress write FOnPress;

An input (key, mouse button, mouse wheel) was pressed. See Press for details.

Source: ui/castleuicontrols_userinterface.inc (line 1271).

Published property OnRelease: TUiPressReleaseEvent read FOnRelease write FOnRelease;

An input (key, mouse button, mouse wheel) was released. See Release for details.

Source: ui/castleuicontrols_userinterface.inc (line 1275).

Published property OnMotion: TUiMotionEvent read FOnMotion write FOnMotion;

Pointer (mouse or finger) moved. See Motion for details.

Source: ui/castleuicontrols_userinterface.inc (line 1279).

Published property OnRender: TUiNotifyEvent read FOnRender write FOnRender;

Control is being displayed. See Render for details. This event it called after the Render method of this control finished but before we started rendering children.

Source: ui/castleuicontrols_userinterface.inc (line 1285).

Published property Exists: boolean read FExists write SetExists default true;

Not existing control is not visible, it doesn't receive input and generally doesn't exist from the point of view of user. This is mostly equivalent to just removing this control from parent list.

Non-existing controls still receive GLContextOpen, GLContextClose, Resize events.

Source: ui/castleuicontrols_userinterface.inc (line 1293).

Published property Left: Single read FLeft write SetLeft stored false default 0; deprecated 'use Translation.X';

Warning: this symbol is deprecated: use Translation.X

Position from the left side of the parent control.

It's usually better to use anchors instead of this property. For example, instead of setting Control.Left := 10, you can call Control.Anchor(hpLeft, 10), or just change Translation.X.

Note that the effects of this property and Translation.X are summed, if you set both. We advise to leave Left as zero and just use anchors in new code.

Source: ui/castleuicontrols_userinterface.inc (line 1305).

Published property Bottom: Single read FBottom write SetBottom default 0; deprecated 'use Translation.Y';

Warning: this symbol is deprecated: use Translation.Y

Position from the bottom side of the parent control.

It's usually better to use anchors instead of this property. For example, instead of setting Control.Bottom := 10, you can call Control.Anchor(vpBottom, 10), or just change Translation.Y.

Note that the effects of this property and Translation.Y are summed, if you set both. We advise to leave Bottom as zero and just use anchors in new code.

Source: ui/castleuicontrols_userinterface.inc (line 1318).

Published property FullSize: boolean read FFullSize write SetFullSize default false;

When FullSize, the control will always fill the whole parent area.

See also
TCastleUserInterface.EffectiveRect
Control position and size.
TCastleUserInterface.EffectiveWidth
Calculated width of the control, without UI scaling.
TCastleUserInterface.EffectiveHeight
Calculated height of the control, without UI scaling.

Source: ui/castleuicontrols_userinterface.inc (line 1325).

Published property Width: Single read FWidth write SetWidth default DefaultWidth;

These properties determine the control size. See the EffectiveRect documentation for details how the size is calculated.

See also
TCastleUserInterface.EffectiveRect
Control position and size.
TCastleUserInterface.EffectiveWidth
Calculated width of the control, without UI scaling.
TCastleUserInterface.EffectiveHeight
Calculated height of the control, without UI scaling.

Source: ui/castleuicontrols_userinterface.inc (line 1335).

Published property Height: Single read FHeight write SetHeight default DefaultHeight;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 1336).

Published property WidthFraction: Single read FWidthFraction write SetWidthFraction default 0.0;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 1337).

Published property HeightFraction: Single read FHeightFraction write SetHeightFraction default 0.0;

This item has no description.

Source: ui/castleuicontrols_userinterface.inc (line 1338).

Published property AutoSizeToChildren: Boolean read FAutoSizeToChildren write SetAutoSizeToChildren default false;

Adjust size to encompass all the children. The properties FullSize, Width, Height are ignored in this case. Our Left and Bottom still matter.

Our size is adjusted to all existing children sizes and positions.

We add AutoSizeToChildrenPaddingTop to the resulting height, and AutoSizeToChildrenPaddingRight to the resulting width.

Source: ui/castleuicontrols_userinterface.inc (line 1351).

Published property AutoSizeToChildrenPaddingRight: Single read FAutoSizeToChildrenPaddingRight write SetAutoSizeToChildrenPaddingRight default 0;

Padding added when AutoSizeToChildren is used. TODO: Should be AutoSizeToChildrenPaddingHorizontal, there's nothing that makes it specific to "right" or "left" side now.

Source: ui/castleuicontrols_userinterface.inc (line 1357).

Published property AutoSizeToChildrenPaddingTop: Single read FAutoSizeToChildrenPaddingTop write SetAutoSizeToChildrenPaddingTop default 0;

Padding added when AutoSizeToChildren is used. TODO: Should be AutoSizeToChildrenPaddingVertical, there's nothing that makes it specific to "top" or "bottom" side now.

Source: ui/castleuicontrols_userinterface.inc (line 1363).

Published property HorizontalAnchorSelf: THorizontalPosition read FHorizontalAnchorSelf write SetHorizontalAnchorSelf default hpLeft;

Which our border to align with parent.

See also
Anchor
Adjust position to align us to the parent vertically.

Source: ui/castleuicontrols_userinterface.inc (line 1369).

Published property HorizontalAnchorParent: THorizontalPosition read FHorizontalAnchorParent write SetHorizontalAnchorParent default hpLeft;

Which parent border is aligned to our HorizontalAnchorSelf border.

See also
Anchor
Adjust position to align us to the parent vertically.

Source: ui/castleuicontrols_userinterface.inc (line 1373).

Published property VerticalAnchorSelf: TVerticalPosition read FVerticalAnchorSelf write SetVerticalAnchorSelf default vpBottom;

Which our border to align with parent.

See also
Anchor
Adjust position to align us to the parent vertically.

Source: ui/castleuicontrols_userinterface.inc (line 1378).

Published property VerticalAnchorParent: TVerticalPosition read FVerticalAnchorParent write SetVerticalAnchorParent default vpBottom;

Which parent border is aligned to our VerticalAnchorSelf border.

See also
Anchor
Adjust position to align us to the parent vertically.

Source: ui/castleuicontrols_userinterface.inc (line 1382).

Published property Culling: Boolean read FCulling write SetCulling default false;

Optimize rendering and event processing by checking whether the control can be visible. The visibility is checked by looking at container rectangle, and all possible clipping parents (set by TCastleScrollView, or any other control with ClipChildren).

This is useful for UI controls that have expensive rendering or other events (e.g. they do something non-trivial in Render or RenderOverChildren, or they include a lot of children controls). And they may be placed off-screen, or they may be outside of a parent with clipping, which is often the case when the parent is TCastleScrollView.

Source: ui/castleuicontrols_userinterface.inc (line 1398).

Published property ClipChildren: Boolean read FClipChildren write SetClipChildren default false;

Clip the rendering of children.

By default this is False and so the control can draw outside of it's designated rectangle (RenderRect). Although all the standard UI controls are carefully implemented such that their Render and RenderOverChildren draw only within their RenderRect. But it is easy to place children controls outside of this rectangle.

When this property is True, the rendering is clipped, so the "overflowing" parts are never visible. This affects both Render and RenderOverChildren of this control, as well as all children rendering.

Source: ui/castleuicontrols_userinterface.inc (line 1413).

Published property Border: TBorder read FBorder;

Border (by default transparent) of the control. Border adds a space from the control content (drawn within RenderRect) to the control rectangle (returned by RenderRectWithBorder) (scaled), or EffectiveRect (unscaled) and friends).

It is transparent by default, but you can change it by BorderColor.

Border works always, regardless of FullSize or AutoSizeToChildren.

One obvious use-case is to use this for visual space (empty space or a colorful frame, separating this control from the rest).

Another use-case is to reserve a predictable space for as additional (sibling) control within the same parent. E.g. you can set FullSize=true and Border.Top=100, and this way there is always a strip with Height=100 at the top of the parent, where you can insert another control (with Height=100, anchored to the top).

Source: ui/castleuicontrols_userinterface.inc (line 1434).

Published property CustomTheme: TCastleTheme read FCustomTheme write SetCustomTheme;

Use a custom instance of TCastleTheme to determine the look of this control.

Source: ui/castleuicontrols_userinterface.inc (line 1437).

Published property TooltipControl: TCastleUserInterface read FTooltipControl write SetTooltipControl;

If set, the indicated control will act as a tooltip: we will make it existing when we should show the tooltip for this control, we will make it no longer existing when the tooltip for this should be hidden. Initially the TooltipControl should usually have Exists=false, because you usually do not want to show it until we start showing it as a tooltip.

If TooltipControl is assigned then TCastleUserInterfaceFont no longer does tooltip rendering. The TCastleUserInterfaceFont.Tooltip text is ignored.

The visual parent of TooltipControl can be whatever is comfortable. That is, it is OK to make TooltipControl parent of this control, and it is OK not to: you can as well place TooltipControl as e.g. parent of container or design root.

Source: ui/castleuicontrols_userinterface.inc (line 1453).

Published property EditorSelectOnHover: Boolean read FEditorSelectOnHover write FEditorSelectOnHover default true;

Select the UI (hover, select on click) at design-time when the mouse is over rectangle of this UI. This affects operation in the editor, and when using the inspector (press F8 at run-time, when the application is build in debug mode).

It's by default True and it makes most sense to leave it True for the majority of components. However some components are not only invisible, but also "user doesn't expect to select them by hovering". E.g. TCastleNavigation, or DesignHud in examples/3d_games/explore_impressive_castle . It is more intuitive for user then that such component doesn't obscure things underneath.

Note that hovering over children of UI with EditorSelectOnHover will still select them. This is good e.g. for DesignHud in examples/3d_games/explore_impressive_castle.

Source: ui/castleuicontrols_userinterface.inc (line 1470).

Published property BorderColorPersistent: TCastleColorPersistent read FBorderColorPersistent ;

BorderColor that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write BorderColor directly.

See also
BorderColor
Color of the Border, by default completely transparent black.

Source: ui/auto_generated_persistent_vectors/tcastleuserinterface_persistent_vectors.inc (line 37).

Published property TranslationPersistent: TCastleVector2Persistent read FTranslationPersistent ;

Translation that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Translation directly.

See also
Translation
Position of the control, relative to the anchor at parent (by default, relative to left-bottom corner of the parent).

Source: ui/auto_generated_persistent_vectors/tcastleuserinterface_persistent_vectors.inc (line 105).

Public property Image: TEncodedImage read GetImage write SetImage;

Image contents, or Nil if none. You can set it by setting Url, or by setting this property directly, or by setting DrawableImage.

Note that by default the TEncodedImage instance assigned here is owned by this component (see OwnsImage). So if you set this property to your custom TEncodedImage instance you should leave memory management of this instance to this component. You can either create a copy by TEncodedImage.MakeCopy if you want to give here only a copy, or you can change OwnsImage to False.

It is allowed to modify the contents or even size of this image. Just make sure to call ImageChanged after the modifications are done to update the rendered image (and possibly the UI control size, e.g. in case TCastleImageControl uses this TCastleImagePersistent, and TCastleImageControl.Stretch=false).

See also
TCastleImagePersistent.Image
Image contents, or Nil if none.

Source: ui/castlecontrols_imagecontrol.inc (line 131).

Public property OwnsImage: boolean read GetOwnsImage write SetOwnsImage default true;

Whether the memory management of assigned Image is automatic. See Image documentation for details.

Note that setting Url changes Image, and changes OwnsImage unconditionally to True.

Note that setting DrawableImage changes Image too, and changes OwnsImage to the value present in TDrawableImage.OwnsImage.

See also
TCastleImagePersistent.OwnsImage
Whether the memory management of assigned Image is automatic.

Source: ui/castlecontrols_imagecontrol.inc (line 143).

Public property DrawableImage: TDrawableImage read GetDrawableImage write SetDrawableImage;

Image used for drawing. Never Nil. Always TDrawableImage.Image equals our Image.

Usually you do not want to change this property. You can change Url, or Image, and the drawable image will reflect this. But there are good use-cases to change the DrawableImage directly: e.g. you can use fast image-to-image drawing using TDrawableImage.DrawFrom. Or you can set a new instance of TDrawableImage here. Be sure to adjust OwnsDrawableImage as needed.

Note that when OpenGL(ES) context is lost and recreated (which can happen at any moment on mobile devices), the contents of this are reinitialized from Image.

See also
TCastleImagePersistent.DrawableImage
Image used for drawing.

Source: ui/castlecontrols_imagecontrol.inc (line 162).

Public property OwnsDrawableImage: boolean read GetOwnsDrawableImage write SetOwnsDrawableImage default true;

Whether we should automatically free the DrawableImage instance. Note that this is restored to True when we need to recreate the TDrawableImage internally, e.g. when Image instance changed (when even size changed, we have to recreate TDrawableImage).

See also
TCastleImagePersistent.OwnsDrawableImage
Whether we should automatically free the DrawableImage instance.

Source: ui/castlecontrols_imagecontrol.inc (line 170).

Public property Color: TCastleColor read GetColor write SetColor;

Color tint of the image. This simply multiplies the image RGBA components, just like TDrawableImage.Color. By default this is opaque white, which means that image colors are unchanged.

See also
TCastleImagePersistent.Color
Color tint of the image.

Source: ui/castlecontrols_imagecontrol.inc (line 183).

Public property Corners: TVector4Integer read GetCorners write SetCorners; deprecated 'use ProtectedSides';

Warning: this symbol is deprecated: use ProtectedSides

Corners and edges of the image that are not stretched even when Stretch is used. See TDrawableImage.Draw3x3 for the details how such drawing works.

Source: ui/castlecontrols_imagecontrol.inc (line 189).

Public property CenterX: Single read GetCenterX write SetCenterX default 0.5; deprecated 'use RotationCenter';

Warning: this symbol is deprecated: use RotationCenter

X coordinate of the center of rotation. Value from 0 to 1. Default value 0.5.

Source: ui/castlecontrols_imagecontrol.inc (line 193).

Public property CenterY: Single read GetCenterY write SetCenterY default 0.5; deprecated 'use RotationCenter';

Warning: this symbol is deprecated: use RotationCenter

Y coordinate of the center of rotation. Value from 0 to 1. Default value 0.5.

Source: ui/castlecontrols_imagecontrol.inc (line 197).

Public property RotationCenter: TVector2 read GetRotationCenter write SetRotationCenter;

Center of rotation. Expressed as a fraction within the drawn ScreenRectangle, (0,0) means bottom-left corner, (1,1) means top-right corner. Default (0.5,0.5).

See also
TCastleImagePersistent.RotationCenter
Center of rotation.

Source: ui/castlecontrols_imagecontrol.inc (line 207).

Public property ClipLine: TVector3 read GetClipLine write SetClipLine;

If Clip, this is the line equation used to determine whether we clip the given pixel. Given a line (A, B, C) and pixel (x, y), the pixel is clipped (rejected) if A * x + B * y + C < 0.

The equation is calculated in the coordinates in which image X, Y spans from (0, 0) (bottom-left) to (1, 1) (top-right). For example ClipLine = (1, 0, -0.5) means that we reject pixels where 1 * x + 0 * y - 0.5 < 0. In other words, we reject pixels where x < 0.5, so we reject the left half of the image.

See also
TCastleImagePersistent.ClipLine
If Clip, this is the line equation used to determine whether we clip the given pixel.

Source: ui/castlecontrols_imagecontrol.inc (line 220).

Public property Region: TFloatRectangle read GetRegion write SetRegion;

Image region to which we should limit the display. Empty (following TFloatRectangle.Empty) means using the whole image.

Source: ui/castlecontrols_imagecontrol.inc (line 224).

Public property CustomShader: TGLSLProgram read GetCustomShader write SetCustomShader;

Custom GLSL shading code. See TDrawableImage.CustomShader for explanation.

See also
TCastleImagePersistent.CustomShader
Custom GLSL shading code.

Source: ui/castlecontrols_imagecontrol.inc (line 230).

Public property Blending: boolean read GetBlending write SetBlending stored false; deprecated 'use AlphaChannel';

Warning: this symbol is deprecated: use AlphaChannel

This item has no description.

Source: ui/castlecontrols_imagecontrol.inc (line 233).

Public property Proportional: boolean read GetProportional write SetProportional stored false default false; deprecated 'use ProportionalScaling';

Warning: this symbol is deprecated: use ProportionalScaling

This item has no description.

Source: ui/castlecontrols_imagecontrol.inc (line 235).

Public property FileName: string read GetUrl write SetUrl stored false; deprecated 'use Url';

Warning: this symbol is deprecated: use Url

This item has no description.

Source: ui/castlecontrols_imagecontrol.inc (line 237).

Published property Content: TCastleImagePersistent read FContent;

Image contents to display.

Source: ui/castlecontrols_imagecontrol.inc (line 242).

Published property Url: String read GetUrl write SetUrl stored false;

URL of the image. Set this to load a new image, you can set to '' to clear the image.

See also
TCastleImagePersistent.Url
URL of the image.

Source: ui/castlecontrols_imagecontrol.inc (line 248).

Published property AlphaChannel: TAutoAlphaChannel read GetAlphaChannel write SetAlphaChannel stored false default acAuto;

How to treat alpha channel of the assigned image. By default, this is acAuto, which means that image contents together with current Color determine how the alpha of image is treated (opaque, alpha test, alpha blending). Set this to force specific treatment.

See also
TCastleImagePersistent.AlphaChannel
How to treat alpha channel of the assigned image.

Source: ui/castlecontrols_imagecontrol.inc (line 257).

Published property SmoothScaling: boolean read GetSmoothScaling write SetSmoothScaling stored false default true;

Is the image scaling mode smooth (bilinear filtering) or not (nearest-pixel filtering). See TDrawableImage.SmoothScaling.

See also
TCastleImagePersistent.SmoothScaling
Is the image scaling mode smooth (bilinear filtering) or not (nearest-pixel filtering).

Source: ui/castlecontrols_imagecontrol.inc (line 265).

Published property Stretch: boolean read FStretch write SetStretch default false;

How does the loaded image size affect the size of the image control.

  • When FullSize or AutoSizeToChildren is True, then the value of Stretch, and loaded image size, are ignored. When AutoSizeToChildren, the image is always stretched to surround the children. When FullSize, the image is always stretched to fill the parent.

    Otherwise:

  • If Stretch = False (default), then the displayed size corresponds to the underlying image size.

  • If Stretch = True, the image will be stretched to fill the requested area. The property ProportionalScaling determines how the image will be adjusted to fit the requested size (by Width, WidthFraction, Height, HeightFraction).

    psNone

    The image will be scaled to exactly fill the requested Width and Height (without paying attention to the aspect ratio of the image).

    This is the case when you fully force the displayed size and position, regardless of image size. Displayed image will always exactly fill the requested area.

    psFit

    The image will be proportionally scaled to fit within the requested Width and Height. If the aspect ratio of image will be different than aspect ratio of Width/Height, the scaled image will be centered inside the Width/Height.

    psEnclose

    The image will be proportionally scaled to enclode the requested Width and Height. If the aspect ratio of image will be different than aspect ratio of Width/Height, the scaled image will be larger then the requested area.

Source: ui/castlecontrols_imagecontrol.inc (line 319).

Published property ProportionalScaling: TProportionalScaling read FProportionalScaling write SetProportionalScaling default psNone;

This item has no description.

Source: ui/castlecontrols_imagecontrol.inc (line 320).

Published property Cache: boolean read GetCache write SetCache stored false default true;

If True, the image is loaded and freed using a cache. This can save memory and loading time a lot, if you reuse the same URL in many TCastleImageControl instances.

See also
TCastleImagePersistent.Cache
If True, the DrawableImage is loaded and freed using a cache.

Source: ui/castlecontrols_imagecontrol.inc (line 329).

Published property FlipHorizontal: Boolean read GetFlipHorizontal write SetFlipHorizontal stored false default false;

Display image horizontally flipped.

See also
TCastleImagePersistent.FlipHorizontal

Source: ui/castlecontrols_imagecontrol.inc (line 333).

Published property FlipVertical: Boolean read GetFlipVertical write SetFlipVertical stored false default false;

Display image vertically flipped.

See also
TCastleImagePersistent.FlipVertical

Source: ui/castlecontrols_imagecontrol.inc (line 338).

Published property ProtectedSides: TBorder read GetProtectedSides stored false;

Corners and edges of the image that are protected from scaling distortion when Stretch is used. We use the 9-slicing algorithm, described at TDrawableImage.Draw3x3 and https://en.wikipedia.org/wiki/9-slice_scaling to scale the image.

See also
TCastleImagePersistent.ProtectedSides
Corners and edges of the image that are protected from scaling distortion when TCastleImageControl.Stretch is used.

Source: ui/castlecontrols_imagecontrol.inc (line 348).

Published property DetectScaleFromUrl: Boolean read FDetectScaleFromUrl write SetDetectScaleFromUrl default false;

Set this to auto-detect that image is scaled compared to it's desired size. This detects URL endings like 'xxx@2x.png', and we will automatically adjust to it (the size determined by AutoSize will be actually 2x smaller than the PNG size). Preparing images at a 2x or 4x larger size than "desired" is a useful trick when using UI scaling, when you want the image to look good at various scales.

Source: ui/castlecontrols_imagecontrol.inc (line 356).

Published property Rotation: Single read GetRotation write SetRotation stored false default 0;

Rotation in radians. Default value 0.

See also
TCastleImagePersistent.Rotation
Rotation in radians.

Source: ui/castlecontrols_imagecontrol.inc (line 361).

Published property Clip: boolean read GetClip write SetClip stored false default false;

Clip the image by an arbitrary 2D line defined in ClipLine.

See also
TCastleImagePersistent.Clip
Clip the image by an arbitrary 2D line defined in ClipLine.

Source: ui/castlecontrols_imagecontrol.inc (line 365).

Published property ColorPersistent: TCastleColorPersistent read FColorPersistent stored false;

Color that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Color directly.

See also
Color
Color tint of the image.

Source: ui/auto_generated_persistent_vectors/tcastleimagecontrol_persistent_vectors.inc (line 37).

Published property ClipLinePersistent: TCastleVector3Persistent read FClipLinePersistent stored false;

ClipLine that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write ClipLine directly.

See also
ClipLine
If Clip, this is the line equation used to determine whether we clip the given pixel.

Source: ui/auto_generated_persistent_vectors/tcastleimagecontrol_persistent_vectors.inc (line 105).

Published property RotationCenterPersistent: TCastleVector2Persistent read FRotationCenterPersistent stored false;

RotationCenter that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write RotationCenter directly.

See also
RotationCenter
Center of rotation.

Source: ui/auto_generated_persistent_vectors/tcastleimagecontrol_persistent_vectors.inc (line 173).

Published property RegionPersistent: TFloatRectanglePersistent read FRegionPersistent stored false;

Region that can be visually edited in Castle Game Engine Editor, Lazarus and Delphi. Normal user code does not need to deal with this, instead read or write Region directly.

See also
Region
Image region to which we should limit the display.

Source: ui/auto_generated_persistent_vectors/tcastleimagecontrol_persistent_vectors.inc (line 241).


Generated by PasDoc 0.17.0.snapshot.