Unit CastleControls

Description

Standard 2D controls: buttons, labels, sliders etc.

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TCastleUserInterfaceFont Base class for all user interface controls using a font.
Class TCastleButton Clickable button.
Class TCastlePanel Panel or a toolbar control.
Class TCastleImageControl Image control.
Class TCastleTouchControl Touch user interface to navigate in a 3D world.
Class TCastleRectangleControl Fill a rectangle on screen with given color or theme image.
Class TCastleShape Draw a simple shape (rectangle, circle) with given color and optional outline.
Class TCastleSimpleBackground Fill the whole window with a simple color.
Class TCastleLabel Label with possibly multiline text, in an optional box.
Class TCastleCrosshair Display a simple crosshair in the middle of the parent control.
Class TCastleProgressBar Progress bar user interface.
Class TCastleAbstractSlider An abstract slider user interface.
Class TCastleFloatSlider Slider to change a float value within a given range.
Class TCastleIntegerSlider Slider to change an integer value within a given range.
Class TCastleScrollViewCustom Abstract user interface with a scrollbar.
Class TCastleScrollView Container for a user interface children that can be scrolled vertically.
Class TCastleScrollViewManual Control with a scrollbar.
Class TCastleSwitchControl Touch-friendly checkbox control with representing on/off state.
Class TCastleCheckbox Checkbox with a caption.
Class TCastleTableViewCell Cell inside TCastleTableView.
Interface ICastleTableViewDataSource Data source used in TCastleTableView.
Class TCastleTableView TableView control to show lists in GUI.
Class TCastleTimer Timer, running the OnTimer event periodically.
Class TCastleEdit Edit box to input a single line of text.
Class TCastleFloatEdit Descendant of TCastleEdit specialized for editing floating-point numbers.
Class TCastleIntegerEdit Descendant of TCastleEdit specialized for editing integer numbers.
Class TCastlePackedGroup Abstract ancestor for containers that pack children, like TCastleHorizontalGroup and TCastleVerticalGroup.
Class TCastleHorizontalGroup Container that packs the children horizontally.
Class TCastleVerticalGroup Container that packs the children vertically.
Class TCastleDesign Contents of this user-interface control are loaded from an indicated file (by the URL property).
Class TCastleTheme Theme for 2D GUI controls.
Class TCastleClipboard Clipboard to cut / copy / paste the text.

Functions and Procedures

function Theme: TCastleTheme;
function GetUIFont: TCastleFont;
procedure SetUIFont(const Value: TCastleFont);
function GetUIFontSmall: TCastleFont; deprecated 'use UIFont and temporarily change the size to be smaller, or use TCastleUserInterfaceFont.SmallFont';
procedure SetUIFontSmall(const Value: TCastleFont); deprecated 'use UIFont and temporarily change the size to be smaller, or use TCastleUserInterfaceFont.SmallFont';
function Clipboard: TCastleClipboard;
procedure RegisterClipboard(const AClipboard: TCastleClipboard);
procedure Register;

Types

TThemeImage = (...);
TUIControlFont = TCastleUserInterfaceFont deprecated 'use TCastleUserInterfaceFont';
TCastleButtonImageLayout = (...);
TProportionalScaling = (...);
TCastleTouchCtlMode = (...);
TCastleTouchPosition = (...);
TShapeType = (...);
TCastleCrosshairShape = (...);
TCastleTableViewCellAccessoryType = (...);
TCastleTableViewCellList = specialize TObjectList<TCastleTableViewCell>;
TTableViewDidSelectCellEvent = procedure(Row: Integer; Sender: TCastleTableView) of object;

Variables

property UIFont: TCastleFont read GetUIFont write SetUIFont;
property UIFontSmall: TCastleFont read GetUIFontSmall write SetUIFontSmall;

Description

Functions and Procedures

function Theme: TCastleTheme;
 
function GetUIFont: TCastleFont;

The 2D fonts used throughout UI interface.

By default, this is a modern sans-serif font hardcoded into the engine. It will be automatically created and freed if needed. This is comfortable for simple applications, you can just start "drawing text" without initializing anything.

You can assign your own font here, to make this the default font used by all 2D controls.

Note that assigning font here does not make it automatically freed (this would cause more trouble than comfort). To make sure your own fonts are always freed, set the font "owner" at creation, e.g. the example below sets the Application as owner:

MyFont := TTextureFont.Create(Application);
MyFont.Load(TextureFont_Xxxx);
UIFont := MyFont;

procedure SetUIFont(const Value: TCastleFont);
 
function GetUIFontSmall: TCastleFont; deprecated 'use UIFont and temporarily change the size to be smaller, or use TCastleUserInterfaceFont.SmallFont';

