Nui
Classes | Public Member Functions | Static Public Attributes | List of all members
Nui::Window Class Reference

This class encapsulates the webview. More...

#include <window.hpp>

Classes

struct  Implementation
 
struct  LinuxImplementation
 
struct  MacOsImplementation
 
struct  WindowsImplementation
 

Public Member Functions

 Window ()
 Construct a new Window object. More...
 
 Window (WindowOptions const &options)
 Construct a new Window object. More...
 
 Window (bool debug)
 Construct a new Window object. More...
 
 Window (std::string const &title, bool debug=false)
 Construct a new Window object. More...
 
 Window (char const *title, bool debug=false)
 Construct a new Window object. More...
 
 ~Window ()
 
 Window (const Window &)=delete
 
Windowoperator= (const Window &)=delete
 
 Window (Window &&)
 
Windowoperator= (Window &&)
 
void setTitle (std::string const &title)
 Set the Title of the window. More...
 
void setSize (int width, int height, WebViewHint hint=WebViewHint::WEBVIEW_HINT_NONE)
 Sets the size of the window. More...
 
void setPosition (int x, int y, bool useFrameOrigin=true)
 Sets the position of the window. More...
 
void centerOnPrimaryDisplay ()
 Center the window on the primary display. More...
 
void navigate (const std::string &url)
 Navigate to url. More...
 
void navigate (char const *url)
 Navigate to url. More...
 
void terminate ()
 Close the window and exit run. More...
 
void openDevTools ()
 Open the dev tools. More...
 
void runInJavascriptThread (std::function< void()> &&func)
 

Static Public Attributes

constexpr static std::string_view windowsServeAuthority = "app.example"
 

Detailed Description

This class encapsulates the webview.

Constructor & Destructor Documentation

◆ Window() [1/7]

Nui::Window::Window ( )

Construct a new Window object.

◆ Window() [2/7]

Nui::Window::Window ( WindowOptions const &  options)
explicit

Construct a new Window object.

Parameters
optionsAdditional options.

◆ Window() [3/7]

Nui::Window::Window ( bool  debug)
explicit

Construct a new Window object.

Parameters
debugIf true, the dev tools may be opened.
optionsAdditional options.

◆ Window() [4/7]

Nui::Window::Window ( std::string const &  title,
bool  debug = false 
)
explicit

Construct a new Window object.

Parameters
titleThe title of the window.
debugIf true, the dev tools may be opened.
optionsAdditional options.

◆ Window() [5/7]

Nui::Window::Window ( char const *  title,
bool  debug = false 
)
explicit

Construct a new Window object.

Parameters
titleThe title of the window.
debugIf true, the dev tools may be opened.
optionsAdditional options.

◆ ~Window()

Nui::Window::~Window ( )
default

◆ Window() [6/7]

Nui::Window::Window ( const Window )
delete

◆ Window() [7/7]

Nui::Window::Window ( Window &&  )
default

Member Function Documentation

◆ centerOnPrimaryDisplay()

void Nui::Window::centerOnPrimaryDisplay ( )

Center the window on the primary display.

Requires size to be set first.

◆ navigate() [1/2]

void Nui::Window::navigate ( char const *  url)

Navigate to url.

Parameters
url

◆ navigate() [2/2]

void Nui::Window::navigate ( const std::string &  url)

Navigate to url.

Parameters
url

◆ openDevTools()

void Nui::Window::openDevTools ( )

Open the dev tools.

Note
This function is not available on MacOS.

◆ operator=() [1/2]

Window& Nui::Window::operator= ( const Window )
delete

◆ operator=() [2/2]

Window & Nui::Window::operator= ( Window &&  )
default

◆ runInJavascriptThread()

void Nui::Window::runInJavascriptThread ( std::function< void()> &&  func)

◆ setPosition()

void Nui::Window::setPosition ( int  x,
int  y,
bool  useFrameOrigin = true 
)

Sets the position of the window.

Parameters
xxCoordinate
yyCoordinate
(MacOSonly) use setFrameOrigin instead of setFrameTopLeftPoint (see apple doc)

◆ setSize()

void Nui::Window::setSize ( int  width,
int  height,
WebViewHint  hint = WebViewHint::WEBVIEW_HINT_NONE 
)

Sets the size of the window.

Parameters
width
height
hint

◆ setTitle()

void Nui::Window::setTitle ( std::string const &  title)

Set the Title of the window.

Parameters
title

◆ terminate()

void Nui::Window::terminate ( )

Close the window and exit run.

Member Data Documentation

◆ windowsServeAuthority

constexpr static std::string_view Nui::Window::windowsServeAuthority = "app.example"
staticconstexpr

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