Chromium Embedded Framework (CEF)  130.1.2+g48f3ef6+chromium-130.0.6723.44
CefWindowDelegate Class Reference

Implement this interface to handle window events. More...

#include "include/views/cef_window_delegate.h"

Inheritance diagram for CefWindowDelegate:
CefPanelDelegate CefViewDelegate CefBaseRefCounted

Public Member Functions

virtual void OnWindowCreated (CefRefPtr< CefWindow > window)
 Called when |window| is created. More...
 
virtual void OnWindowClosing (CefRefPtr< CefWindow > window)
 Called when |window| is closing. More...
 
virtual void OnWindowDestroyed (CefRefPtr< CefWindow > window)
 Called when |window| is destroyed. More...
 
virtual void OnWindowActivationChanged (CefRefPtr< CefWindow > window, bool active)
 Called when |window| is activated or deactivated. More...
 
virtual void OnWindowBoundsChanged (CefRefPtr< CefWindow > window, const CefRect &new_bounds)
 Called when |window| bounds have changed. More...
 
virtual void OnWindowFullscreenTransition (CefRefPtr< CefWindow > window, bool is_completed)
 Called when |window| is transitioning to or from fullscreen mode. More...
 
virtual CefRefPtr< CefWindowGetParentWindow (CefRefPtr< CefWindow > window, bool *is_menu, bool *can_activate_menu)
 Return the parent for |window| or NULL if the |window| does not have a parent. More...
 
virtual bool IsWindowModalDialog (CefRefPtr< CefWindow > window)
 Return true if |window| should be created as a window modal dialog. More...
 
virtual CefRect GetInitialBounds (CefRefPtr< CefWindow > window)
 Return the initial bounds for |window| in density independent pixel (DIP) coordinates. More...
 
virtual cef_show_state_t GetInitialShowState (CefRefPtr< CefWindow > window)
 Return the initial show state for |window|. More...
 
virtual bool IsFrameless (CefRefPtr< CefWindow > window)
 Return true if |window| should be created without a frame or title bar. More...
 
virtual bool WithStandardWindowButtons (CefRefPtr< CefWindow > window)
 Return true if |window| should be created with standard window buttons like close, minimize and zoom. More...
 
virtual bool GetTitlebarHeight (CefRefPtr< CefWindow > window, float *titlebar_height)
 Return whether the titlebar height should be overridden, and sets the height of the titlebar in |titlebar_height|. More...
 
virtual cef_state_t AcceptsFirstMouse (CefRefPtr< CefWindow > window)
 Return whether the view should accept the initial mouse-down event, allowing it to respond to click-through behavior. More...
 
virtual bool CanResize (CefRefPtr< CefWindow > window)
 Return true if |window| can be resized. More...
 
virtual bool CanMaximize (CefRefPtr< CefWindow > window)
 Return true if |window| can be maximized. More...
 
virtual bool CanMinimize (CefRefPtr< CefWindow > window)
 Return true if |window| can be minimized. More...
 
virtual bool CanClose (CefRefPtr< CefWindow > window)
 Return true if |window| can be closed. More...
 
virtual bool OnAccelerator (CefRefPtr< CefWindow > window, int command_id)
 Called when a keyboard accelerator registered with CefWindow::SetAccelerator is triggered. More...
 
virtual bool OnKeyEvent (CefRefPtr< CefWindow > window, const CefKeyEvent &event)
 Called after all other controls in the window have had a chance to handle the event. More...
 
virtual void OnThemeColorsChanged (CefRefPtr< CefWindow > window, bool chrome_theme)
 Called after the native/OS or Chrome theme for |window| has changed. More...
 
virtual cef_runtime_style_t GetWindowRuntimeStyle ()
 Optionally change the runtime style for this Window. More...
 
virtual bool GetLinuxWindowProperties (CefRefPtr< CefWindow > window, CefLinuxWindowProperties &properties)
 Return Linux-specific window properties for correctly handling by window managers. More...
 
- Public Member Functions inherited from CefViewDelegate
virtual CefSize GetPreferredSize (CefRefPtr< CefView > view)
 Return the preferred size for |view|. More...
 
virtual CefSize GetMinimumSize (CefRefPtr< CefView > view)
 Return the minimum size for |view|. More...
 
virtual CefSize GetMaximumSize (CefRefPtr< CefView > view)
 Return the maximum size for |view|. More...
 
virtual int GetHeightForWidth (CefRefPtr< CefView > view, int width)
 Return the height necessary to display |view| with the provided |width|. More...
 
virtual void OnParentViewChanged (CefRefPtr< CefView > view, bool added, CefRefPtr< CefView > parent)
 Called when the parent of |view| has changed. More...
 
