Basic user-interface class. All UI controls derive from this class, overriding chosen methods to react to some events.
Various methods return Boolean signalling if the input event is "handled". Input events that are handled are not passed to subsequent controls. This way we avoid 2 controls from reacting to the same mouse click, key press etc. Return True
if something was done as a result of given input.
Every control also has a position and size and takes some rectangular space on the container.
Note that some descendants perform auto-sizing, that is: their effective size follows some natural property of the control. For example, TCastleLabel size by default follows the TCastleLabel.Caption value, and ignores the explicit size set in Width and Height. You can turn off auto-sizing by TCastleLabel.AutoSize, to manually control the size using Width and Height.
All the coordinates passed here should follow the Castle Game Engine convention that (0, 0) is left-bottom window corner.
|
procedure Loaded; override; |
|
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"'; |
|
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"'; |
|
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"'; |
|
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"'; |
|
procedure DoCursorChange; virtual; deprecated 'better override VisibleChange and watch for chCursor in Changes'; |
|
procedure DefineProperties(Filer: TFiler); override; |
|
procedure UIScaleChanged; virtual; |
|
procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); virtual; |
|
procedure BeforeSizing; virtual; |
|
procedure DoInternalMouseEnter; virtual; |
|
procedure DoInternalMouseLeave; virtual; |
|
function Theme: TCastleTheme; |
|
constructor Create(AOwner: TComponent); override; |
|
destructor Destroy; override; |
|
procedure CustomSerialization(const SerializationProcess: TSerializationProcess); override; |
|
function PropertySections(const PropertyName: String): TPropertySections; override; |
|
procedure DesignerInfo(const SList: TStrings); override; |
|
procedure DesignerWarnings(const SList: TStrings); override; |
|
function GetEnumerator: TEnumerator; |
|
procedure InternalSetContainer(const Value: TCastleContainer); virtual; |
|
function Press(const Event: TInputPressRelease): boolean; virtual; |
|
function Release(const Event: TInputPressRelease): boolean; virtual; |
|
function PreviewPress(const Event: TInputPressRelease): boolean; virtual; |
|
function PreviewRelease(const Event: TInputPressRelease): boolean; virtual; |
|
function Motion(const Event: TInputMotion): boolean; virtual; |
|
function SensorRotation(const X, Y, Z, Angle: Double; const SecondsPassed: Single): boolean; virtual; |
|
function SensorTranslation(const X, Y, Z, Length: Double; const SecondsPassed: Single): boolean; virtual; |
|
function JoyAxisMove(const JoyID, Axis: Byte): boolean; virtual; deprecated 'use event Joysticks.OnAxisMove, or just observe Joysticks[0].Axis'; |
|
function JoyButtonPress(const JoyID, Button: Byte): boolean; virtual; deprecated 'use Joysticks.OnButtonDown or Joysticks.OnButtonPress'; |
|
procedure Update(const SecondsPassed: Single; var HandleInput: boolean); virtual; |
|
procedure VisibleChange(const Changes: TCastleUserInterfaceChanges; const ChangeInitiatedByChildren: boolean = false); overload; virtual; |
|
function AllowSuspendForInput: boolean; virtual; |
|
procedure Resize; virtual; |
|
function ControlsCount: Integer; |
|
procedure InsertFront(const NewItem: TCastleUserInterface); overload; |
|
procedure InsertFrontIfNotExists(const NewItem: TCastleUserInterface); |
|
procedure InsertFront(const NewItems: TCastleUserInterfaceList); overload; |
|
procedure InsertBack(const NewItem: TCastleUserInterface); overload; |
|
procedure InsertBackIfNotExists(const NewItem: TCastleUserInterface); |
|
procedure InsertBack(const NewItems: TCastleUserInterfaceList); overload; |
|
procedure InsertControl(const Index: Integer; const NewItem: TCastleUserInterface); |
|
procedure RemoveControl(const Item: TCastleUserInterface); |
|
function IndexOfControl(const Item: TCastleUserInterface): Integer; |
|
procedure ClearControls; |
|
procedure MoveToFront; |
|
function CapturesEventsAtPosition(const Position: TVector2): boolean; virtual; |
|
procedure BeforeRender; virtual; |
|
procedure Render; virtual; |
|
procedure RenderOverChildren; virtual; |
|
function TooltipExists: Boolean; virtual; deprecated 'use TooltipControl to customize tooltip look'; |
|
procedure TooltipRender(const TooltipPosition: TVector2); virtual; deprecated 'use TooltipControl to customize tooltip look'; |
|
procedure GLContextOpen; virtual; |
|
procedure GLContextClose; virtual; |
|
procedure SetFocused(const Value: boolean); virtual; |
|
function EffectiveRect: TFloatRectangle; |
|
function EffectiveWidth: Single; |
|
function EffectiveHeight: Single; |
|
function EffectiveWidthForChildren: Single; |
|
function EffectiveHeightForChildren: Single; |
|
function CalculatedWidth: Cardinal; deprecated 'use EffectiveWidth'; |
|
function CalculatedHeight: Cardinal; deprecated 'use EffectiveHeight'; |
|
function CalculatedRect: TRectangle; deprecated 'use EffectiveRect'; |
|
function RenderRect: TFloatRectangle; |
|
function RenderRectWithBorder: TFloatRectangle; |
|
function ScreenRect: TRectangle; deprecated 'use RenderRect'; |
|
function ContainerToLocalPosition(ContainerPosition: TVector2; const ContainerPositionScaled: Boolean = true): TVector2; |
|
function LocalToContainerPosition(const LocalPosition: TVector2; const ContainerPositionScaled: Boolean = true): TVector2; |
|
function ParentRect: TFloatRectangle; |
|
procedure Anchor(const AHorizontalAnchor: THorizontalPosition; const TranslationX: Single = 0); overload; |
|
procedure Anchor( const AHorizontalAnchorSelf, AHorizontalAnchorParent: THorizontalPosition; const TranslationX: Single = 0); overload; |
|
procedure Anchor(const AVerticalAnchor: TVerticalPosition; const TranslationY: Single = 0); overload; |
|
procedure Anchor( const AVerticalAnchorSelf, AVerticalAnchorParent: TVerticalPosition; const TranslationY: Single = 0); overload; |
|
procedure AlignHorizontal( const ControlPosition: TPositionRelative = prMiddle; const ContainerPosition: TPositionRelative = prMiddle; const X: Single = 0); deprecated 'use Anchor'; |
|
procedure Align( const ControlPosition: THorizontalPosition; const ContainerPosition: THorizontalPosition; const X: Single = 0); overload; deprecated 'use Anchor'; |
|
procedure AlignVertical( const ControlPosition: TPositionRelative = prMiddle; const ContainerPosition: TPositionRelative = prMiddle; const Y: Single = 0); deprecated 'use Anchor'; |
|
procedure Align( const ControlPosition: TVerticalPosition; const ContainerPosition: TVerticalPosition; const Y: Single = 0); overload; deprecated 'use Anchor'; |
|
procedure Center; deprecated 'use Anchor(hpMiddle); Anchor(vpMiddle); to reliably center the control'; |
|
function UIScale: Single; virtual; |
|
procedure EditorAllowResize(out ResizeWidth, ResizeHeight: Boolean; out Reason: String); virtual; |
|
function EffectiveFullSize: Boolean; |