Chromium Embedded Framework (CEF)  121.0.1+g7a4b55f+chromium-121.0.6167.16
CefWindow Class Referenceabstract

A Window is a top-level Window/widget in the Views hierarchy. More...

#include "include/views/cef_window.h"

Inheritance diagram for CefWindow:
CefPanel CefView CefBaseRefCounted

Public Member Functions

virtual void Show ()=0
 Show the Window. More...
 
virtual void ShowAsBrowserModalDialog (CefRefPtr< CefBrowserView > browser_view)=0
 Show the Window as a browser modal dialog relative to |browser_view|. More...
 
virtual void Hide ()=0
 Hide the Window. More...
 
virtual void CenterWindow (const CefSize &size)=0
 Sizes the Window to |size| and centers it in the current display. More...
 
virtual void Close ()=0
 Close the Window. More...
 
virtual bool IsClosed ()=0
 Returns true if the Window has been closed. More...
 
virtual void Activate ()=0
 Activate the Window, assuming it already exists and is visible. More...
 
virtual void Deactivate ()=0
 Deactivate the Window, making the next Window in the Z order the active Window. More...
 
virtual bool IsActive ()=0
 Returns whether the Window is the currently active Window. More...
 
virtual void BringToTop ()=0
 Bring this Window to the top of other Windows in the Windowing system. More...
 
virtual void SetAlwaysOnTop (bool on_top)=0
 Set the Window to be on top of other Windows in the Windowing system. More...
 
virtual bool IsAlwaysOnTop ()=0
 Returns whether the Window has been set to be on top of other Windows in the Windowing system. More...
 
virtual void Maximize ()=0
 Maximize the Window. More...
 
virtual void Minimize ()=0
 Minimize the Window. More...
 
virtual void Restore ()=0
 Restore the Window. More...
 
virtual void SetFullscreen (bool fullscreen)=0
 Set fullscreen Window state. More...
 
virtual bool IsMaximized ()=0
 Returns true if the Window is maximized. More...
 
virtual bool IsMinimized ()=0
 Returns true if the Window is minimized. More...
 
virtual bool IsFullscreen ()=0
 Returns true if the Window is fullscreen. More...
 
virtual void SetTitle (const CefString &title)=0
 Set the Window title. More...
 
virtual CefString GetTitle ()=0
 Get the Window title. More...
 
virtual void SetWindowIcon (CefRefPtr< CefImage > image)=0
 Set the Window icon. More...
 
virtual CefRefPtr< CefImageGetWindowIcon ()=0
 Get the Window icon. More...
 
virtual void SetWindowAppIcon (CefRefPtr< CefImage > image)=0
 Set the Window App icon. More...
 
virtual CefRefPtr< CefImageGetWindowAppIcon ()=0
 Get the Window App icon. More...
 
virtual CefRefPtr< CefOverlayControllerAddOverlayView (CefRefPtr< CefView > view, cef_docking_mode_t docking_mode)=0
 Add a View that will be overlayed on the Window contents with absolute positioning and high z-order. More...
 
virtual void ShowMenu (CefRefPtr< CefMenuModel > menu_model, const CefPoint &screen_point, cef_menu_anchor_position_t anchor_position)=0
 Show a menu with contents |menu_model|. More...
 
virtual void CancelMenu ()=0
 Cancel the menu that is currently showing, if any. More...
 
virtual CefRefPtr< CefDisplayGetDisplay ()=0
 Returns the Display that most closely intersects the bounds of this Window. More...
 
virtual CefRect GetClientAreaBoundsInScreen ()=0
 Returns the bounds (size and position) of this Window's client area. More...
 
virtual void SetDraggableRegions (const std::vector< CefDraggableRegion > &regions)=0
 Set the regions where mouse events will be intercepted by this Window to support drag operations. More...
 
virtual CefWindowHandle GetWindowHandle ()=0
 Retrieve the platform window handle for this Window. More...
 
virtual void SendKeyPress (int key_code, uint32_t event_flags)=0
 Simulate a key press. More...
 
virtual void SendMouseMove (int screen_x, int screen_y)=0
 Simulate a mouse move. More...
 
