Unit CastleLCLUtils

Description

Utilities for cooperation between LCL and "Castle Game Engine".

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TLCLKeyPressHandler Convert LCL OnKeyDown and OnUTF8KeyPress into a single CGE event OnPress.

Functions and Procedures

procedure FileFiltersToDialog(const FileFilters: string; Dialog: TFileDialog; const AllFields: boolean = true);
procedure FileFiltersToDialog(const FileFilters: string; const Edit: TFileNameEdit; 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;
function KeyLCLToCastle(const Key: Word; const Shift: TShiftState): TKey;
procedure KeyCastleToLCL(const Key: TKey; const KeyString: String; out LazKey: Word; out Shift: TShiftState);
procedure KeyCastleToLCL(const Key: TKey; KeyString: String; const Modifiers: TModifierKeys; out LazKey: Word; out Shift: TShiftState);
function MouseButtonLCLToCastle( const MouseButton: Controls.TMouseButton; out MyMouseButton: TCastleMouseButton): boolean;
function FilenameToURISafeUTF8(const FileName: string): string;
function URIToFilenameSafeUTF8(const URL: string): string;
function ColorToVector3(const Color: TColor): TVector3;
function ColorToVector3Byte(const Color: TColor): TVector3Byte;

Types

TControlInputPressReleaseEvent = procedure (Sender: TObject; const Event: TInputPressRelease) of object;
TControlInputMotionEvent = procedure (Sender: TObject; const Event: TInputMotion) of object;

Constants

CursorCastleToLCL: array [TMouseCursor] of TCursor = ( crDefault, crNone, crNone, crDefault, crArrow, crHourGlass, crIBeam, crHandPoint, crSizeNS, crSizeWE, crSizeNW, crSizeN, crSizeNE, crSizeW, crSizeE, crSizeSW, crSizeS, crSizeSE );

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; const Edit: TFileNameEdit; 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;

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.

 
function KeyLCLToCastle(const Key: Word; const Shift: TShiftState): TKey;

Convert Key (Lazarus key code) to Castle Game Engine TKey. Returns keyNone if not possible.

procedure KeyCastleToLCL(const Key: TKey; const KeyString: String; 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 conversion not possible (or when Key = keyNone and KeyString = '').

procedure KeyCastleToLCL(const Key: TKey; KeyString: String; const Modifiers: TModifierKeys; out LazKey: Word; out Shift: TShiftState);
 
function MouseButtonLCLToCastle( const MouseButton: Controls.TMouseButton; out MyMouseButton: TCastleMouseButton): boolean;

Convert Lazarus Controls.TMouseButton value to Castle Game Engine CastleKeysMouse.TCastleMouseButton.

(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 (buttonMiddle is in the middle in my type)).

function FilenameToURISafeUTF8(const FileName: string): string;

mcDefault mcNone mcForceNone mcCustom mcStandard mcWait mcText mcHand mcResizeVertical mcResizeHorizontal mcResizeTopLeft mcResizeTop mcResizeTopRight mcResizeLeft mcResizeRight mcResizeBottomLeft mcResizeBottom mcResizeBottomRight

function URIToFilenameSafeUTF8(const URL: string): string;
 
function ColorToVector3(const Color: TColor): TVector3;

Convert LCL color values to our colors (vectors).

function ColorToVector3Byte(const Color: TColor): TVector3Byte;
 

Types

TControlInputPressReleaseEvent = procedure (Sender: TObject; const Event: TInputPressRelease) of object;
 
TControlInputMotionEvent = procedure (Sender: TObject; const Event: TInputMotion) of object;
 

Constants

CursorCastleToLCL: array [TMouseCursor] of TCursor = ( crDefault, crNone, crNone, crDefault, crArrow, crHourGlass, crIBeam, crHandPoint, crSizeNS, crSizeWE, crSizeNW, crSizeN, crSizeNE, crSizeW, crSizeE, crSizeSW, crSizeS, crSizeSE );
 

Generated by PasDoc 0.15.0.