# Class TCefWindowRef

Description
Hierarchy
Methods

## Unit

uCEFWindow

## Declaration

`type TCefWindowRef = class(TCefPanelRef, ICefWindow)`

## Description

A Window is a top-level Window/widget in the Views hierarchy. By default it will have a non-client area with title bar, icon and buttons that supports moving and resizing. All size and position values are in density independent pixels (DIP) unless otherwise indicated. Methods must be called on the browser process UI thread unless otherwise indicated.

## Hierarchy

- TInterfacedObject
- TCefBaseRefCountedRef
- TCefViewRef
- TCefPanelRef
- TCefWindowRef

## Overview

### Methods

Protected | `procedure Show;`
Protected | `procedure ShowAsBrowserModalDialog(const browser_view: ICefBrowserView);`
Protected | `procedure Hide;`
Protected | `procedure CenterWindow(const size_: TCefSize);`
Protected | `procedure Close;`
Protected | `function IsClosed: boolean;`
Protected | `procedure Activate;`
Protected | `procedure Deactivate;`
Protected | `function IsActive: boolean;`
Protected | `procedure BringToTop;`
Protected | `procedure SetAlwaysOnTop(on_top: boolean);`
Protected | `function IsAlwaysOnTop: boolean;`
Protected | `procedure Maximize;`
Protected | `procedure Minimize;`
Protected | `procedure Restore;`
Protected | `procedure SetFullscreen(fullscreen: boolean);`
Protected | `function IsMaximized: boolean;`
Protected | `function IsMinimized: boolean;`
Protected | `function IsFullscreen: boolean;`
Protected | `function GetFocusedView: ICefView;`
Protected | `procedure SetTitle(const title_: ustring);`
Protected | `function GetTitle: ustring;`
Protected | `procedure SetWindowIcon(const image: ICefImage);`
Protected | `function GetWindowIcon: ICefImage;`
Protected | `procedure SetWindowAppIcon(const image: ICefImage);`
Protected | `function GetWindowAppIcon: ICefImage;`
Protected | `function AddOverlayView(const view: ICefView; docking_mode: TCefDockingMode; can_activate: boolean): ICefOverlayController;`
Protected | `procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position : TCefMenuAnchorPosition);`
Protected | `procedure CancelMenu;`
Protected | `function GetDisplay: ICefDisplay;`
Protected | `function GetClientAreaBoundsInScreen: TCefRect;`
Protected | `procedure SetDraggableRegions(regionsCount: NativeUInt; const regions: PCefDraggableRegionArray);`
Protected | `function GetWindowHandle: TCefWindowHandle;`
Protected | `procedure SendKeyPress(key_code: Integer; event_flags: cardinal);`
Protected | `procedure SendMouseMove(screen_x, screen_y: Integer);`
Protected | `procedure SendMouseEvents(button: TCefMouseButtonType; mouse_down, mouse_up: boolean);`
Protected | `procedure SetAccelerator(command_id, key_code : Integer; shift_pressed, ctrl_pressed, alt_pressed, high_priority: boolean);`
Protected | `procedure RemoveAccelerator(command_id: Integer);`
Protected | `procedure RemoveAllAccelerators;`
Protected | `procedure SetThemeColor(color_id: integer; color: TCefColor);`
Protected | `procedure ThemeChanged;`
Protected | `function GetRuntimeStyle: TCefRuntimeStyle;`
Public | `class function UnWrap(data: Pointer): ICefWindow;`
Public | `class function CreateTopLevel(const delegate: ICefWindowDelegate): ICefWindow;`

## Description

### Methods

Protected | `procedure Show;`
Show the Window.

Protected | `procedure ShowAsBrowserModalDialog(const browser_view: ICefBrowserView);`
Show the Window as a browser modal dialog relative to |browser_view|. A parent Window must be returned via cef_window_delegate_t::get_parent_window() and |browser_view| must belong to that parent Window. While this Window is visible, |browser_view| will be disabled while other controls in the parent Window remain enabled. Navigating or destroying the |browser_view| will close this Window automatically. Alternately, use show() and return true (1) from cef_window_delegate_t::is_window_modal_dialog() for a window modal dialog where all controls in the parent Window are disabled.

Protected | `procedure Hide;`
Hide the Window.

Protected | `procedure CenterWindow(const size_: TCefSize);`
Sizes the Window to |size| and centers it in the current display.

Protected | `procedure Close;`
Close the Window.

Protected | `function IsClosed: boolean;`
Returns true (1) if the Window has been closed.