Warning: this symbol is deprecated: use UIFont and temporarily change the size to be smaller, or use TCastleUserInterfaceFont.SmallFont

 
procedure SetUIFontSmall(const Value: TCastleFont); deprecated 'use UIFont and temporarily change the size to be smaller, or use TCastleUserInterfaceFont.SmallFont';

Warning: this symbol is deprecated: use UIFont and temporarily change the size to be smaller, or use TCastleUserInterfaceFont.SmallFont

 
function Clipboard: TCastleClipboard;

Single global instance of TCastleClipboard. Automatically created / destroyed by this unit.

procedure RegisterClipboard(const AClipboard: TCastleClipboard);

Register custom TCastleClipboard implementation, that replaces the global Clipboard. The instance given here becomes owned by this unit (we will free it automatically).

procedure Register;
 

Types

TThemeImage = (...);
 
Values
  • tiPanel
  • tiPanelSeparator
  • tiProgressBar
  • tiProgressFill
  • tiButtonPressed
  • tiButtonDisabled
  • tiButtonFocused
  • tiButtonNormal
  • tiWindow
  • tiScrollbarFrame
  • tiScrollbarSlider
  • tiSlider
  • tiSliderPosition
  • tiLabel
  • tiGroup
  • tiActiveFrame
  • tiTooltip
  • tiTouchCtlInner
  • tiTouchCtlOuter
  • tiTouchCtlFlyInner
  • tiTouchCtlFlyOuter
  • tiCrosshair1
  • tiCrosshair2
  • tiCheckmark
  • tiSquareEmpty
  • tiSquareChecked
  • tiSquarePressedBackground
  • tiDisclosure
  • tiSwitchControl
  • tiSwitchControlFill
  • tiLoading: Image displayed when the application is initializing, during Application.OnInitialize and Window.OnOpen. And TCastleUserInterface.GLContextOpen for all initially present UI controls. This "loading image" is loaded and displayed first, so that user does not see a black screen while the resources are prepared.

    It is especially useful on Android, where we can lose the OpenGL context at any moment, as user may switch applications in the middle of the game. When getting back to the application, we need to initiailize some resources, and during this process we also show this image. So this serves as a universal "please wait, we're loading" screen.

    You can customize this image, by setting Theme.Images[tiLoading], LoadingBackgroundColor, LoadingTextColor. See https://castle-engine.io/tutorial_player_2d_controls.php for a sample code that sets a theme image.

    Note that the customization of this image should be done before Application.OnInitialize has started, so it has to be usually done from the "initialization" section of some unit. And in the "initialization" section of a unit, you cannot load files (doing LoadImage at this point may fail on some Android devices, as we cannot load assets before activity is started). So you can only assign images already available in code — use image-to-pascal tool to convert any image to a Pascal code for this purpose.

  • tiEdit: TCastleEdit frame.
TUIControlFont = TCastleUserInterfaceFont deprecated 'use TCastleUserInterfaceFont';

Warning: this symbol is deprecated: use TCastleUserInterfaceFont

 
TCastleButtonImageLayout = (...);

Possible image placement for a button, see TCastleButton.ImageLayout.

Values
  • ilTop
  • ilBottom
  • ilLeft
  • ilRight
TProportionalScaling = (...);

Indicate stretching approach for TCastleImageControl.ProportionalScaling.

Values
  • psNone: Adjust to the requested area, ignoring proportions.
  • psEnclose: Adjust to the requested area, honoring proportions, such that the image may be larger than the requested area.
  • psFit: Adjust to the requested area, honoring proportions, such that the image may be smaller than the requested area.
TCastleTouchCtlMode = (...);

Possible touch control UI, for TCastleTouchControl.TouchMode.

Values
  • ctcmWalking
  • ctcmWalkWithSideRot
  • ctcmHeadRotation
  • ctcmFlyUpdown
  • ctcmPanXY
TCastleTouchPosition = (...);
 
Values
  • tpManual
  • tpLeft
  • tpRight
TShapeType = (...);

Possible shape type, for TCastleShape.ShapeType.

Values
  • stRectangle
  • stCircle
TCastleCrosshairShape = (...);

Possible crosshair shape, for TCastleCrosshair.Shape.

Values
  • csCross
  • csCrossRect
TCastleTableViewCellAccessoryType = (...);

Decoration used in TCastleTableViewCell.

Values
  • tvcaNone
  • tvcaCheckmark
  • tvcaDisclosureIndicator
TCastleTableViewCellList = specialize TObjectList<TCastleTableViewCell>;
 
TTableViewDidSelectCellEvent = procedure(Row: Integer; Sender: TCastleTableView) of object;
 

Variables

property UIFont: TCastleFont read GetUIFont write SetUIFont;
 
property UIFontSmall: TCastleFont read GetUIFontSmall write SetUIFontSmall;
 

Generated by PasDoc 0.15.0.