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 /// /// A Layout handles the sizing of the children of a Panel according to /// implementation-specific heuristics. Methods must be called on the browser /// process UI thread unless otherwise indicated. /// /// /// CEF source file: /include/capi/views/cef_layout_capi.h (cef_layout_t) /// TCefLayoutRef = class(TCefBaseRefCountedRef, ICefLayout) protected /// /// Returns this Layout as a BoxLayout or NULL if this is not a BoxLayout. /// function AsBoxLayout : ICefBoxLayout; /// /// Returns this Layout as a FillLayout or NULL if this is not a FillLayout. /// function AsFillLayout : ICefFillLayout; /// /// Returns true (1) if this Layout is valid. /// function IsValid : boolean; public /// /// Returns a ICefLayout instance using a PCefLayout data pointer. /// 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.