Castle Game Engine: CastleWindowModes: Class TWindowState

# Class TWindowState
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleWindowModes ## Declaration `type TWindowState = class(TObject)` ## Description ## Hierarchy TObject TWindowState ## Overview ### Methods
| `constructor Create(Window: TCastleWindowBase);`
| `destructor Destroy; override;`
| `procedure GetState(Window: TCastleWindowBase);`
| `procedure SetState(Window: TCastleWindowBase);`
| `class procedure SetStandardState(Window: TCastleWindowBase; NewDraw, NewResize, NewCloseQuery: TWindowFunc);`
## Description ### Methods
| `constructor Create(Window: TCastleWindowBase);`
Constructor. Gets the state of given window (like GetState).
| `destructor Destroy; override;`
| `procedure GetState(Window: TCastleWindowBase);`
`GetState` saves the TCastleWindowBase state, SetState applies this state back to the window (the same window, or other). Every property that can change when TCastleWindowBase is open are saved. This way you can save/restore TCastleWindowBase state, you can also copy a state from one window into another. Notes about TCastleWindowBase.MainMenu saving: only the reference to MainMenu is stored. So: If you use TCastleWindowBase.MainMenu, be careful when copying it to another window (no two windows may own the same MainMenu instance at the same time; also, you would have to make sure MainMenu instance will not be freed two times). Do not change the MainMenu contents during TGLMode.Create/Free. Although you can change MainMenu to something completely different. Just keep the assumption that MainMenu stays <> nil. As an exception to the previous point, you can freely change MainMenu.Enabled, that is saved specially for this.
| `procedure SetState(Window: TCastleWindowBase);`
| `class procedure SetStandardState(Window: TCastleWindowBase; NewDraw, NewResize, NewCloseQuery: TWindowFunc);`
Resets all window properties (that are get / set by TWindowState). For most properties, we simply reset them to some sensible default values. For some important properties, we take their value explicitly by parameter. Window properties resetted: Callbacks (OnXxx) are set to `Nil`. All callbacks are affected except OnOpen and OnClose callbacks, also global CastleUIControls.OnGLContextOpen, CastleUIControls.OnGLContextClose are untouched. It is expected that the window (and OpenGL context) will exist during the lifetime of a single TGLMode, so it makes no sense to deal with them. TCastleWindowBase.Caption and TCastleWindowBase.MainMenu are left as they were. TCastleWindowBase.Cursor is reset to mcDefault. TCastleWindowBase.UserData is reset to `Nil`. TCastleWindowBase.AutoRedisplay is reset to `False`. TCastleWindowBase.OnDrawStyle is reset to dsNone. TCastleWindowBase.MainMenu.Enabled will be reset to `False` (only if MainMenu <> nil). TCastleWindowDemo.SwapFullScreen_Key will be reset to K_None. TCastleWindowDemo.Close_charkey will be reset to #0. TCastleWindowDemo.FpsShowOnCaption will be reset to false. TCastleWindowCustom.Controls is set to empty. If you're looking for a suitable callback to pass as NewCloseQuery (new TCastleWindowBase.OnCloseQuery), @NoClose may be suitable: it's an empty callback, thus using it disables the possibility to close the window by window manager (usually using "close" button in some window corner or Alt+F4).
Generated by PasDoc 0.13.0 on 2013-08-17 21:27:15