Protected | `procedure Activate;`
Activate the Window, assuming it already exists and is visible.

Protected | `procedure Deactivate;`
Deactivate the Window, making the next Window in the Z order the active Window.

Protected | `function IsActive: boolean;`
Returns whether the Window is the currently active Window.

Protected | `procedure BringToTop;`
Bring this Window to the top of other Windows in the Windowing system.

Protected | `procedure SetAlwaysOnTop(on_top: boolean);`
Set the Window to be on top of other Windows in the Windowing system.

Protected | `function IsAlwaysOnTop: boolean;`
Returns whether the Window has been set to be on top of other Windows in the Windowing system.

Protected | `procedure Maximize;`
Maximize the Window.

Protected | `procedure Minimize;`
Minimize the Window.

Protected | `procedure Restore;`
Restore the Window.

Protected | `procedure SetFullscreen(fullscreen: boolean);`
Set fullscreen Window state. The ICefWindowDelegate.OnWindowFullscreenTransition function will be called during the fullscreen transition for notification purposes.

Protected | `function IsMaximized: boolean;`
Returns true (1) if the Window is maximized.

Protected | `function IsMinimized: boolean;`
Returns true (1) if the Window is minimized.

Protected | `function IsFullscreen: boolean;`
Returns true (1) if the Window is fullscreen.

Protected | `function GetFocusedView: ICefView;`
Returns the View that currently has focus in this Window, or nullptr if no View currently has focus. A Window may have a focused View even if it is not currently active. Any focus changes while a Window is not active may be applied after that Window next becomes active.

Protected | `procedure SetTitle(const title_: ustring);`
Set the Window title.

Protected | `function GetTitle: ustring;`
Get the Window title.

Protected | `procedure SetWindowIcon(const image: ICefImage);`
Set the Window icon. This should be a 16x16 icon suitable for use in the Windows's title bar.

Protected | `function GetWindowIcon: ICefImage;`
Get the Window icon.

Protected | `procedure SetWindowAppIcon(const image: ICefImage);`
Set the Window App icon. This should be a larger icon for use in the host environment app switching UI. On Windows, this is the ICON_BIG used in Alt-Tab list and Windows taskbar. The Window icon will be used by default if no Window App icon is specified.

Protected | `function GetWindowAppIcon: ICefImage;`
Get the Window App icon.

Protected | `function AddOverlayView(const view: ICefView; docking_mode: TCefDockingMode; can_activate: boolean): ICefOverlayController;`
Add a View that will be overlayed on the Window contents with absolute positioning and high z-order. Positioning is controlled by |docking_mode| as described below. Setting |can_activate| to true (1) will allow the overlay view to receive input focus. The returned cef_overlay_controller_t object is used to control the overlay. Overlays are hidden by default. With CEF_DOCKING_MODE_CUSTOM:
    1. The overlay is initially hidden, sized to |view|'s preferred size,
       and positioned in the top-left corner.
    2. Optionally change the overlay position and/or size by calling
       CefOverlayController methods.
    3. Call CefOverlayController::SetVisible(true) to show the overlay.
    4. The overlay will be automatically re-sized if |view|'s layout
       changes. Optionally change the overlay position and/or size when
       OnLayoutChanged is called on the Window's delegate to indicate a
       change in Window bounds.
With other docking modes:
    1. The overlay is initially hidden, sized to |view|'s preferred size,
       and positioned based on |docking_mode|.
    2. Call CefOverlayController::SetVisible(true) to show the overlay.
    3. The overlay will be automatically re-sized if |view|'s layout changes
       and re-positioned as appropriate when the Window resizes.
Overlays created by this function will receive a higher z-order then any child Views added previously. It is therefore recommended to call this function last after all other child Views have been added so that the overlay displays as the top-most child of the Window.

Protected | `procedure ShowMenu(const menu_model: ICefMenuModel; const screen_point: TCefPoint; anchor_position : TCefMenuAnchorPosition);`
Show a menu with contents |menu_model|. |screen_point| specifies the menu position in screen coordinates. |anchor_position| specifies how the menu will be anchored relative to |screen_point|.

Protected | `procedure CancelMenu;`
Cancel the menu that is currently showing, if any.

Protected | `function GetDisplay: ICefDisplay;`
Returns the Display that most closely intersects the bounds of this Window. May return NULL if this Window is not currently displayed.

Protected | `function GetClientAreaBoundsInScreen: TCefRect;`
Returns the bounds (size and position) of this Window's client area. Position is in screen coordinates.