virtual void SendMouseEvents (cef_mouse_button_type_t button, bool mouse_down, bool mouse_up)=0
 Simulate mouse down and/or mouse up events. More...
 
virtual void SetAccelerator (int command_id, int key_code, bool shift_pressed, bool ctrl_pressed, bool alt_pressed, bool high_priority)=0
 Set the keyboard accelerator for the specified |command_id|. More...
 
virtual void RemoveAccelerator (int command_id)=0
 Remove the keyboard accelerator for the specified |command_id|. More...
 
virtual void RemoveAllAccelerators ()=0
 Remove all keyboard accelerators. More...
 
- Public Member Functions inherited from CefPanel
virtual CefRefPtr< CefWindowAsWindow ()=0
 Returns this Panel as a Window or NULL if this is not a Window. More...
 
virtual CefRefPtr< CefFillLayoutSetToFillLayout ()=0
 Set this Panel's Layout to FillLayout and return the FillLayout object. More...
 
virtual CefRefPtr< CefBoxLayoutSetToBoxLayout (const CefBoxLayoutSettings &settings)=0
 Set this Panel's Layout to BoxLayout and return the BoxLayout object. More...
 
virtual CefRefPtr< CefLayoutGetLayout ()=0
 Get the Layout. More...
 
virtual void Layout ()=0
 Lay out the child Views (set their bounds based on sizing heuristics specific to the current Layout). More...
 
virtual void AddChildView (CefRefPtr< CefView > view)=0
 Add a child View. More...
 
virtual void AddChildViewAt (CefRefPtr< CefView > view, int index)=0
 Add a child View at the specified |index|. More...
 
virtual void ReorderChildView (CefRefPtr< CefView > view, int index)=0
 Move the child View to the specified |index|. More...
 
virtual void RemoveChildView (CefRefPtr< CefView > view)=0
 Remove a child View. More...
 
virtual void RemoveAllChildViews ()=0
 Remove all child Views. More...
 
virtual size_t GetChildViewCount ()=0
 Returns the number of child Views. More...
 
virtual CefRefPtr< CefViewGetChildViewAt (int index)=0
 Returns the child View at the specified |index|. More...
 
- Public Member Functions inherited from CefView
virtual CefRefPtr< CefBrowserViewAsBrowserView ()=0
 Returns this View as a BrowserView or NULL if this is not a BrowserView. More...
 
virtual CefRefPtr< CefButtonAsButton ()=0
 Returns this View as a Button or NULL if this is not a Button. More...
 
virtual CefRefPtr< CefPanelAsPanel ()=0
 Returns this View as a Panel or NULL if this is not a Panel. More...
 
virtual CefRefPtr< CefScrollViewAsScrollView ()=0
 Returns this View as a ScrollView or NULL if this is not a ScrollView. More...
 
virtual CefRefPtr< CefTextfieldAsTextfield ()=0
 Returns this View as a Textfield or NULL if this is not a Textfield. More...
 
virtual CefString GetTypeString ()=0
 Returns the type of this View as a string. More...
 
virtual CefString ToString (bool include_children)=0
 Returns a string representation of this View which includes the type and various type-specific identifying attributes. More...
 
virtual bool IsValid ()=0
 Returns true if this View is valid. More...
 
virtual bool IsAttached ()=0
 Returns true if this View is currently attached to another View. More...
 
virtual bool IsSame (CefRefPtr< CefView > that)=0
 Returns true if this View is the same as |that| View. More...
 
virtual CefRefPtr< CefViewDelegateGetDelegate ()=0
 Returns the delegate associated with this View, if any. More...
 
virtual CefRefPtr< CefWindowGetWindow ()=0
 Returns the top-level Window hosting this View, if any. More...
 
virtual int GetID ()=0
 Returns the ID for this View. More...
 
virtual void SetID (int id)=0
 Sets the ID for this View. More...
 
virtual int GetGroupID ()=0
 Returns the group id of this View, or -1 if not set. More...
 
virtual void SetGroupID (int group_id)=0
 A group id is used to tag Views which are part of the same logical group. More...
 
virtual CefRefPtr< CefViewGetParentView ()=0
 Returns the View that contains this View, if any. More...
 
