CEF4Delphi/source/uCEFLayout.pas
salvadordf ca8bc9dff4 Added cef4delphi.chm help file
Added the PDS file to extract the HTML Help files using PasDoc
Added more XML documentation
Fixed some XML errors.
Removed the license copy from the pas units.
Updated the LICENSE.md file
2023-08-09 19:38:57 +02:00

63 lines
1.2 KiB
ObjectPascal

unit uCEFLayout;
{$IFDEF FPC}
{$MODE OBJFPC}{$H+}
{$ENDIF}
{$I cef.inc}
{$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF}
{$MINENUMSIZE 4}
interface
uses
{$IFDEF DELPHI16_UP}
System.Classes, System.SysUtils,
{$ELSE}
Classes, SysUtils,
{$ENDIF}
uCEFBaseRefCounted, uCEFInterfaces, uCEFTypes;
type
TCefLayoutRef = class(TCefBaseRefCountedRef, ICefLayout)
protected
function AsBoxLayout : ICefBoxLayout;
function AsFillLayout : ICefFillLayout;
function IsValid : boolean;
public
class function UnWrap(data: Pointer): ICefLayout;
end;
implementation
uses
uCEFLibFunctions, uCEFBoxLayout, uCEFFillLayout;
function TCefLayoutRef.AsBoxLayout : ICefBoxLayout;
begin
Result := TCefBoxLayoutRef.UnWrap(PCefLayout(FData)^.as_box_layout(PCefLayout(FData)));
end;
function TCefLayoutRef.AsFillLayout : ICefFillLayout;
begin
Result := TCefFillLayoutRef.UnWrap(PCefLayout(FData)^.as_fill_layout(PCefLayout(FData)));
end;
function TCefLayoutRef.IsValid : boolean;
begin
Result := (PCefLayout(FData)^.is_valid(PCefLayout(FData)) <> 0);
end;
class function TCefLayoutRef.UnWrap(data: Pointer): ICefLayout;
begin
if (data <> nil) then
Result := Create(data) as ICefLayout
else
Result := nil;
end;
end.