Protected | `procedure SetDraggableRegions(regionsCount: NativeUInt; const regions: PCefDraggableRegionArray);`
Set the regions where mouse events will be intercepted by this Window to support drag operations. Call this function with an NULL vector to clear the draggable regions. The draggable region bounds should be in window coordinates.

Protected | `function GetWindowHandle: TCefWindowHandle;`
Retrieve the platform window handle for this Window.

Protected | `procedure SendKeyPress(key_code: Integer; event_flags: cardinal);`
Simulate a key press. |key_code| is the VKEY_* value from Chromium's ui/events/keycodes/keyboard_codes.h header (VK_* values on Windows). |event_flags| is some combination of EVENTFLAG_SHIFT_DOWN, EVENTFLAG_CONTROL_DOWN and/or EVENTFLAG_ALT_DOWN. This function is exposed primarily for testing purposes.

Protected | `procedure SendMouseMove(screen_x, screen_y: Integer);`
Simulate a mouse move. The mouse cursor will be moved to the specified (screen_x, screen_y) position. This function is exposed primarily for testing purposes.

Protected | `procedure SendMouseEvents(button: TCefMouseButtonType; mouse_down, mouse_up: boolean);`
Simulate mouse down and/or mouse up events. |button| is the mouse button type. If |mouse_down| is true (1) a mouse down event will be sent. If |mouse_up| is true (1) a mouse up event will be sent. If both are true (1) a mouse down event will be sent followed by a mouse up event (equivalent to clicking the mouse button). The events will be sent using the current cursor position so make sure to call send_mouse_move() first to position the mouse. This function is exposed primarily for testing purposes.

Protected | `procedure SetAccelerator(command_id, key_code : Integer; shift_pressed, ctrl_pressed, alt_pressed, high_priority: boolean);`
Set the keyboard accelerator for the specified |command_id|. |key_code| can be any virtual key or character value. Required modifier keys are specified by |shift_pressed|, |ctrl_pressed| and/or |alt_pressed|. ICefWindowDelegate.OnAccelerator will be called if the keyboard combination is triggered while this window has focus. The |high_priority| value will be considered if a child ICefBrowserView has focus when the keyboard combination is triggered. If |high_priority| is true (1) then the key event will not be forwarded to the web content (`keydown` event handler) or ICefKeyboardHandler first. If |high_priority| is false (0) then the behavior will depend on the ICefBrowserView.SetPreferAccelerators configuration.

Protected | `procedure RemoveAccelerator(command_id: Integer);`
Remove the keyboard accelerator for the specified |command_id|.

Protected | `procedure RemoveAllAccelerators;`
Remove all keyboard accelerators.

Protected | `procedure SetThemeColor(color_id: integer; color: TCefColor);`
Override a standard theme color or add a custom color associated with |color_id|. See cef_color_ids.h for standard ID values. Recommended usage is as follows:
    1. Customize the default native/OS theme by calling SetThemeColor before
       showing the first Window. When done setting colors call
       ICefWindow.ThemeChanged to trigger ICefViewDelegate.OnThemeChanged
       notifications.
    2. Customize the current native/OS or Chrome theme after it changes by
       calling SetThemeColor from the ICefWindowDelegate.OnThemeColorsChanged
       callback. ICefViewDelegate.OnThemeChanged notifications will then be
       triggered automatically.
The configured color will be available immediately via ICefView.GetThemeColor and will be applied to each View in this Window's component hierarchy when ICefViewDelegate.OnThemeChanged is called. See OnThemeColorsChanged documentation for additional details. Clients wishing to add custom colors should use |color_id| values >= CEF_ChromeColorsEnd.

Protected | `procedure ThemeChanged;`
Trigger ICefViewDelegate.OnThemeChanged callbacks for each View in this Window's component hierarchy. Unlike a native/OS or Chrome theme change this function does not reset theme colors to standard values and does not result in a call to ICefWindowDelegate.OnThemeColorsChanged. Do not call this function from ICefViewDelegate.OnThemeColorsChanged or ICefViewDelegate.OnThemeChanged.

Protected | `function GetRuntimeStyle: TCefRuntimeStyle;`
Returns the runtime style for this Window (ALLOY or CHROME). See TCefRuntimeStyle documentation for details.

Public | `class function UnWrap(data: Pointer): ICefWindow;`
Returns a ICefWindow instance using a PCefWindow data pointer.

Public | `class function CreateTopLevel(const delegate: ICefWindowDelegate): ICefWindow;`
Create a new Window.

Generated by PasDoc 1.0.4.