Castle Game EngineIntroduction Units Class Hierarchy Classes, Interfaces, Objects and Records Types Variables Constants Functions and Procedures Identifiers |
Class TCastleWindowCustom
Unit
CastleWindow
Declaration
type TCastleWindowCustom = class(TCastleWindowDemo, IUIContainer)
Description
OpenGL window keeping a Controls list. This allows you to trivially add to the window any TUIControl descendants.
We pass our inputs (mouse / key events) to the top-most (that is, first on the Controls list) control under the current mouse position (we check control's PositionInside method for this). As long as the event is not handled, we look for next controls under the mouse position. Only if no control handled the event, we pass it to the inherited EventXxx method, which calls normal window callbacks like OnPress.
We also call other methods on every control, like TUIControl.Update, TUIControl.Draw2D, TUIControl.WindowResize.
We use OnVisibleChange event of our controls to make PostRedisplay when something visible changed. If you want to use OnVisibleChange for other purposes, you can reassign OnVisibleChange yourself. This window will only change OnVisibleChange from Nil to it's own internal callback (when adding a control), and from it's own internal callback to Nil (when removing a control). This means that if you assign OnVisibleChange callback to your own method — window will not touch it anymore.
TCamera descendants can be treated like any other TUIControl, that is you can add them directly to the Controls list. Note that usually, when using TCastleSceneManager, you should only assign camera to TCastleSceneManager.Camera, so most programs should not add their TCamera intances directly to the Controls list.
Hierarchy
Overview
Methods
Properties
Description
Methods
 |
constructor Create(AOwner: TComponent); override; |
|
 |
destructor Destroy; override; |
|
 |
procedure EventOpen; override; |
|
 |
procedure EventClose; override; |
|
 |
procedure EventUpdate; override; |
|
 |
procedure EventMouseMove(NewX, NewY: Integer); override; |
|
 |
function AllowSuspendForInput: boolean; override; |
|
 |
procedure EventBeforeDraw; override; |
|
 |
procedure EventDraw; override; |
|
 |
procedure EventResize; override; |
|
Properties
 |
property Controls: TUIControlList read FControls; |
Controls listening for user input (keyboard / mouse) to this window.
Usually you explicitly add / delete controls to this list. Also, freeing the control that is on this list automatically removes it from this list (using the TComponent.Notification mechanism).
Controls on the list should be specified in front-to-back order. That is, controls at the beginning of this list are first to catch some events, and are rendered as the last ones (to cover controls beneath them).
|
 |
property Focus: TUIControl read FFocus; |
Returns the control that should receive input events first, or Nil if none. More precisely, this is the first on Controls list that is enabled and under the mouse cursor. Nil is returned when there's no enabled control under the mouse cursor, or when UseControls = False .
|
 |
property OnDrawStyle: TUIControlDrawStyle
read FOnDrawStyle write FOnDrawStyle default dsNone; |
How OnDraw callback fits within various Draw methods of our Controls.
dsNone means that OnDraw is called at the end, after all our Controls are drawn.
OpenGL projection matrix is not modified (so projection is whatever you set yourself, by EventResize, OnResize, or whatever TCastleSceneManager set for you).
Note that the interpretation of dsNone is different than for TUIControl.DrawStyle: for TUIControl.DrawStyle, dsNone means "do not draw". For OnDrawStyle property, dsNone means "draw at the end without any tricks".
This is suitable if you want to draw something over other controls, and you want to set projection yourself (or use the current projection, whatever it is).
ds2D means that OnDraw is also called at the end, after all our Controls are drawn. But this time we're called within 2D orthographic projection, the same as set for TUIControl.DrawStyle = ds2D.
This is suitable if you want to draw 2D contents, and our simple 2D orthographic projection suits you.
ds3D means that OnDraw is called after all other Controls with ds3D draw style, but before any 2D controls.
OpenGL projection matrix is not modified (so projection is whatever you set yourself, by EventResize, OnResize, or whatever TCastleSceneManager set for you).
This is suitable if you want to draw something 3D, that may be later covered by 2D controls.
|
 |
property TooltipDistance: Cardinal read FTooltipDistance write FTooltipDistance
default DefaultTooltipDistance; |
|
 |
property TooltipX: Integer read FTooltipX; |
|
 |
property TooltipY: Integer read FTooltipY; |
|
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:15
|