virtual CefRefPtr< CefViewGetViewForID (int id)=0
 Recursively descends the view tree starting at this View, and returns the first child that it encounters with the given ID. More...
 
virtual void SetBounds (const CefRect &bounds)=0
 Sets the bounds (size and position) of this View. More...
 
virtual CefRect GetBounds ()=0
 Returns the bounds (size and position) of this View in parent coordinates, or DIP screen coordinates if there is no parent. More...
 
virtual CefRect GetBoundsInScreen ()=0
 Returns the bounds (size and position) of this View in DIP screen coordinates. More...
 
virtual void SetSize (const CefSize &size)=0
 Sets the size of this View without changing the position. More...
 
virtual CefSize GetSize ()=0
 Returns the size of this View in parent coordinates, or DIP screen coordinates if there is no parent. More...
 
virtual void SetPosition (const CefPoint &position)=0
 Sets the position of this View without changing the size. More...
 
virtual CefPoint GetPosition ()=0
 Returns the position of this View. More...
 
virtual void SetInsets (const CefInsets &insets)=0
 Sets the insets for this View. More...
 
virtual CefInsets GetInsets ()=0
 Returns the insets for this View in parent coordinates, or DIP screen coordinates if there is no parent. More...
 
virtual CefSize GetPreferredSize ()=0
 Returns the size this View would like to be if enough space is available. More...
 
virtual void SizeToPreferredSize ()=0
 Size this View to its preferred size. More...
 
virtual CefSize GetMinimumSize ()=0
 Returns the minimum size for this View. More...
 
virtual CefSize GetMaximumSize ()=0
 Returns the maximum size for this View. More...
 
virtual int GetHeightForWidth (int width)=0
 Returns the height necessary to display this View with the provided width. More...
 
virtual void InvalidateLayout ()=0
 Indicate that this View and all parent Views require a re-layout. More...
 
virtual void SetVisible (bool visible)=0
 Sets whether this View is visible. More...
 
virtual bool IsVisible ()=0
 Returns whether this View is visible. More...
 
virtual bool IsDrawn ()=0
 Returns whether this View is visible and drawn in a Window. More...
 
virtual void SetEnabled (bool enabled)=0
 Set whether this View is enabled. More...
 
virtual bool IsEnabled ()=0
 Returns whether this View is enabled. More...
 
virtual void SetFocusable (bool focusable)=0
 Sets whether this View is capable of taking focus. More...
 
virtual bool IsFocusable ()=0
 Returns true if this View is focusable, enabled and drawn. More...
 
virtual bool IsAccessibilityFocusable ()=0
 Return whether this View is focusable when the user requires full keyboard access, even though it may not be normally focusable. More...
 
virtual void RequestFocus ()=0
 Request keyboard focus. More...
 
virtual void SetBackgroundColor (cef_color_t color)=0
 Sets the background color for this View. More...
 
virtual cef_color_t GetBackgroundColor ()=0
 Returns the background color for this View. More...
 
virtual bool ConvertPointToScreen (CefPoint &point)=0
 Convert |point| from this View's coordinate system to DIP screen coordinates. More...
 
virtual bool ConvertPointFromScreen (CefPoint &point)=0
 Convert |point| to this View's coordinate system from DIP screen coordinates. More...
 
virtual bool ConvertPointToWindow (CefPoint &point)=0
 Convert |point| from this View's coordinate system to that of the Window. More...
 
virtual bool ConvertPointFromWindow (CefPoint &point)=0
 Convert |point| to this View's coordinate system from that of the Window. More...
 
virtual bool ConvertPointToView (CefRefPtr< CefView > view, CefPoint &point)=0
 Convert |point| from this View's coordinate system to that of |view|. More...
 
virtual bool ConvertPointFromView (CefRefPtr< CefView > view, CefPoint &point)=0
 Convert |point| to this View's coordinate system from that |view|. More...
 
- Public Member Functions inherited from CefBaseRefCounted
virtual void AddRef () const =0
 Called to increment the reference count for the object. More...
 
virtual bool Release () const =0
 Called to decrement the reference count for the object. More...
 
virtual bool HasOneRef () const =0
 Returns true if the reference count is 1. More...
 
