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 GLInitialized, you can depend on it in the implementation of this method.

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. This is method should only be overridden in your own code.

Before calling this method we always set some OpenGL state, and you can depend on it (and you can carelessly change it, as it will be reset again before rendering other control).

OpenGL state always set:

  • Viewport is set to include whole container.

  • Depth test is off.

  • (For fixed-function pipeline:) The 2D orthographic projection is always set at the beginning. Useful for 2D controls, 3D controls can just override projection matrix, e.g. use CastleRenderContext.PerspectiveProjection.

  • (For fixed-function pipeline:) The modelview matrix is set to identity. The matrix mode is always modelview.

  • (For fixed-function pipeline:) The raster position is set to (0,0). The (deprecated) WindowPos is also set to (0,0).

  • (For fixed-function pipeline:) 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 of course 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.