Class TCastlePackedGroup

Unit

Declaration

type TCastlePackedGroup = class(TCastleUserInterface)

Description

Abstract ancestor for containers that pack children, like TCastleHorizontalGroup and TCastleVerticalGroup.

Hierarchy

Overview

Fields

Protected FPackingValid: boolean;
Public nested const DefaultPadding = 0;
Public nested const DefaultSpacing = 0;

Methods

Protected procedure DoPackChildren(out InsideWidth, InsideHeight: Single); virtual; abstract;
Protected procedure PreferredSize(var PreferredWidth, PreferredHeight: Single); override;
Protected procedure Loaded; override;
Public constructor Create(AOwner: TComponent); override;
Public destructor Destroy; override;
Public procedure BeforeRender; override;
Public procedure Render; override;
Public procedure VisibleChange(const Changes: TCastleUserInterfaceChanges; const ChangeInitiatedByChildren: boolean = false); override;
Public procedure EditorAllowResize(out ResizeWidth, ResizeHeight: Boolean; out Reason: String); override;
Public function PropertySections(const PropertyName: String): TPropertySections; override;

Properties

Public property FrameColor: TCastleColor read FFrameColor write SetFrameColor; deprecated 'display frame around label using Border or parent UI control';
Published property Frame: boolean read FFrame write SetFrame default false; deprecated 'display frame around label using Border or parent UI control';
Published property Padding: Single read FPadding write SetPadding default DefaultPadding;
Published property Spacing: Single read FSpacing write SetSpacing default DefaultSpacing;
Published property AutoSizeWidth: Boolean read FAutoSizeWidth write SetAutoSizeWidth default true;
Published property AutoSizeHeight: Boolean read FAutoSizeHeight write SetAutoSizeHeight default true;
Published property FrameColorPersistent: TCastleColorPersistent read FFrameColorPersistent ;

Description

Fields

Protected FPackingValid: boolean;

This item has no description.

Public nested const DefaultPadding = 0;

This item has no description.

Public nested const DefaultSpacing = 0;

This item has no description.

Methods

Protected procedure DoPackChildren(out InsideWidth, InsideHeight: Single); virtual; abstract;

This item has no description.

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.

Protected procedure Loaded; override;

This item has no description.

Public constructor Create(AOwner: TComponent); override;

This item has no description.

Public destructor Destroy; override;

This item has no description.

Public procedure BeforeRender; override;

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

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.

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).

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

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

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).

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.

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.

Properties

Public property FrameColor: TCastleColor read FFrameColor write SetFrameColor; deprecated 'display frame around label using Border or parent UI control';

Warning: this symbol is deprecated: display frame around label using Border or parent UI control

If Frame, this is the frame's color. By default white.

Published property Frame: boolean read FFrame write SetFrame default false; deprecated 'display frame around label using Border or parent UI control';

Warning: this symbol is deprecated: display frame around label using Border or parent UI control

This item has no description.

Published property Padding: Single read FPadding write SetPadding default DefaultPadding;

This item has no description.

Published property Spacing: Single read FSpacing write SetSpacing default DefaultSpacing;

This item has no description.

Published property AutoSizeWidth: Boolean read FAutoSizeWidth write SetAutoSizeWidth default true;

Whether the control's size is automatically adjusted to wrap children tightly.

Be careful to not create a recursive loop! Group's size calculation always looks at children size (even when auto-size is off, since it needs to arrange children next to each other anyway). This means that children size cannot depend on a parent. So a direct child of TCastleVerticalGroup or TCastleHorizontalGroup cannot use FullSize, or WidthFraction or HeightFraction. This would create a loop in calculations, which would be forcefully resolved by some control having undefined size.

So, you can only deactivate auto-size on a group if all children have explicitly defined size using their Width and Height properties.

Published property AutoSizeHeight: Boolean read FAutoSizeHeight write SetAutoSizeHeight default true;

This item has no description.

Published property FrameColorPersistent: TCastleColorPersistent read FFrameColorPersistent ;

FrameColor 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 FrameColor directly.

See also
FrameColor
If Frame, this is the frame's color.

Generated by PasDoc 0.16.0-snapshot.