virtual bool HasAtLeastOneRef () const =0
 Returns true if the reference count is at least 1. More...
 

Static Public Member Functions

static CefRefPtr< CefWindowCreateTopLevelWindow (CefRefPtr< CefWindowDelegate > delegate)
 Create a new Window. More...
 
- Static Public Member Functions inherited from CefPanel
static CefRefPtr< CefPanelCreatePanel (CefRefPtr< CefPanelDelegate > delegate)
 Create a new Panel. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CefBaseRefCounted
virtual ~CefBaseRefCounted ()
 

Detailed 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.

Member Function Documentation

◆ Activate()

virtual void CefWindow::Activate ( )
pure virtual

Activate the Window, assuming it already exists and is visible.

◆ AddOverlayView()

virtual CefRefPtr<CefOverlayController> CefWindow::AddOverlayView ( CefRefPtr< CefView view,
cef_docking_mode_t  docking_mode 
)
pure virtual

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. The returned CefOverlayController 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 method will receive a higher z-order then any child Views added previously. It is therefore recommended to call this method last after all other child Views have been added so that the overlay displays as the top-most child of the Window.

◆ BringToTop()

virtual void CefWindow::BringToTop ( )
pure virtual

Bring this Window to the top of other Windows in the Windowing system.

◆ CancelMenu()

virtual void CefWindow::CancelMenu ( )
pure virtual

Cancel the menu that is currently showing, if any.

◆ CenterWindow()

virtual void CefWindow::CenterWindow ( const CefSize size)
pure virtual

Sizes the Window to |size| and centers it in the current display.

◆ Close()

virtual void CefWindow::Close ( )
pure virtual

Close the Window.

◆ CreateTopLevelWindow()

static CefRefPtr<CefWindow> CefWindow::CreateTopLevelWindow ( CefRefPtr< CefWindowDelegate delegate)
static

Create a new Window.

◆ Deactivate()

virtual void CefWindow::Deactivate ( )
pure virtual

Deactivate the Window, making the next Window in the Z order the active Window.

◆ GetClientAreaBoundsInScreen()

virtual CefRect CefWindow::GetClientAreaBoundsInScreen ( )
pure virtual

Returns the bounds (size and position) of this Window's client area.

Position is in screen coordinates.

◆ GetDisplay()

virtual CefRefPtr<CefDisplay> CefWindow::GetDisplay ( )
pure virtual

Returns the Display that most closely intersects the bounds of this Window.

May return NULL if this Window is not currently displayed.

◆ GetTitle()

virtual CefString CefWindow::GetTitle ( )
pure virtual

Get the Window title.

◆ GetWindowAppIcon()

virtual CefRefPtr<CefImage> CefWindow::GetWindowAppIcon ( )
pure virtual

Get the Window App icon.

◆ GetWindowHandle()

virtual CefWindowHandle CefWindow::GetWindowHandle ( )
pure virtual

Retrieve the platform window handle for this Window.

◆ GetWindowIcon()

virtual CefRefPtr<CefImage> CefWindow::GetWindowIcon ( )
pure virtual

Get the Window icon.

◆ Hide()

virtual void CefWindow::Hide ( )
pure virtual

Hide the Window.

◆ IsActive()

virtual bool CefWindow::IsActive ( )
pure virtual

Returns whether the Window is the currently active Window.

◆ IsAlwaysOnTop()

virtual bool CefWindow::IsAlwaysOnTop ( )
pure virtual

Returns whether the Window has been set to be on top of other Windows in the Windowing system.

◆ IsClosed()

virtual bool CefWindow::IsClosed ( )
pure virtual

Returns true if the Window has been closed.

◆ IsFullscreen()

virtual bool CefWindow::IsFullscreen ( )
pure virtual

Returns true if the Window is fullscreen.

◆ IsMaximized()

virtual bool CefWindow::IsMaximized ( )
pure virtual

Returns true if the Window is maximized.

◆ IsMinimized()

virtual bool CefWindow::IsMinimized ( )
pure virtual

Returns true if the Window is minimized.

◆ Maximize()

virtual void CefWindow::Maximize ( )
pure virtual