virtual void OnChildViewChanged (CefRefPtr< CefView > view, bool added, CefRefPtr< CefView > child)
 Called when a child of |view| has changed. More...
 
virtual void OnWindowChanged (CefRefPtr< CefView > view, bool added)
 Called when |view| is added or removed from the CefWindow. More...
 
virtual void OnLayoutChanged (CefRefPtr< CefView > view, const CefRect &new_bounds)
 Called when the layout of |view| has changed. More...
 
virtual void OnFocus (CefRefPtr< CefView > view)
 Called when |view| gains focus. More...
 
virtual void OnBlur (CefRefPtr< CefView > view)
 Called when |view| loses focus. More...
 
virtual void OnThemeChanged (CefRefPtr< CefView > view)
 Called when the theme for |view| has changed, after the new theme colors have already been applied. 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...
 

Additional Inherited Members

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

Detailed Description

Implement this interface to handle window events.

The methods of this class will be called on the browser process UI thread unless otherwise indicated.

Member Function Documentation

◆ AcceptsFirstMouse()

virtual cef_state_t CefWindowDelegate::AcceptsFirstMouse ( CefRefPtr< CefWindow window)
inlinevirtual

Return whether the view should accept the initial mouse-down event, allowing it to respond to click-through behavior.

If STATE_ENABLED is returned, the view will be sent a mouseDown: message for an initial mouse-down event, activating the view with one click, instead of clicking first to make the window active and then clicking the view.

This method is only supported on macOS. For more details, refer to the documentation of acceptsFirstMouse.

◆ CanClose()

virtual bool CefWindowDelegate::CanClose ( CefRefPtr< CefWindow window)
inlinevirtual

Return true if |window| can be closed.

This will be called for user- initiated window close actions and when CefWindow::Close() is called.

◆ CanMaximize()

virtual bool CefWindowDelegate::CanMaximize ( CefRefPtr< CefWindow window)
inlinevirtual

Return true if |window| can be maximized.

◆ CanMinimize()

virtual bool CefWindowDelegate::CanMinimize ( CefRefPtr< CefWindow window)
inlinevirtual

Return true if |window| can be minimized.

◆ CanResize()

virtual bool CefWindowDelegate::CanResize ( CefRefPtr< CefWindow window)
inlinevirtual

Return true if |window| can be resized.

◆ GetInitialBounds()

virtual CefRect CefWindowDelegate::GetInitialBounds ( CefRefPtr< CefWindow window)
inlinevirtual

Return the initial bounds for |window| in density independent pixel (DIP) coordinates.

If this method returns an empty CefRect then GetPreferredSize() will be called to retrieve the size, and the window will be placed on the screen with origin (0,0). This method can be used in combination with CefView::GetBoundsInScreen() to restore the previous window bounds.

◆ GetInitialShowState()

virtual cef_show_state_t CefWindowDelegate::GetInitialShowState ( CefRefPtr< CefWindow window)
inlinevirtual

Return the initial show state for |window|.

◆ GetLinuxWindowProperties()

virtual bool CefWindowDelegate::GetLinuxWindowProperties ( CefRefPtr< CefWindow window,
CefLinuxWindowProperties properties 
)
inlinevirtual

Return Linux-specific window properties for correctly handling by window managers.

◆ GetParentWindow()

virtual CefRefPtr<CefWindow> CefWindowDelegate::GetParentWindow ( CefRefPtr< CefWindow window,
bool *  is_menu,
bool *  can_activate_menu 
)
inlinevirtual

Return the parent for |window| or NULL if the |window| does not have a parent.

Windows with parents will not get a taskbar button. Set |is_menu| to true if |window| will be displayed as a menu, in which case it will not be clipped to the parent window bounds. Set |can_activate_menu| to false if |is_menu| is true and |window| should not be activated (given keyboard focus) when displayed.

◆ GetTitlebarHeight()

virtual bool CefWindowDelegate::GetTitlebarHeight ( CefRefPtr< CefWindow window,
float *  titlebar_height 
)
inlinevirtual

Return whether the titlebar height should be overridden, and sets the height of the titlebar in |titlebar_height|.

On macOS, it can also be used to adjust the vertical position of the traffic light buttons in frameless windows. The buttons will be positioned halfway down the titlebar at a height of |titlebar_height| / 2.

◆ GetWindowRuntimeStyle()

virtual cef_runtime_style_t CefWindowDelegate::GetWindowRuntimeStyle ( )
inlinevirtual

Optionally change the runtime style for this Window.

See cef_runtime_style_t documentation for details.

◆ IsFrameless()

virtual bool CefWindowDelegate::IsFrameless ( CefRefPtr< CefWindow window)
inlinevirtual

Return true if |window| should be created without a frame or title bar.

The window will be resizable if CanResize() returns true. Use CefWindow::SetDraggableRegions() to specify draggable regions.

◆ IsWindowModalDialog()

virtual bool CefWindowDelegate::IsWindowModalDialog ( CefRefPtr< CefWindow window)
inlinevirtual

Return true if |window| should be created as a window modal dialog.

Only called when a Window is returned via GetParentWindow() with |is_menu| set to false. All controls in the parent Window will be disabled while |window| is visible. This functionality is not supported by all Linux window managers. Alternately, use CefWindow::ShowAsBrowserModalDialog() for a browser modal dialog that works on all platforms.

◆ OnAccelerator()

virtual bool CefWindowDelegate::OnAccelerator ( CefRefPtr< CefWindow window,
int  command_id 
)
inlinevirtual

Called when a keyboard accelerator registered with CefWindow::SetAccelerator is triggered.

Return true if the accelerator was handled or false otherwise.

◆ OnKeyEvent()

virtual bool CefWindowDelegate::OnKeyEvent ( CefRefPtr< CefWindow window,
const CefKeyEvent event 
)
inlinevirtual

Called after all other controls in the window have had a chance to handle the event.

|event| contains information about the keyboard event. Return true if the keyboard event was handled or false otherwise.

◆ OnThemeColorsChanged()

virtual void CefWindowDelegate::OnThemeColorsChanged ( CefRefPtr< CefWindow window,
bool  chrome_theme 
)
inlinevirtual

Called after the native/OS or Chrome theme for |window| has changed.

|chrome_theme| will be true if the notification is for a Chrome theme.

Native/OS theme colors are configured globally and do not need to be customized for each Window individually. An example of a native/OS theme change that triggers this callback is when the user switches between dark and light mode during application lifespan. Native/OS theme changes can be disabled by passing the --force-dark-mode or --force-light-mode command-line flag.

Chrome theme colors will be applied and this callback will be triggered if/when a BrowserView is added to the Window's component hierarchy. Chrome theme colors can be configured on a per-RequestContext basis using CefRequestContext::SetChromeColorScheme or (Chrome style only) by visiting chrome://settings/manageProfile. Any theme changes using those mechanisms will also trigger this callback. Chrome theme colors will be persisted and restored from disk cache.

This callback is not triggered on Window creation so clients that wish to customize the initial native/OS theme must call CefWindow::SetThemeColor and CefWindow::ThemeChanged before showing the first Window.

Theme colors will be reset to standard values before this callback is called for the first affected Window. Call CefWindow::SetThemeColor from inside this callback to override a standard color or add a custom color. CefViewDelegate::OnThemeChanged will be called after this callback for the complete |window| component hierarchy.

◆ OnWindowActivationChanged()

virtual void CefWindowDelegate::OnWindowActivationChanged ( CefRefPtr< CefWindow window,
bool  active 
)
inlinevirtual

Called when |window| is activated or deactivated.

◆ OnWindowBoundsChanged()

virtual void CefWindowDelegate::OnWindowBoundsChanged ( CefRefPtr< CefWindow window,
const CefRect new_bounds 
)
inlinevirtual

Called when |window| bounds have changed.

|new_bounds| will be in DIP screen coordinates.

◆ OnWindowClosing()

virtual void CefWindowDelegate::OnWindowClosing ( CefRefPtr< CefWindow window)
inlinevirtual

Called when |window| is closing.

◆ OnWindowCreated()

virtual void CefWindowDelegate::OnWindowCreated ( CefRefPtr< CefWindow window)
inlinevirtual

Called when |window| is created.

◆ OnWindowDestroyed()

virtual void CefWindowDelegate::OnWindowDestroyed ( CefRefPtr< CefWindow window)
inlinevirtual

Called when |window| is destroyed.

Release all references to |window| and do not attempt to execute any methods on |window| after this callback returns.

◆ OnWindowFullscreenTransition()

virtual void CefWindowDelegate::OnWindowFullscreenTransition ( CefRefPtr< CefWindow window,
bool  is_completed 
)
inlinevirtual

Called when |window| is transitioning to or from fullscreen mode.

On MacOS the transition occurs asynchronously with |is_competed| set to false when the transition starts and true after the transition completes. On other platforms the transition occurs synchronously with |is_completed| set to true after the transition completes. With Alloy style you must also implement CefDisplayHandler::OnFullscreenModeChange to handle fullscreen transitions initiated by browser content.

◆ WithStandardWindowButtons()

virtual bool CefWindowDelegate::WithStandardWindowButtons ( CefRefPtr< CefWindow window)
inlinevirtual

Return true if |window| should be created with standard window buttons like close, minimize and zoom.

This method is only supported on macOS.


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