unit uCEFViewComponent; {$IFDEF FPC} {$MODE OBJFPC}{$H+} {$ENDIF} {$I cef.inc} {$IFNDEF TARGET_64BITS}{$ALIGN ON}{$ENDIF} {$MINENUMSIZE 4} interface uses {$IFDEF DELPHI16_UP} {$IFDEF MSWINDOWS}WinApi.Windows,{$ENDIF} System.Classes, {$ELSE} {$IFDEF MSWINDOWS}Windows,{$ENDIF} Classes, {$IFDEF FPC} LCLProc, LCLType, LCLIntf, LResources, InterfaceBase, {$ENDIF} {$ENDIF} uCEFTypes, uCEFInterfaces, uCEFViewsFrameworkEvents; type TCEFViewComponent = class(TComponent, ICefViewDelegateEvents) protected // ICefViewDelegateEvents FOnGetPreferredSize : TOnGetPreferredSizeEvent; FOnGetMinimumSize : TOnGetMinimumSizeEvent; FOnGetMaximumSize : TOnGetMaximumSizeEvent; FOnGetHeightForWidth : TOnGetHeightForWidthEvent; FOnParentViewChanged : TOnParentViewChangedEvent; FOnChildViewChanged : TOnChildViewChangedEvent; FOnWindowChanged : TOnWindowChangedEvent; FOnLayoutChanged : TOnLayoutChangedEvent; FOnFocus : TOnFocusEvent; FOnBlur : TOnBlurEvent; FOnThemeChanged : TOnThemeChangedEvent; FComponentID : integer; procedure CreateView; virtual; procedure DestroyView; virtual; procedure Initialize; virtual; function GetInitialized : boolean; virtual; function GetAsView : ICefView; virtual; function GetTypeString : ustring; function GetAsBrowserView : ICefBrowserView; virtual; function GetAsButton : ICefButton; virtual; function GetAsPanel : ICefPanel; virtual; function GetAsScrollView : ICefScrollView; virtual; function GetAsTextfield : ICefTextfield; virtual; function GetIsValid : boolean; function GetIsAttached : boolean; function GetDelegate : ICefViewDelegate; function GetWindow : ICefWindow; function GetID : Integer; function GetGroupID : Integer; function GetParentView : ICefView; function GetBounds : TCefRect; function GetBoundsInScreen : TCefRect; function GetSize : TCefSize; function GetPosition : TCefPoint; function GetPreferredSize : TCefSize; function GetMinimumSize : TCefSize; function GetMaximumSize : TCefSize; function GetIsVisible : boolean; function GetIsDrawn : boolean; function GetIsEnabled : boolean; function GetIsFocusable : boolean; function GetIsAccessibilityFocusable : boolean; function GetBackgroundColor : TCefColor; function GetViewForID(id_: Integer): ICefView; function GetHeightForWidth(width: Integer): Integer; function GetInsets: TCefInsets; function GetComponentID : integer; procedure SetID(id_: Integer); procedure SetGroupID(group_id: Integer); procedure SetBounds(const bounds_: TCefRect); procedure SetSize(const size_: TCefSize); procedure SetPosition(const position_: TCefPoint); procedure SetVisible(visible_: boolean); procedure SetEnabled(enabled_: boolean); procedure SetFocusable(focusable_: boolean); procedure SetBackgroundColor(color: TCefColor); procedure SetInsets(const insets: TCefInsets); // ICefViewDelegateEvents procedure doOnGetPreferredSize(const view: ICefView; var aResult : TCefSize); virtual; procedure doOnGetMinimumSize(const view: ICefView; var aResult : TCefSize); virtual; procedure doOnGetMaximumSize(const view: ICefView; var aResult : TCefSize); virtual; procedure doOnGetHeightForWidth(const view: ICefView; width: Integer; var aResult: Integer); virtual; procedure doOnParentViewChanged(const view: ICefView; added: boolean; const parent: ICefView); virtual; procedure doOnChildViewChanged(const view: ICefView; added: boolean; const child: ICefView); virtual; procedure doOnWindowChanged(const view: ICefView; added: boolean); virtual; procedure doOnLayoutChanged(const view: ICefView; new_bounds: TCefRect); virtual; procedure doOnFocus(const view: ICefView); virtual; procedure doOnBlur(const view: ICefView); virtual; procedure doOnThemeChanged(const view: ICefView); virtual; procedure doCreateCustomView; virtual; public constructor Create(AOwner: TComponent); override; procedure AfterConstruction; override; procedure BeforeDestruction; override; /// /// Returns a string representation of this View which includes the type and /// various type-specific identifying attributes. If |include_children| is /// true (1) any child Views will also be included. Used primarily for testing /// purposes. /// function ToStringEx(include_children: boolean): ustring; /// /// Returns true (1) if this View is the same as |that| View. /// function IsSame(const that: ICefView): boolean; /// /// Size this View to its preferred size. Size is in parent coordinates, or /// DIP screen coordinates if there is no parent. /// procedure SizeToPreferredSize; /// /// Indicate that this View and all parent Views require a re-layout. This /// ensures the next call to layout() will propagate to this View even if the /// bounds of parent Views do not change. /// procedure InvalidateLayout; /// /// Request keyboard focus. If this View is focusable it will become the /// focused View. /// procedure RequestFocus; /// /// Returns the current theme color associated with |color_id|, or the /// placeholder color (red) if unset. See cef_color_ids.h for standard ID /// values. Standard colors can be overridden and custom colors can be added /// using ICefWindow.SetThemeColor. /// function GetThemeColor(color_id: integer): TCefColor; /// /// Convert |point| from this View's coordinate system to DIP screen /// coordinates. This View must belong to a Window when calling this function. /// Returns true (1) if the conversion is successful or false (0) otherwise. /// Use ICefDisplay.ConvertPointToPixels() after calling this function /// if further conversion to display-specific pixel coordinates is desired. /// function ConvertPointToScreen(var point: TCefPoint): boolean; /// /// Convert |point| to this View's coordinate system from DIP screen /// coordinates. This View must belong to a Window when calling this function. /// Returns true (1) if the conversion is successful or false (0) otherwise. /// Use ICefDisplay.ConvertPointFromPixels() before calling this /// function if conversion from display-specific pixel coordinates is /// necessary. /// function ConvertPointFromScreen(var point: TCefPoint): boolean; /// /// Convert |point| from this View's coordinate system to that of the Window. /// This View must belong to a Window when calling this function. Returns true /// (1) if the conversion is successful or false (0) otherwise. /// function ConvertPointToWindow(var point: TCefPoint): boolean; /// /// Convert |point| to this View's coordinate system from that of the Window. /// This View must belong to a Window when calling this function. Returns true /// (1) if the conversion is successful or false (0) otherwise. /// function ConvertPointFromWindow(var point: TCefPoint): boolean; /// /// Convert |point| from this View's coordinate system to that of |view|. /// |view| needs to be in the same Window but not necessarily the same view /// hierarchy. Returns true (1) if the conversion is successful or false (0) /// otherwise. /// function ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean; /// /// Convert |point| to this View's coordinate system from that |view|. |view| /// needs to be in the same Window but not necessarily the same view /// hierarchy. Returns true (1) if the conversion is successful or false (0) /// otherwise. /// function ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean; /// /// Returns true when the control is fully initialized. /// property Initialized : boolean read GetInitialized; /// /// Returns this control as a View. /// property AsView : ICefView read GetAsView; /// /// Returns this View as a BrowserView or NULL if this is not a BrowserView. /// property AsBrowserView : ICefBrowserView read GetAsBrowserView; /// /// Returns this View as a Button or NULL if this is not a Button. /// property AsButton : ICefButton read GetAsButton; /// /// Returns this View as a Panel or NULL if this is not a Panel. /// property AsPanel : ICefPanel read GetAsPanel; /// /// Returns this View as a ScrollView or NULL if this is not a ScrollView. /// property AsScrollView : ICefScrollView read GetAsScrollView; /// /// Returns this View as a Textfield or NULL if this is not a Textfield. /// property AsTextfield : ICefTextfield read GetAsTextfield; /// /// Recursively descends the view tree starting at this View, and returns the /// first child that it encounters with the given ID. Returns NULL if no /// matching child view is found. /// property ViewForID[id_: Integer] : ICefView read GetViewForID; /// /// Returns true (1) if this View is valid. /// property Valid : boolean read GetIsValid; /// /// Returns true (1) if this View is currently attached to another View. A /// View can only be attached to one View at a time. /// property Attached : boolean read GetIsAttached; /// /// Returns the delegate associated with this View, if any. /// property Delegate : ICefViewDelegate read GetDelegate; /// /// Returns the top-level Window hosting this View, if any. /// property Window : ICefWindow read GetWindow; /// /// Returns the View that contains this View, if any. /// property ParentView : ICefView read GetParentView; /// /// Returns the bounds (size and position) of this View in DIP screen /// coordinates. /// property BoundsInScreen : TCefRect read GetBoundsInScreen; /// /// Returns the size this View would like to be if enough space is available. /// Size is in parent coordinates, or DIP screen coordinates if there is no /// parent. /// property PreferredSize : TCefSize read GetPreferredSize; /// /// Returns the minimum size for this View. Size is in parent coordinates, or /// DIP screen coordinates if there is no parent. /// property MinimumSize : TCefSize read GetMinimumSize; /// /// Returns the maximum size for this View. Size is in parent coordinates, or /// DIP screen coordinates if there is no parent. /// property MaximumSize : TCefSize read GetMaximumSize; /// /// Returns whether this View is visible. A view may be visible but still not /// drawn in a Window if any parent views are hidden. If this View is a Window /// then a return value of true (1) indicates that this Window is currently /// visible to the user on-screen. If this View is not a Window then call /// is_drawn() to determine whether this View and all parent views are visible /// and will be drawn. /// property Visible : boolean read GetIsVisible write SetVisible; /// /// Returns whether this View is visible and drawn in a Window. A view is /// drawn if it and all parent views are visible. If this View is a Window /// then calling this function is equivalent to calling is_visible(). /// Otherwise, to determine if the containing Window is visible to the user /// on-screen call is_visible() on the Window. /// property Drawn : boolean read GetIsDrawn; /// /// Get or set whether this View is enabled. A disabled View does not receive /// keyboard or mouse inputs. If |enabled| differs from the current value the /// View will be repainted. Also, clears focus if the focused View is /// disabled. /// property Enabled : boolean read GetIsEnabled write SetEnabled; /// /// Gets and sets whether this View is capable of taking focus. It will clear focus if /// the focused View is set to be non-focusable. This is false (0) by default /// so that a View used as a container does not get the focus. /// property Focusable : boolean read GetIsFocusable write SetFocusable; /// /// Return whether this View is focusable when the user requires full keyboard /// access, even though it may not be normally focusable. /// property AccessibilityFocusable : boolean read GetIsAccessibilityFocusable; /// /// Returns the background color for this View. If the background color is /// unset then the current `GetThemeColor(CEF_ColorPrimaryBackground)` value /// will be returned. If this View belongs to an overlay (created with /// ICefWindow.AddOverlayView), and the background color is unset, then a /// value of transparent (0) will be returned. /// property BackgroundColor : TCefColor read GetBackgroundColor write SetBackgroundColor; /// /// Gets or sets the ID for this View. ID should be unique within the subtree that you /// intend to search for it. 0 is the default ID for views. /// property ID : integer read GetID write SetID; /// /// Returns the group id of this View, or -1 if not set. /// property GroupID : integer read GetGroupID write SetGroupID; /// /// Returns the bounds (size and position) of this View in parent coordinates, /// or DIP screen coordinates if there is no parent. /// property Bounds : TCefRect read GetBounds write SetBounds; /// /// Returns the size of this View in parent coordinates, or DIP screen /// coordinates if there is no parent. /// property Size : TCefSize read GetSize write SetSize; /// /// Returns the position of this View. Position is in parent coordinates, or /// DIP screen coordinates if there is no parent. /// property Position : TCefPoint read GetPosition write SetPosition; /// /// Returns the insets for this View in parent coordinates, or DIP screen /// coordinates if there is no parent. /// property Insets : TCefInsets read GetInsets write SetInsets; /// /// Returns the type of this View as a string. Used primarily for testing /// purposes. /// property TypeString : ustring read GetTypeString; /// /// Returns the height necessary to display this View with the provided width. /// property HeightForWidth[width: Integer] : Integer read GetHeightForWidth; published /// /// Return the preferred size for |view|. The Layout will use this information /// to determine the display size. /// property OnGetPreferredSize : TOnGetPreferredSizeEvent read FOnGetPreferredSize write FOnGetPreferredSize; /// /// Return the minimum size for |view|. /// property OnGetMinimumSize : TOnGetMinimumSizeEvent read FOnGetMinimumSize write FOnGetMinimumSize; /// /// Return the maximum size for |view|. /// property OnGetMaximumSize : TOnGetMaximumSizeEvent read FOnGetMaximumSize write FOnGetMaximumSize; /// /// Return the height necessary to display |view| with the provided |width|. /// If not specified the result of get_preferred_size().height will be used by /// default. Override if |view|'s preferred height depends upon the width (for /// example, with Labels). /// property OnGetHeightForWidth : TOnGetHeightForWidthEvent read FOnGetHeightForWidth write FOnGetHeightForWidth; /// /// Called when the parent of |view| has changed. If |view| is being added to /// |parent| then |added| will be true (1). If |view| is being removed from /// |parent| then |added| will be false (0). If |view| is being reparented the /// remove notification will be sent before the add notification. Do not /// modify the view hierarchy in this callback. /// property OnParentViewChanged : TOnParentViewChangedEvent read FOnParentViewChanged write FOnParentViewChanged; /// /// Called when a child of |view| has changed. If |child| is being added to /// |view| then |added| will be true (1). If |child| is being removed from /// |view| then |added| will be false (0). If |child| is being reparented the /// remove notification will be sent to the old parent before the add /// notification is sent to the new parent. Do not modify the view hierarchy /// in this callback. /// property OnChildViewChanged : TOnChildViewChangedEvent read FOnChildViewChanged write FOnChildViewChanged; /// /// Called when |view| is added or removed from the ICefWindow. /// property OnWindowChanged : TOnWindowChangedEvent read FOnWindowChanged write FOnWindowChanged; /// /// Called when the layout of |view| has changed. /// property OnLayoutChanged : TOnLayoutChangedEvent read FOnLayoutChanged write FOnLayoutChanged; /// /// Called when |view| gains focus. /// property OnFocus : TOnFocusEvent read FOnFocus write FOnFocus; /// /// Called when |view| loses focus. /// property OnBlur : TOnBlurEvent read FOnBlur write FOnBlur; /// /// Called when the theme for |view| has changed, after the new theme colors /// have already been applied. Views are notified via the component hierarchy /// in depth-first reverse order (children before parents). /// This will be called in the following cases: /// /// 1. When |view|, or a parent of |view|, is added to a Window. /// 2. When the native/OS or Chrome theme changes for the Window that contains /// |view|. See ICefWindowDelegate.OnThemeColorsChanged documentation. /// 3. When the client explicitly calls ICefWindow.ThemeChanged on the /// Window that contains |view|. /// /// Optionally use this callback to override the new per-View theme colors by /// calling ICefView.SetBackgroundColor or the appropriate component- /// specific function. See ICefWindow.SetThemeColor documentation for how /// to customize additional Window theme colors. /// property OnThemeChanged : TOnThemeChangedEvent read FOnThemeChanged write FOnThemeChanged; end; // ********************************************************* // ********************** ATTENTION ! ********************** // ********************************************************* // ** ** // ** MANY OF THE EVENTS IN CEF4DELPHI COMPONENTS LIKE ** // ** TCHROMIUM, TFMXCHROMIUM OR TCEFAPPLICATION ARE ** // ** EXECUTED IN A CEF THREAD BY DEFAULT. ** // ** ** // ** WINDOWS CONTROLS MUST BE CREATED AND DESTROYED IN ** // ** THE SAME THREAD TO AVOID ERRORS. ** // ** SOME OF THEM RECREATE THE HANDLERS IF THEY ARE ** // ** MODIFIED AND CAN CAUSE THE SAME ERRORS. ** // ** ** // ** DON'T CREATE, MODIFY OR DESTROY WINDOWS CONTROLS ** // ** INSIDE THE CEF4DELPHI EVENTS AND USE ** // ** SYNCHRONIZATION OBJECTS TO PROTECT VARIABLES AND ** // ** FIELDS IF THEY ARE ALSO USED IN THE MAIN THREAD. ** // ** ** // ** READ THIS FOR MORE INFORMATION : ** // ** https://www.briskbard.com/index.php?pageid=cef ** // ** ** // ** USE OUR FORUMS FOR MORE QUESTIONS : ** // ** https://www.briskbard.com/forum/ ** // ** ** // ********************************************************* // ********************************************************* implementation uses uCEFViewDelegate, uCEFMiscFunctions, uCEFTask, uCEFApplicationCore; constructor TCEFViewComponent.Create(AOwner: TComponent); begin inherited Create(aOwner); Initialize; FComponentID := 0; end; procedure TCEFViewComponent.AfterConstruction; begin inherited AfterConstruction; if assigned(GlobalCEFApp) then FComponentID := GlobalCEFApp.NextComponentID; end; procedure TCEFViewComponent.BeforeDestruction; begin if assigned(GlobalCEFApp) then GlobalCEFApp.RemoveComponentID(FComponentID); DestroyView; inherited BeforeDestruction; end; procedure TCEFViewComponent.Initialize; begin FOnGetPreferredSize := nil; FOnGetMinimumSize := nil; FOnGetMaximumSize := nil; FOnGetHeightForWidth := nil; FOnParentViewChanged := nil; FOnChildViewChanged := nil; FOnWindowChanged := nil; FOnLayoutChanged := nil; FOnFocus := nil; FOnBlur := nil; FOnThemeChanged := nil; end; procedure TCEFViewComponent.CreateView; var TempTask : ICefTask; begin if CefCurrentlyOn(TID_UI) then doCreateCustomView else try TempTask := TCefCreateCustomViewTask.Create(self); CefPostTask(TID_UI, TempTask); finally TempTask := nil; end; end; procedure TCEFViewComponent.DestroyView; begin // end; function TCEFViewComponent.GetInitialized : boolean; begin Result := False; end; function TCEFViewComponent.GetComponentID : integer; begin Result := FComponentID; end; function TCEFViewComponent.GetAsView : ICefView; begin Result := nil; end; function TCEFViewComponent.GetAsBrowserView : ICefBrowserView; begin if Initialized then Result := AsView.AsBrowserView else Result := nil; end; function TCEFViewComponent.GetAsButton : ICefButton; begin if Initialized then Result := AsView.AsButton else Result := nil; end; function TCEFViewComponent.GetAsPanel : ICefPanel; begin if Initialized then Result := AsView.AsPanel else Result := nil; end; function TCEFViewComponent.GetAsScrollView : ICefScrollView; begin if Initialized then Result := AsView.AsScrollView else Result := nil; end; function TCEFViewComponent.GetAsTextfield : ICefTextfield; begin if Initialized then Result := AsView.AsTextfield else Result := nil; end; function TCEFViewComponent.GetTypeString : ustring; begin if Initialized then Result := AsView.GetTypeString else Result := ''; end; function TCEFViewComponent.ToStringEx(include_children: boolean): ustring; begin if Initialized then Result := AsView.ToStringEx(include_children) else Result := ''; end; function TCEFViewComponent.GetIsValid : boolean; begin Result := Initialized and AsView.IsValid; end; function TCEFViewComponent.GetIsAttached : boolean; begin Result := Initialized and AsView.IsAttached; end; function TCEFViewComponent.IsSame(const that: ICefView): boolean; begin if Initialized then Result := AsView.IsSame(that) else Result := False; end; function TCEFViewComponent.GetDelegate : ICefViewDelegate; begin if Initialized then Result := AsView.GetDelegate else Result := nil; end; function TCEFViewComponent.GetWindow : ICefWindow; begin if Initialized then Result := AsView.GetWindow else Result := nil; end; function TCEFViewComponent.GetID : Integer; begin if Initialized then Result := AsView.GetID else Result := 0; end; procedure TCEFViewComponent.SetID(id_: Integer); begin if Initialized then AsView.SetID(id_); end; function TCEFViewComponent.GetGroupID : Integer; begin if Initialized then Result := AsView.GetGroupID else Result := -1; end; procedure TCEFViewComponent.SetGroupID(group_id: Integer); begin if Initialized then AsView.SetGroupID(group_id); end; function TCEFViewComponent.GetParentView : ICefView; begin if Initialized then Result := AsView.GetParentView else Result := nil; end; function TCEFViewComponent.GetViewForID(id_: Integer): ICefView; begin if Initialized then Result := AsView.GetViewForID(id_) else Result := nil; end; procedure TCEFViewComponent.SetBounds(const bounds_: TCefRect); begin if Initialized then AsView.SetBounds(bounds_); end; function TCEFViewComponent.GetBounds : TCefRect; var TempRect : TCefRect; begin if Initialized then TempRect := AsView.GetBounds else begin TempRect.x := 0; TempRect.y := 0; TempRect.width := 0; TempRect.height := 0; end; Result := TempRect; end; function TCEFViewComponent.GetBoundsInScreen : TCefRect; var TempRect : TCefRect; begin if Initialized then TempRect := AsView.GetBoundsInScreen else begin TempRect.x := 0; TempRect.y := 0; TempRect.width := 0; TempRect.height := 0; end; Result := TempRect; end; procedure TCEFViewComponent.SetSize(const size_: TCefSize); begin if Initialized then AsView.SetSize(size_); end; function TCEFViewComponent.GetSize : TCefSize; var TempSize : TCefSize; begin if Initialized then TempSize := AsView.GetSize else begin TempSize.width := 0; TempSize.height := 0; end; Result := TempSize; end; procedure TCEFViewComponent.SetPosition(const position_: TCefPoint); begin if Initialized then AsView.SetPosition(position_); end; function TCEFViewComponent.GetPosition : TCefPoint; var TempPoint : TCefPoint; begin if Initialized then TempPoint := AsView.GetPosition else begin TempPoint.x := 0; TempPoint.y := 0; end; Result := TempPoint; end; function TCEFViewComponent.GetPreferredSize : TCefSize; var TempSize : TCefSize; begin if Initialized then TempSize := AsView.GetPreferredSize else begin TempSize.width := 0; TempSize.height := 0; end; Result := TempSize; end; procedure TCEFViewComponent.SizeToPreferredSize; begin if Initialized then AsView.SizeToPreferredSize; end; function TCEFViewComponent.GetMinimumSize : TCefSize; var TempSize : TCefSize; begin if Initialized then TempSize := AsView.GetMinimumSize else begin TempSize.width := 0; TempSize.height := 0; end; Result := TempSize; end; function TCEFViewComponent.GetMaximumSize : TCefSize; var TempSize : TCefSize; begin if Initialized then TempSize := AsView.GetMaximumSize else begin TempSize.width := 0; TempSize.height := 0; end; Result := TempSize; end; function TCEFViewComponent.GetHeightForWidth(width: Integer): Integer; begin if Initialized then Result := AsView.GetHeightForWidth(width) else Result := 0; end; function TCEFViewComponent.GetInsets: TCefInsets; begin if Initialized then Result := AsView.GetInsets else begin Result.top := 0; Result.left := 0; Result.bottom := 0; Result.right := 0; end; end; procedure TCEFViewComponent.InvalidateLayout; begin if Initialized then AsView.InvalidateLayout; end; procedure TCEFViewComponent.SetVisible(visible_: boolean); begin if Initialized then AsView.SetVisible(visible_); end; function TCEFViewComponent.GetIsVisible : boolean; begin Result := Initialized and AsView.IsVisible; end; function TCEFViewComponent.GetIsDrawn : boolean; begin Result := Initialized and AsView.IsDrawn; end; procedure TCEFViewComponent.SetEnabled(enabled_: boolean); begin if Initialized then AsView.SetEnabled(enabled_); end; function TCEFViewComponent.GetIsEnabled : boolean; begin Result := Initialized and AsView.IsEnabled; end; procedure TCEFViewComponent.SetFocusable(focusable_: boolean); begin if Initialized then AsView.SetFocusable(focusable_); end; function TCEFViewComponent.GetIsFocusable : boolean; begin Result := Initialized and AsView.IsFocusable; end; function TCEFViewComponent.GetIsAccessibilityFocusable : boolean; begin Result := Initialized and AsView.IsAccessibilityFocusable; end; procedure TCEFViewComponent.RequestFocus; begin if Initialized then AsView.RequestFocus; end; procedure TCEFViewComponent.SetBackgroundColor(color: TCefColor); begin if Initialized then AsView.SetBackgroundColor(color); end; procedure TCEFViewComponent.SetInsets(const insets: TCefInsets); begin if Initialized then AsView.SetInsets(insets); end; function TCEFViewComponent.GetBackgroundColor : TCefColor; begin if Initialized then Result := AsView.GetBackgroundColor else Result := 0; end; function TCEFViewComponent.GetThemeColor(color_id: integer): TCefColor; begin if Initialized then Result := AsView.GetThemeColor(color_id) else Result := 0; end; function TCEFViewComponent.ConvertPointToScreen(var point: TCefPoint): boolean; begin Result := Initialized and AsView.ConvertPointToScreen(point); end; function TCEFViewComponent.ConvertPointFromScreen(var point: TCefPoint): boolean; begin Result := Initialized and AsView.ConvertPointFromScreen(point); end; function TCEFViewComponent.ConvertPointToWindow(var point: TCefPoint): boolean; begin Result := Initialized and AsView.ConvertPointToWindow(point); end; function TCEFViewComponent.ConvertPointFromWindow(var point: TCefPoint): boolean; begin Result := Initialized and AsView.ConvertPointFromWindow(point); end; function TCEFViewComponent.ConvertPointToView(const view : ICefView; var point: TCefPoint): boolean; begin Result := Initialized and AsView.ConvertPointToView(view, point); end; function TCEFViewComponent.ConvertPointFromView(const view : ICefView; var point: TCefPoint): boolean; begin Result := Initialized and AsView.ConvertPointFromView(view, point); end; procedure TCEFViewComponent.doOnGetPreferredSize(const view : ICefView; var aResult : TCefSize); begin if assigned(FOnGetPreferredSize) then FOnGetPreferredSize(self, view, aResult); end; procedure TCEFViewComponent.doOnGetMinimumSize(const view : ICefView; var aResult : TCefSize); begin if assigned(FOnGetMinimumSize) then FOnGetMinimumSize(self, view, aResult); end; procedure TCEFViewComponent.doOnGetMaximumSize(const view : ICefView; var aResult : TCefSize); begin if assigned(FOnGetMaximumSize) then FOnGetMaximumSize(self, view, aResult); end; procedure TCEFViewComponent.doOnGetHeightForWidth(const view : ICefView; width : Integer; var aResult : Integer); begin if assigned(FOnGetHeightForWidth) then FOnGetHeightForWidth(self, view, width, aResult); end; procedure TCEFViewComponent.doOnParentViewChanged(const view : ICefView; added : boolean; const parent : ICefView); begin if assigned(FOnParentViewChanged) then FOnParentViewChanged(self, view, added, Parent); end; procedure TCEFViewComponent.doOnChildViewChanged(const view : ICefView; added : boolean; const child : ICefView); begin if assigned(FOnChildViewChanged) then FOnChildViewChanged(self, view, added, child); end; procedure TCEFViewComponent.doOnWindowChanged(const view : ICefView; added : boolean); begin if assigned(FOnWindowChanged) then FOnWindowChanged(self, view, added); end; procedure TCEFViewComponent.doOnLayoutChanged(const view: ICefView; new_bounds: TCefRect); begin if assigned(FOnLayoutChanged) then FOnLayoutChanged(self, view, new_bounds); end; procedure TCEFViewComponent.doOnFocus(const view: ICefView); begin if assigned(FOnFocus) then FOnFocus(self, view); end; procedure TCEFViewComponent.doOnBlur(const view: ICefView); begin if assigned(FOnBlur) then FOnBlur(self, view); end; procedure TCEFViewComponent.doOnThemeChanged(const view: ICefView); begin if assigned(FOnThemeChanged) then FOnThemeChanged(self, view); end; procedure TCEFViewComponent.doCreateCustomView; begin // end; end.