Class TCastleTheme
Unit
CastleUIControls
Declaration
type TCastleTheme = class(TCastleComponent)
Description
Theme for user interface controls.
You can customize Theme singleton to change the default look.
You can also create new instances of TCastleTheme
and use them for multiple controls, assigning to TCastleUserInterface.CustomTheme.
You can also use FallbackTheme to effectively disable any customizations and always use default hardcoded look.
Hierarchy
Overview
Fields
Methods
Properties
Description
Fields
![Public Public](public.gif) |
BackgroundColor: TCastleColor; |
Color layer displayed between modal dialogs (CastleMessages, CastleDialogStates, TGLModeFrozenScreen) and their background (state underneath or a screenshot). Default is (0, 0, 0, 0.25), making things underneath darker, which helps dialog to stand out.
|
![Public Public](public.gif) |
BackgroundOpaqueColor: TCastleColorRGB; |
Color used instead of BackgroundColor when InternalMessageFallbackLook is used. You can only customize the RGB values, alpha is always 1, so the resulting color is always opaque. It's a dark gray color (0.33, 0.33, 0.33) by default.
|
![Public Public](public.gif) |
LoadingBackgroundColor: TCastleColor; |
Colors used when displaying the loading image (by default just with the "Loading..." text) when application is loading (before proper CGE UI can be displayed). By default, LoadingBackgroundColor is black, and LoadingColor is white.
See https://castle-engine.io/loading_image for an example how to set loading image.
|
![Public Public](public.gif) |
LoadingUIScaling: TUIScaling; |
Adjust loading image following the UI scaling determined by these properties. They determine for what window reference size was the loading image prepared. The loading image is whatever you set at ImagesPersistent[tiLoading] . See https://castle-engine.io/loading_image for an example how to set loading image.
These properties deliberately match the behavior of TCastleContainer.UIScaling, TCastleContainer.UIReferenceWidth, TCastleContainer.UIReferenceHeight, TCastleContainer.UIExplicitScale. If these LoadingUIXxx properties are equal to the TCastleContainer.UIXxx properties, then the rendered image size will be precisely equal to how TCastleImageControl rendering of this image (with anchors set to middle) would look.
The reason why these properties exist is that when rendering ImagesPersistent[tiLoading] , TCastleApplication.OnInitialize is not yet run, and so TCastleContainer.UIScaling may be not yet be initialized (because you cannot read CastleSettings.xml earlier).
By default, we set LoadingUIScaling = usEncloseReferenceSize, LoadingUIReferenceWidth = 1600, LoadingUIReferenceHeight = 900. Note that this is in contrast to TCastleContainer.UIXxx properties, that by default set no UI scaling.
|
![Public Public](public.gif) |
LoadingUIReferenceWidth: Single; |
|
![Public Public](public.gif) |
LoadingUIReferenceHeight: Single; |
|
![Public Public](public.gif) |
LoadingUIExplicitScale: Single; |
|
![Public Public](public.gif) |
MinimumScrollbarSliderHeight: Single; |
Minumum scrollbar height, to be comfortably visible and draggable.
|
![Public Public](public.gif) |
DefaultLabelWhite: Boolean deprecated 'if you want the labels to be white, adjust TCastleLabel.Color to White after creating every TCastleLabel'; |
Warning: this symbol is deprecated: if you want the labels to be white, adjust TCastleLabel.Color to White after creating every TCastleLabel |
Methods
![Public Public](public.gif) |
constructor Create(AOwner: TComponent); override; |
|
![Public Public](public.gif) |
destructor Destroy; override; |
|
![Public Public](public.gif) |
procedure Draw(const Rect: TFloatRectangle; const ImageType: TThemeImage; const UIScale: Single = 1.0); overload; |
Draw the selected theme image on screen.
Parameters
- Color
- Color tint of the image. If you do not specify a color, white will be used, so image will be displayed as-is. Specifying a color means that image will be multiplied by it, just like for TDrawableImage.Color.
- UIScale
- Used to properly scale corners, passed to TDrawableImage.ScaleCorners. This parameter does not scale the place where image is displayed, to do this just scale the given Rect parameter yourself.
|
![Public Public](public.gif) |
procedure Draw(const Rect: TRectangle; const ImageType: TThemeImage; const UIScale: Single = 1.0); overload; |
|
![Public Public](public.gif) |
procedure DialogsLight; |
Set dialogs theme to light.
|
Properties
![Public Public](public.gif) |
property Images[constImageType:TThemeImage]: TCastleImage read GetImages write SetImages; deprecated 'use ImagesPersistent[...].Image'; |
Warning: this symbol is deprecated: use ImagesPersistent[...].Image
Theme images, represented as TCastleImage. Although they all have sensible defaults, you can also change them at any time. Simply create TCastleImage instance (e.g. by LoadImage function) and assign it here. Be sure to adjust also OwnsImages if you want the theme to automatically free the image when it's no longer used.
The alpha channel of the image, if any, is automatically correctly used (for alpha test or alpha blending, see TDrawableImage).
|
![Public Public](public.gif) |
property OwnsImages[constImageType:TThemeImage]: boolean read GetOwnsImages write SetOwnsImages; deprecated 'use ImagesPersistent[...].OwnsImage'; |
Warning: this symbol is deprecated: use ImagesPersistent[...].OwnsImage |
![Public Public](public.gif) |
property Corners[constImageType:TThemeImage]: TVector4 read GetCorners write SetCorners; deprecated 'use ImagesPersistent[...].ProtectedSides'; |
Warning: this symbol is deprecated: use ImagesPersistent[...].ProtectedSides
Corners that determine how image on Images is stretched when drawing by TCastleTheme.Draw method. Together with assigning Images, adjust also this property. It is used for images rendered using TDrawableImage.Draw3x3, it determines how the image is stretched. The corners are specified as 4D vector, order like in CSS: top, right, down, left.
|
![Public Public](public.gif) |
property OwnsMessageFont: boolean
read FOwnsMessageFont write FOwnsMessageFont default true; |
|
Generated by PasDoc 0.16.0.