Castle Game Engine: CastleLCLUtils

# Unit CastleLCLUtils
Description | Uses | Classes, Interfaces, Objects and Records | Functions and Procedures | Types | Constants | Variables
## Description Utilities for cooperation between LCL and "Castle Game Engine". ## Uses Dialogs Classes Controls CastleFileFilters CastleKeysMouse Graphics CastleVectors ## Overview ### Functions and Procedures
`procedure FileFiltersToDialog(const FileFilters: string; Dialog: TFileDialog; const AllFields: boolean = true);`
`procedure FileFiltersToDialog(const FileFilters: string; out LCLFilter: string; out LCLFilterIndex: Integer; const AllFields: boolean = true);`
`procedure FileFiltersToDialog(FFList: TFileFilterList; Dialog: TFileDialog; const AllFields: boolean = true);`
`procedure FileFiltersToDialog(FFList: TFileFilterList; out LCLFilter: string; out LCLFilterIndex: Integer; const AllFields: boolean = true);`
`function SQuoteLCLCaption(const S: string): string;`
`procedure FileFiltersToOpenDialog(const FileFilters: string; Dialog: TFileDialog); deprecated;`
`procedure FileFiltersToOpenDialog(const FileFilters: string; out LCLFilter: string; out LCLFilterIndex: Integer); deprecated;`
`procedure FileFiltersToOpenDialog(FFList: TFileFilterList; out LCLFilter: string; out LCLFilterIndex: Integer); deprecated;`
`procedure KeyLCLToCastle(const Key: Word; const Shift: TShiftState; out MyKey: TKey; out MyCharKey: char);`
`procedure KeyCastleToLCL(const Key: TKey; const CharKey: char; const Modifiers: TModifierKeys; out LazKey: Word; out Shift: TShiftState);`
`procedure KeyCastleToLCL(const Key: TKey; const CharKey: char; out LazKey: Word; out Shift: TShiftState);`
`function MouseButtonLCLToCastle( const MouseButton: Controls.TMouseButton; out MyMouseButton: CastleKeysMouse.TMouseButton): boolean;`
`function FilenameToURISafeUTF8(const FileName: string): string;`
`function URIToFilenameSafeUTF8(const URL: string): string;`
`function ColorToVector3(const Color: TColor): TVector3Single;`
`function ColorToVector3Byte(const Color: TColor): TVector3Byte;`
### Constants
`CursorCastleToLCL: array [TMouseCursor] of TCursor = ( crDefault, crNone, crDefault , crArrow, crHourGlass, crIBeam, crHandPoint );`
## Description ### Functions and Procedures
`procedure FileFiltersToDialog(const FileFilters: string; Dialog: TFileDialog; const AllFields: boolean = true);`
Convert file filters into LCL Dialog.Filter, Dialog.FilterIndex. Suitable for both open and save dialogs (TOpenDialog, TSaveDialog both descend from TFileDialog). Input filters are either given as a string FileFilters (encoded just like for TFileFilterList.AddFiltersFromString), or as TFileFilterList instance. Output filters are either written to LCLFilter, LCLFilterIndex variables, or set appropriate properties of given Dialog instance. When AllFields is false, then filters starting with "All " in the name, like "All files", "All images", are not included in the output.
`procedure FileFiltersToDialog(const FileFilters: string; out LCLFilter: string; out LCLFilterIndex: Integer; const AllFields: boolean = true);`
`procedure FileFiltersToDialog(FFList: TFileFilterList; Dialog: TFileDialog; const AllFields: boolean = true);`
`procedure FileFiltersToDialog(FFList: TFileFilterList; out LCLFilter: string; out LCLFilterIndex: Integer; const AllFields: boolean = true);`
`function SQuoteLCLCaption(const S: string): string;`
Make each '&' inside string '&&', this way the string will not contain special '&x' sequences when used as a TMenuItem.Caption and such.
`procedure FileFiltersToOpenDialog(const FileFilters: string; Dialog: TFileDialog); deprecated;`
Warning: this symbol is deprecated. Deprecated names, use the identifiers without "Open" in new code.
`procedure FileFiltersToOpenDialog(const FileFilters: string; out LCLFilter: string; out LCLFilterIndex: Integer); deprecated;`
Warning: this symbol is deprecated.
`procedure FileFiltersToOpenDialog(FFList: TFileFilterList; out LCLFilter: string; out LCLFilterIndex: Integer); deprecated;`
Warning: this symbol is deprecated.
`procedure KeyLCLToCastle(const Key: Word; const Shift: TShiftState; out MyKey: TKey; out MyCharKey: char);`
Convert Key (Lazarus key code) to Castle Game Engine TKey. In addition, this tries to convert Key to a character (MyCharKey). It's awful that this function has to do convertion to Char, but that's the way of VCL and LCL: KeyPress and KeyDown are separate events. While I want to have them in one event, and passed as one event to TUIControl.KeyDown.
`procedure KeyCastleToLCL(const Key: TKey; const CharKey: char; const Modifiers: TModifierKeys; out LazKey: Word; out Shift: TShiftState);`
Convert TKey and/or character code into Lazarus key code (VK_xxx) and shift state. Sets LazKey to VK_UNKNOWN (zero) when convertion not possible (or when Key is K_None and CharKey = #0). Note that this is not a perfect reverse of KeyLCLToCastle function. It can't, as there are ambiguities (e.g. character 'A' may be a key K_A with mkShift in modifiers).
`procedure KeyCastleToLCL(const Key: TKey; const CharKey: char; out LazKey: Word; out Shift: TShiftState);`
`function MouseButtonLCLToCastle( const MouseButton: Controls.TMouseButton; out MyMouseButton: CastleKeysMouse.TMouseButton): boolean;`
Convert Lazarus Controls.TMouseButton value to Castle Game Engine CastleKeysMouse.TMouseButton. (By coincidence, my type name and values are the same as used by LCL; but beware — the order of values in my type is different (mbMiddle is in the middle in my type)).
`function FilenameToURISafeUTF8(const FileName: string): string;`
mcCustom treat like mcDefault
`function URIToFilenameSafeUTF8(const URL: string): string;`
`function ColorToVector3(const Color: TColor): TVector3Single;`
Convert LCL color values to our colors (vectors).
`function ColorToVector3Byte(const Color: TColor): TVector3Byte;`
### Constants
`CursorCastleToLCL: array [TMouseCursor] of TCursor = ( crDefault, crNone, crDefault , crArrow, crHourGlass, crIBeam, crHandPoint );`
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:10