Maximize the Window.

◆ Minimize()

virtual void CefWindow::Minimize ( )
pure virtual

Minimize the Window.

◆ RemoveAccelerator()

virtual void CefWindow::RemoveAccelerator ( int  command_id)
pure virtual

Remove the keyboard accelerator for the specified |command_id|.

◆ RemoveAllAccelerators()

virtual void CefWindow::RemoveAllAccelerators ( )
pure virtual

Remove all keyboard accelerators.

◆ Restore()

virtual void CefWindow::Restore ( )
pure virtual

Restore the Window.

◆ SendKeyPress()

virtual void CefWindow::SendKeyPress ( int  key_code,
uint32_t  event_flags 
)
pure virtual

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 method is exposed primarily for testing purposes.

◆ SendMouseEvents()

virtual void CefWindow::SendMouseEvents ( cef_mouse_button_type_t  button,
bool  mouse_down,
bool  mouse_up 
)
pure virtual

Simulate mouse down and/or mouse up events.

|button| is the mouse button type. If |mouse_down| is true a mouse down event will be sent. If |mouse_up| is true a mouse up event will be sent. If both are true 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 SendMouseMove() first to position the mouse. This method is exposed primarily for testing purposes.

◆ SendMouseMove()

virtual void CefWindow::SendMouseMove ( int  screen_x,
int  screen_y 
)
pure virtual

Simulate a mouse move.

The mouse cursor will be moved to the specified (screen_x, screen_y) position. This method is exposed primarily for testing purposes.

◆ SetAccelerator()

virtual void CefWindow::SetAccelerator ( int  command_id,
int  key_code,
bool  shift_pressed,
bool  ctrl_pressed,
bool  alt_pressed,
bool  high_priority 
)
pure virtual

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|. CefWindowDelegate::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 CefBrowserView has focus when the keyboard combination is triggered. If |high_priority| is true then the key event will not be forwarded to the web content (keydown event handler) or CefKeyboardHandler first. If |high_priority| is false then the behavior will depend on the CefBrowserView::SetPreferAccelerators configuration.

◆ SetAlwaysOnTop()

virtual void CefWindow::SetAlwaysOnTop ( bool  on_top)
pure virtual

Set the Window to be on top of other Windows in the Windowing system.

◆ SetDraggableRegions()

virtual void CefWindow::SetDraggableRegions ( const std::vector< CefDraggableRegion > &  regions)
pure virtual

Set the regions where mouse events will be intercepted by this Window to support drag operations.

Call this method with an empty vector to clear the draggable regions. The draggable region bounds should be in window coordinates.

◆ SetFullscreen()

virtual void CefWindow::SetFullscreen ( bool  fullscreen)
pure virtual

Set fullscreen Window state.

The CefWindowDelegate::OnWindowFullscreenTransition method will be called during the fullscreen transition for notification purposes.

◆ SetTitle()

virtual void CefWindow::SetTitle ( const CefString title)
pure virtual

Set the Window title.

◆ SetWindowAppIcon()

virtual void CefWindow::SetWindowAppIcon ( CefRefPtr< CefImage image)
pure virtual

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.

◆ SetWindowIcon()

virtual void CefWindow::SetWindowIcon ( CefRefPtr< CefImage image)
pure virtual

Set the Window icon.

This should be a 16x16 icon suitable for use in the Windows's title bar.

◆ Show()

virtual void CefWindow::Show ( )
pure virtual

Show the Window.

◆ ShowAsBrowserModalDialog()

virtual void CefWindow::ShowAsBrowserModalDialog ( CefRefPtr< CefBrowserView browser_view)
pure virtual

Show the Window as a browser modal dialog relative to |browser_view|.

A parent Window must be returned via CefWindowDelegate::GetParentWindow() 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 from CefWindowDelegate::IsWindowModalDialog() for a window modal dialog where all controls in the parent Window are disabled.

◆ ShowMenu()

virtual void CefWindow::ShowMenu ( CefRefPtr< CefMenuModel menu_model,
const CefPoint screen_point,
cef_menu_anchor_position_t  anchor_position 
)
pure virtual

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|.


The documentation for this class was generated from the following file: