Ultralight C++ API 1.3.0
Loading...
Searching...
No Matches
ultralight::Window Class Referenceabstract

#include <AppCore/Window.h>

Details

Window class, represents a platform window.

Inheritance diagram for ultralight::Window:
ultralight::RefCounted

Static Public Member Functions

static RefPtr< WindowCreate (Monitor *monitor, uint32_t width, uint32_t height, bool fullscreen, unsigned int window_flags)
 Create a new Window.
 

Public Member Functions

virtual void set_listener (WindowListener *listener)=0
 Set a WindowListener to receive callbacks for window-related events.
 
virtual WindowListenerlistener ()=0
 Get the WindowListener, if any.
 
virtual uint32_t screen_width () const =0
 Get the window width (in screen coordinates).
 
virtual uint32_t width () const =0
 Get the window width (in pixels).
 
virtual uint32_t screen_height () const =0
 Get the window height (in screen coordinates).
 
virtual uint32_t height () const =0
 Get the window height (in pixels).
 
virtual void MoveTo (int x, int y)=0
 Move the window to a new position (in screen coordinates) relative to the top-left of the monitor area.
 
virtual void MoveToCenter ()=0
 Move the window to the center of the monitor.
 
virtual int x () const =0
 Get the x-position of the window (in screen coordinates) relative to the top-left of the monitor area.
 
virtual int y () const =0
 Get the y-position of the window (in screen coordinates) relative to the top-left of the monitor area.
 
virtual bool is_fullscreen () const =0
 Whether or not the window is fullscreen.
 
virtual bool is_accelerated () const =0
 Whether or not the window is GPU accelerated.
 
virtual uint32_t render_buffer_id () const =0
 The render buffer id of the the window's backing texture.
 
virtual double scale () const =0
 The DPI scale of the window.
 
virtual void SetTitle (const char *title)=0
 Set the window title.
 
virtual void SetCursor (ultralight::Cursor cursor)=0
 Set the cursor.
 
virtual void Show ()=0
 Show the window (if it was previously hidden).
 
virtual void Hide ()=0
 Hide the window.
 
virtual bool is_visible () const =0
 Whether or not the window is currently visible (not hidden).
 
virtual void Close ()=0
 Close the window.
 
virtual int ScreenToPixels (int val) const =0
 Convert screen coordinates to pixels using the current DPI scale.
 
virtual int PixelsToScreen (int val) const =0
 Convert pixels to screen coordinates using the current DPI scale.
 
virtual void DrawSurface (int x, int y, Surface *surface)
 Draw a surface directly to window, used only by CPU renderer.
 
virtual void * native_handle () const =0
 Get the underlying native window handle.
 
- Public Member Functions inherited from ultralight::RefCounted
virtual void AddRef () const =0
 
virtual void Release () const =0
 
virtual int ref_count () const =0
 

Protected Member Functions

virtual ~Window ()
 
virtual OverlayManager * overlay_manager () const =0
 
- Protected Member Functions inherited from ultralight::RefCounted
virtual ~RefCounted ()
 

Friends

class OverlayImpl
 

Constructor & Destructor Documentation

◆ ~Window()

virtual ultralight::Window::~Window ( )
protectedvirtual

Member Function Documentation

◆ Close()

virtual void ultralight::Window::Close ( )
pure virtual

Close the window.

◆ Create()

static RefPtr< Window > ultralight::Window::Create ( Monitor monitor,
uint32_t  width,
uint32_t  height,
bool  fullscreen,
unsigned int  window_flags 
)
static

Create a new Window.

Parameters
monitorThe monitor to create the Window on.
widthThe width (in screen coordinates).
heightThe height (in screen coordinates).
fullscreenWhether or not the window is fullscreen.
window_flagsVarious window flags.
Note

Windows are immediately shown by default unless kWindowFlags_Hidden is set in the window_flags parameter. (They can be shown later via Window::Show())

Note

Screen coordinates are device-scale-independent and have the following relationship to pixel coordinates:

pixel_coordinate = round(screen_coordinate * scale)
virtual double scale() const =0
The DPI scale of the window.

◆ DrawSurface()

virtual void ultralight::Window::DrawSurface ( int  x,
int  y,
Surface surface 
)
inlinevirtual

Draw a surface directly to window, used only by CPU renderer.

◆ height()

virtual uint32_t ultralight::Window::height ( ) const
pure virtual

Get the window height (in pixels).

◆ Hide()

virtual void ultralight::Window::Hide ( )
pure virtual

Hide the window.

◆ is_accelerated()

virtual bool ultralight::Window::is_accelerated ( ) const
pure virtual

Whether or not the window is GPU accelerated.

◆ is_fullscreen()

virtual bool ultralight::Window::is_fullscreen ( ) const
pure virtual

Whether or not the window is fullscreen.

◆ is_visible()

virtual bool ultralight::Window::is_visible ( ) const
pure virtual

Whether or not the window is currently visible (not hidden).

◆ listener()

virtual WindowListener * ultralight::Window::listener ( )
pure virtual

Get the WindowListener, if any.

◆ MoveTo()

virtual void ultralight::Window::MoveTo ( int  x,
int  y 
)
pure virtual

Move the window to a new position (in screen coordinates) relative to the top-left of the monitor area.

◆ MoveToCenter()

virtual void ultralight::Window::MoveToCenter ( )
pure virtual

Move the window to the center of the monitor.

◆ native_handle()

virtual void * ultralight::Window::native_handle ( ) const
pure virtual

Get the underlying native window handle.

Note
This is:
  • HWND on Windows
  • NSWindow* on macOS
  • GLFWwindow* on Linux

◆ overlay_manager()

virtual OverlayManager * ultralight::Window::overlay_manager ( ) const
protectedpure virtual

◆ PixelsToScreen()

virtual int ultralight::Window::PixelsToScreen ( int  val) const
pure virtual

Convert pixels to screen coordinates using the current DPI scale.

◆ render_buffer_id()

virtual uint32_t ultralight::Window::render_buffer_id ( ) const
pure virtual

The render buffer id of the the window's backing texture.

(This will be 0 if the window is not accelerated).

◆ scale()

virtual double ultralight::Window::scale ( ) const
pure virtual

The DPI scale of the window.

◆ screen_height()

virtual uint32_t ultralight::Window::screen_height ( ) const
pure virtual

Get the window height (in screen coordinates).

◆ screen_width()

virtual uint32_t ultralight::Window::screen_width ( ) const
pure virtual

Get the window width (in screen coordinates).

◆ ScreenToPixels()

virtual int ultralight::Window::ScreenToPixels ( int  val) const
pure virtual

Convert screen coordinates to pixels using the current DPI scale.

◆ set_listener()

virtual void ultralight::Window::set_listener ( WindowListener listener)
pure virtual

Set a WindowListener to receive callbacks for window-related events.

Note
Ownership remains with the caller.

◆ SetCursor()

virtual void ultralight::Window::SetCursor ( ultralight::Cursor  cursor)
pure virtual

Set the cursor.

◆ SetTitle()

virtual void ultralight::Window::SetTitle ( const char *  title)
pure virtual

Set the window title.

◆ Show()

virtual void ultralight::Window::Show ( )
pure virtual

Show the window (if it was previously hidden).

◆ width()

virtual uint32_t ultralight::Window::width ( ) const
pure virtual

Get the window width (in pixels).

◆ x()

virtual int ultralight::Window::x ( ) const
pure virtual

Get the x-position of the window (in screen coordinates) relative to the top-left of the monitor area.

◆ y()

virtual int ultralight::Window::y ( ) const
pure virtual

Get the y-position of the window (in screen coordinates) relative to the top-left of the monitor area.

Friends And Related Symbol Documentation

◆ OverlayImpl

friend class OverlayImpl
friend

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