Zakero's C++ Header Libraries
A collection of reusable C++ libraries
Classes | Public Member Functions | List of all members
zakero::Yetani::Window Class Reference

A Window. More...

Classes

struct  Memory
 The shared memory. More...
 

Public Member Functions

 Window (void *)
 Construct a Window. More...
 
virtual ~Window ()
 Destroy a Window.
 
uint8_t bytesPerPixel () const noexcept
 Get the number of bytes per pixel. More...
 
void classSet (const std::string &) noexcept
 Change the window class. More...
 
Yetani::PointMm convertToMm (const Yetani::PointPixel &) const noexcept
 Unit conversion. More...
 
Yetani::SizeMm convertToMm (const Yetani::SizePixel &) const noexcept
 Unit conversion. More...
 
Yetani::PointPercent convertToPercent (const Yetani::PointPixel &) const noexcept
 Unit conversion. More...
 
Yetani::SizePercent convertToPercent (const Yetani::SizePixel &) const noexcept
 Unit conversion. More...
 
Yetani::PointPixel convertToPixel (const Yetani::PointMm &) const noexcept
 Unit conversion. More...
 
Yetani::PointPixel convertToPixel (const Yetani::PointPercent &) const noexcept
 Unit conversion. More...
 
Yetani::SizePixel convertToPixel (const Yetani::SizeMm &) const noexcept
 Unit conversion. More...
 
Yetani::SizePixel convertToPixel (const Yetani::SizePercent &) const noexcept
 Unit conversion. More...
 
void cursorHide () noexcept
 Hide the cursor. More...
 
void cursorShow () noexcept
 Show the cursor. More...
 
std::error_code cursorUse (const std::string &) noexcept
 Use a cursor. More...
 
void decorationsOnChange (Yetani::LambdaWindowDecorations) noexcept
 Respond to "Decoration Change" events. More...
 
std::error_code decorationsSet (const Yetani::WindowDecorations) noexcept
 Use the Desktop Environment borders. More...
 
std::error_code imageNext (uint8_t *&, Yetani::SizePixel &) noexcept
 Get an image buffer. More...
 
void imagePresent () noexcept
 Render the image. More...
 
void keyboardOnEnter (Yetani::Lambda) noexcept
 Respond to "Keyboard Enter" events. More...
 
void keyboardOnKey (Yetani::LambdaKey) noexcept
 Respond to "Keyboard Key" events. More...
 
void keyboardOnLeave (Yetani::Lambda) noexcept
 Respond to "Keyboard Leave" events. More...
 
void minimize () noexcept
 Minimize the window. More...
 
void onCloseRequest (Yetani::Lambda) noexcept
 Respond to "Close Request" events. More...
 
void onFocusChange (Yetani::LambdaBool) noexcept
 Respond to "Active" change events. More...
 
void pointerOnAxis (Yetani::LambdaAxis) noexcept
 Respond to "Pointer Axis" events. More...
 
void pointerOnAxisDiscrete (Yetani::Lambda) noexcept
 Respond to "Pointer Axis Discrete" events. More...
 
void pointerOnAxisSource (Yetani::Lambda) noexcept
 Respond to "Pointer Axis Source" events. More...
 
void pointerOnAxisStop (Yetani::Lambda) noexcept
 Respond to "Pointer Axis Stop" events. More...
 
void pointerOnButton (Yetani::LambdaButtonMm) noexcept
 Respond to "Pointer Button" events. More...
 
void pointerOnButton (Yetani::LambdaButtonPercent) noexcept
 Respond to "Pointer Button" events. More...
 
void pointerOnButton (Yetani::LambdaButtonPixel) noexcept
 Respond to "Pointer Button" events. More...
 
void pointerOnEnter (Yetani::LambdaPointMm) noexcept
 Respond to "Pointer Enter" events. More...
 
void pointerOnEnter (Yetani::LambdaPointPercent) noexcept
 Respond to "Pointer Enter" events. More...
 
void pointerOnEnter (Yetani::LambdaPointPixel) noexcept
 Respond to "Pointer Enter" events. More...
 
void pointerOnLeave (Yetani::Lambda) noexcept
 Respond to "Pointer Leave" events. More...
 
void pointerOnMotion (Yetani::LambdaPointMm) noexcept
 Respond to "Pointer Motion" events. More...
 
void pointerOnMotion (Yetani::LambdaPointPercent) noexcept
 Respond to "Pointer Motion" events. More...
 
void pointerOnMotion (Yetani::LambdaPointPixel) noexcept
 Respond to "Pointer Motion" events. More...
 
void sizeOnChange (Yetani::LambdaSizeMm) noexcept
 Respond to "Resize" events. More...
 
void sizeOnChange (Yetani::LambdaSizePercent) noexcept
 Respond to "Resize" events. More...
 
void sizeOnChange (Yetani::LambdaSizePixel) noexcept
 Respond to "Resize" events. More...
 
std::error_code sizeSet (const Yetani::SizeMm &) noexcept
 Set the window size. More...
 
std::error_code sizeSet (const Yetani::SizePercent &) noexcept
 Set the window size. More...
 
std::error_code sizeSet (const Yetani::SizePixel &) noexcept
 Set the window size. More...
 
std::error_code sizeSetMinMax (const Yetani::SizeMm &, const Yetani::SizeMm &) noexcept
 Set the minimum window size. More...
 
std::error_code sizeSetMinMax (const Yetani::SizePercent &, const Yetani::SizePercent &) noexcept
 Set the minimum window size. More...
 
std::error_code sizeSetMinMax (const Yetani::SizePixel &, const Yetani::SizePixel &) noexcept
 Set the minimum window size. More...
 
uint32_t time () const noexcept
 When the last frame was rendered. More...
 
void titleSet (const std::string &) noexcept
 Change the window title. More...
 
Yetani::WindowMode windowMode () noexcept
 Get the current WindowMode. More...
 
bool windowModeIs (const Yetani::WindowMode) noexcept
 Check the WindowMode. More...
 
void windowModeOnChange (Yetani::LambdaWindowMode) noexcept
 Respond to "Window Mode" events. More...
 
void windowModeSet (const Yetani::WindowMode) noexcept
 Change the window mode. More...
 

Detailed Description

The Window is the real work-horse of Yetani. This is the object that the user sees and interacts with. The Window API is rather straight forward and unsurprising, but there are some details to be aware of.

Decorations

Decorations are the window border, the title, and other things like the close button. These items are separate from the window itself in that a window is just a rectangular area on-screen.

Currently, there are two schools of thought, each with pro's and con's:

  1. Client-Side Decorations: The application should be responsible for rendering its own decorations.
    • Pro: The application knows best how to present decorations in a way that best fits it User Interface.
    • Con: No consistent Look-And-Feel across all applications.

  2. Server-Side Decorations: The Desktop Environment is responsible for rendering the window decorations.
    • Pro: Interacting with windows in consistent across all applications and windows are only responsible for there rectangular area on-screen.
    • Con: The Desktop Environment's window decorations may visually clash with the application's User Interface and/or provide redundant controls (like have two ways of closing the application).

Because of this conflict, window decorations are still non-standard and vary in almost every Desktop Environment.

If this situation makes your life complicated, find and complain to the Wayland developers. So far, they just don't care.

Rendering

Updating the contents of the window is a two-step process. The first step is to get an "image" from the window (Yetani::Window::imageNext()). The Window will provide a pointer to it's internal graphics buffer, which can then be used for rendering.

How do you do this rendering? Well that is up to you, Zakero Yetani does not provide any graphics API. You can write your own graphics library (not that hard), or use one that can accept a pointer and use it. For (a bad) example: Qt5's QImage can be used with a raw data pointer.

After writing all the required data to the "image", the second step is to tell the Window to present the image (Yetani::Window::imagePresent()).
Then the Window will tell the Wayland Compositor to update the window contents on-screen.

Why the method names "imageNext()" and "imagePresent()"? That is to match the same language that the Vulkan API uses. Zakero Yetani is not compatible with Vulkan at this point in time.

Cursors

Cursors in Wayland is a tricky topic and as such may not behave as expected. The Wayland spec says that it is the window's (actually, the wl_surface) responsiblity to set the cursor when the pointer enters its area. If the cursor is not set, then the cursor is undefined.

What does this mean? For some Wayland Compositors, the cursor that has been defined by the Desktop Environment will be used. With other Wayland Compositors, the cursor will just "disappear". And errors are reported in yet a different Wayland Compositor. So, to have a consistent cursor behavior across all Wayland Compositors, a cursor should be created (Yetani::cursorCreate()) and used (Yetani::Window::cursorUse()).

Simple, right? Not quite. If one window sets the cursor and another window does not, again for some Wayland Compositors, both windows will use the cursor set by window one. This "default cursor" behavior seems to be based on the connection to the Wayland Compositor.

In conclusion, not setting the cursor is undefined behavior and all windows should set a cursor to use.

Focus

In Wayland there are three types of "focus".

  • Window Focus (active)
    When a window is "active", it has the focus of the Desktop Environment.
    The window may be the top-most or the decorations, if present, may have so type of visual indication that the window is "active".

  • Keyboard Focus
    Certain activities in the Desktop Environment make it possible for a Window to have Keyboard Focus. When a Window has Keyboard Focus all keyboard events will be sent to that Window.

  • Pointer Focus
    Windows gain Pointer Focus with the pointer device, such as a mouse, enters the window area (the decorations don't count). Just as with Keyboard Focus, when a Window has Pointer Focus, it will receive all the pointer events.

Because there are three types of "focus" and each has a different triggering mechanism, it is possible for a Window to have only one or two out of the three focus times. Yes, a Window could have only Keyboard Focus.

One possible way to deal with this is to ignore all events until the Window is active, but that may break user expectations in their Desktop Environment. Try to figure out what makes the most sense with your application.


Class Documentation

◆ zakero::Yetani::Window::Memory

struct zakero::Yetani::Window::Memory

This structure holds the shared memory used by the Window.

Class Members
MemoryPool memory_pool The Window's Memory Pool.
struct wl_shm_pool * wl_shm_pool A pointer to the Wayland Shared Memory Pool.

Constructor & Destructor Documentation

◆ Window()

zakero::Yetani::Window::Window ( void *  ptr)

Member Function Documentation

◆ bytesPerPixel()

uint8_t zakero::Yetani::Window::bytesPerPixel ( ) const
noexcept

The number of bytes required to represent one pixel is provided by this method.

Returns
The number of bytes per pixel.

◆ classSet()

void zakero::Yetani::Window::classSet ( const std::string &  class_name)
noexcept

The class_name of a window is a name that is used to group windows which the Desktop Environment may be able to use. An example of this grouping would be give all the windows a class_name of the application name.
Another example would be to give a "file browser" class_name to a window that allows the user to navigate the file system.

It is suggested to use a class_name that matches the basename of the application's .desktop file. For example, "org.freedesktop.FooViewer" where the .desktop file is "org.freedesktop.FooViewer.desktop".

Note
See http://standards.freedesktop.org/desktop-entry-spec for more details.
Parameters
class_nameThe class name

◆ convertToMm() [1/2]

Yetani::PointMm zakero::Yetani::Window::convertToMm ( const Yetani::PointPixel point) const
noexcept

The provided point will be converted to millimeters.

Returns
The converted point.
Parameters
pointThe point to convert

◆ convertToMm() [2/2]

Yetani::SizeMm zakero::Yetani::Window::convertToMm ( const Yetani::SizePixel size) const
noexcept

The provided size will be converted to millimeters.

Returns
The converted size.
Parameters
sizeThe size to convert

◆ convertToPercent() [1/2]

Yetani::PointPercent zakero::Yetani::Window::convertToPercent ( const Yetani::PointPixel point) const
noexcept

The provided point will be converted to a percentage.

Returns
The converted point.
Parameters
pointThe point to convert

◆ convertToPercent() [2/2]

Yetani::SizePercent zakero::Yetani::Window::convertToPercent ( const Yetani::SizePixel size) const
noexcept

The provided size will be converted to a percentage.

Returns
The converted size.
Parameters
sizeThe size to convert

◆ convertToPixel() [1/4]

Yetani::PointPixel zakero::Yetani::Window::convertToPixel ( const Yetani::PointMm point) const
noexcept

The provided point will be converted to pixels.

Returns
The converted point.
Parameters
pointThe point to convert

◆ convertToPixel() [2/4]

Yetani::PointPixel zakero::Yetani::Window::convertToPixel ( const Yetani::PointPercent point) const
noexcept

The provided point will be converted to pixels.

Returns
The converted point.
Parameters
pointThe point to convert

◆ convertToPixel() [3/4]

Yetani::SizePixel zakero::Yetani::Window::convertToPixel ( const Yetani::SizeMm size) const
noexcept

The provided size will be converted to pixels.

Returns
The converted size.
Parameters
sizeThe size to convert

◆ convertToPixel() [4/4]

Yetani::SizePixel zakero::Yetani::Window::convertToPixel ( const Yetani::SizePercent size) const
noexcept

The provided size will be converted to pixels.

Returns
The converted size.
Parameters
sizeThe size to convert

◆ cursorHide()

void zakero::Yetani::Window::cursorHide ( )
noexcept

The cursor will no longer be visible after calling this method.

◆ cursorShow()

void zakero::Yetani::Window::cursorShow ( )
noexcept

The cursor will be visible when it is in the window.

◆ cursorUse()

std::error_code zakero::Yetani::Window::cursorUse ( const std::string &  name)
noexcept

After creating a cursor, Yetani::cursorCreate(), a window can use that cursor by specifying the cursor name. The cursor can be changed at anytime by calling this method.

To stop using a cursor, pass an empty string as the name parameter.

Note
Not specifying a cursor is undefined behavior in the Wayland spec.
Returns
An error code.
Parameters
nameThe cursor name

◆ decorationsOnChange()

void zakero::Yetani::Window::decorationsOnChange ( Yetani::LambdaWindowDecorations  lambda)
noexcept

For the Wayland Compositors that support Server-Side Decorations, the Desktop Environment can notify a Window whether or not it should render its own decorations. An example of this would be a user requesting for a Window to be border-less. This lambda will be called when that event happens.

Parameters
lambdaThe lambda

◆ decorationsSet()

std::error_code zakero::Yetani::Window::decorationsSet ( const Yetani::WindowDecorations  decorations)
noexcept

Using this method will inform the Wayland Compositor that the window would like to use the "system borders" of the desktop environment by setting use_system_borders to true. Or by setting use_system_borders to ‘false’ the Compositor expect the window to provide its own title and borders or just be a borderlass window.

Even if use_system_borders is true, it may be possible for the Desktop Environment to hide the title and borders of the window.

Note
Not all Wayland Compositors support this functionality. Those Compositors that do not support it, expect the window provide its own title and borders.
Returns
An error code. If there was no error, then error_code.value() == 0.
Parameters
decorationsThe requested decorations

◆ imageNext()

std::error_code zakero::Yetani::Window::imageNext ( uint8_t *&  image,
Yetani::SizePixel size 
)
noexcept

To change the contents of the Window, the image data must be update. This method will provide access to the Windows image data via the image pointer. The image data will have the same pixel format that was used when the Window was created. If the source graphic data is in a different pixel format, it must be translated to the Window's pixel format.

The size parameter is the width and height of the image data in pixels.
The total length of the image data in bytes is:

size.width * size.height * Window->bytesPerPixel()

To index into the image data the following formula is used:

image[(size.width * y) + x] = pixel_color

The contents of the data pointed to by image is undefined and may contain "garbage".

Example
// Pixel Format: ARGB8888 -- 32-bit, 4 bytes per pixel
uint32_t* image = nullptr;
Yetani::SizePixel size;
window->imageNext((uint8_t*)image, size);
uint32_t color = 0x00ffffff; // White
uint32_t x = 44;
uint32_t y = 22;
uint32_t pixel = (y * size.width) + x;
image[pixel] = color;
Returns
An error code.
Parameters
imageThe image data
sizeThe image size

◆ imagePresent()

void zakero::Yetani::Window::imagePresent ( )
noexcept

Once the image data has been updated, this method will schedule the data to be rendered.

◆ keyboardOnEnter()

void zakero::Yetani::Window::keyboardOnEnter ( Yetani::Lambda  lambda)
noexcept

When a window gains keyboard focus, the provided lambda will be called.

Parameters
lambdaThe lambda

◆ keyboardOnKey()

void zakero::Yetani::Window::keyboardOnKey ( Yetani::LambdaKey  lambda)
noexcept

When a Window has Keyboard Focus, it will be notified of key press, key repeat, and key release events. The provided lambda will be called when these events happen.

Parameters
lambdaThe lambda

◆ keyboardOnLeave()

void zakero::Yetani::Window::keyboardOnLeave ( Yetani::Lambda  lambda)
noexcept

When a window loses keyboard focus, the provided lambda will be called.

Parameters
lambdaThe lambda

◆ minimize()

void zakero::Yetani::Window::minimize ( )
noexcept

Using this method will remove the window from view. The user will have to use the Desktop Environment to have the window redisplayed, perhaps using the task viewer.

◆ onCloseRequest()

void zakero::Yetani::Window::onCloseRequest ( Yetani::Lambda  lambda)
noexcept

When a user requests a Window to be close via the Desktop Environment, the Desktop Environment may send an event to the window so that the application can decide how to handle the request. The provided lambda will be called when the window receives a "Close Request" event.

If a lambda has been previously set that needs to be removed, then pass a nullptr as the lambda value.

Parameters
lambdaThe lambda

◆ onFocusChange()

void zakero::Yetani::Window::onFocusChange ( Yetani::LambdaBool  lambda)
noexcept

When a window becomes active (gains focus) or becomes inactive (loses focus), an "Active" event is emitted. The provided lambda will be called to handle the change of the "Active" status.

If a lambda has been previously set that needs to be removed, then pass a nullptr as the lambda value.

Note
Execution of the lambda will block the Yetani object's event handling.
So keep the lambda as small and simple as possible for best performance.
Parameters
lambdaThe lambda

◆ pointerOnAxis()

void zakero::Yetani::Window::pointerOnAxis ( Yetani::LambdaAxis  lambda)
noexcept

Some pointer devices have a "wheel" that can be rotated. The provided lambda will be called when these "Pointer Axis" events happen.

Parameters
lambdaThe lambda

◆ pointerOnAxisDiscrete()

void zakero::Yetani::Window::pointerOnAxisDiscrete ( Yetani::Lambda  lambda)
noexcept

The provided lambda will be called when the "Pointer Axis Discrete" events occur.

Parameters
lambdaThe lambda

◆ pointerOnAxisSource()

void zakero::Yetani::Window::pointerOnAxisSource ( Yetani::Lambda  lambda)
noexcept

The provided lambda will be called when the "Pointer Axis Source" events occur.

Parameters
lambdaThe lambda

◆ pointerOnAxisStop()

void zakero::Yetani::Window::pointerOnAxisStop ( Yetani::Lambda  lambda)
noexcept

The provided lambda will be called when the "Pointer Axis Stop" events occur.

Parameters
lambdaThe lambda

◆ pointerOnButton() [1/3]

void zakero::Yetani::Window::pointerOnButton ( Yetani::LambdaButtonMm  lambda)
noexcept

When the user clicks on a mouse button or some other pointer device, it generates a "Pointer Button" event. The provided lambda will be called when that event occurs.

Parameters
lambdaThe lambda

◆ pointerOnButton() [2/3]

void zakero::Yetani::Window::pointerOnButton ( Yetani::LambdaButtonPercent  lambda)
noexcept

When the user clicks on a mouse button or some other pointer device, it generates a "Pointer Button" event. The provided lambda will be called when that event occurs.

Parameters
lambdaThe lambda

◆ pointerOnButton() [3/3]

void zakero::Yetani::Window::pointerOnButton ( Yetani::LambdaButtonPixel  lambda)
noexcept

When the user clicks on a mouse button or some other pointer device, it generates a "Pointer Button" event. The provided lambda will be called when that event occurs.

Parameters
lambdaThe lambda

◆ pointerOnEnter() [1/3]

void zakero::Yetani::Window::pointerOnEnter ( Yetani::LambdaPointMm  lambda)
noexcept

When the mouse or some other pointer device enters the Window, a "Pointer Enter" event occurs. The provided lambda will be called when that event happens.

This event does not occur when the pointer enters the boarder/decoration area, but the Window (content) itself.

Parameters
lambdaThe lambda

◆ pointerOnEnter() [2/3]

void zakero::Yetani::Window::pointerOnEnter ( Yetani::LambdaPointPercent  lambda)
noexcept

When the mouse or some other pointer device enters the Window, a "Pointer Enter" event occurs. The provided lambda will be called when that event happens.

This event does not occur when the pointer enters the boarder/decoration area, but the Window (content) itself.

Parameters
lambdaThe lambda

◆ pointerOnEnter() [3/3]

void zakero::Yetani::Window::pointerOnEnter ( Yetani::LambdaPointPixel  lambda)
noexcept

When the mouse or some other pointer device enters the Window, a "Pointer Enter" event occurs. The provided lambda will be called when that event happens.

This event does not occur when the pointer enters the boarder/decoration area, but the Window (content) itself.

Parameters
lambdaThe lambda

◆ pointerOnLeave()

void zakero::Yetani::Window::pointerOnLeave ( Yetani::Lambda  lambda)
noexcept

When the mouse or some other pointer device leave the Window, a "Pointer Leave" event occurs. The provided lambda will be called when that event happens.

Parameters
lambdaThe lambda

◆ pointerOnMotion() [1/3]

void zakero::Yetani::Window::pointerOnMotion ( Yetani::LambdaPointMm  lambda)
noexcept

When the mouse or some other pointer device moves in the Window, a "Pointer Motion" event occurs. The provided lambda will be called when that event happens.

Parameters
lambdaThe lambda

◆ pointerOnMotion() [2/3]

void zakero::Yetani::Window::pointerOnMotion ( Yetani::LambdaPointPercent  lambda)
noexcept

When the mouse or some other pointer device moves in the Window, a "Pointer Motion" event occurs. The provided lambda will be called when that event happens.

Parameters
lambdaThe lambda

◆ pointerOnMotion() [3/3]

void zakero::Yetani::Window::pointerOnMotion ( Yetani::LambdaPointPixel  lambda)
noexcept

When the mouse or some other pointer device moves in the Window, a "Pointer Motion" event occurs. The provided lambda will be called when that event happens.

Parameters
lambdaThe lambda

◆ sizeOnChange() [1/3]

void zakero::Yetani::Window::sizeOnChange ( Yetani::LambdaSizeMm  lambda)
noexcept

"Resize" events are unique to Yetani. After a window has been resized, the provided lambda will be called. This event is triggered by the user manually resizing the Window.

If a lambda has been previously set that needs to be removed, then pass a nullptr as the lambda value.

Note
Execution of the lambda will block the Yetani object's event handling.
So keep the lambda as small and simple as possible for best performance.
Parameters
lambdaThe lambda

◆ sizeOnChange() [2/3]

void zakero::Yetani::Window::sizeOnChange ( Yetani::LambdaSizePercent  lambda)
noexcept

"Resize" events are unique to Yetani. After a window has been resized, the provided lambda will be called. This event is triggered by the user manually resizing the Window.

If a lambda has been previously set that needs to be removed, then pass a nullptr as the lambda value.

Note
Execution of the lambda will block the Yetani object's event handling.
So keep the lambda as small and simple as possible for best performance.
Parameters
lambdaThe lambda

◆ sizeOnChange() [3/3]

void zakero::Yetani::Window::sizeOnChange ( Yetani::LambdaSizePixel  lambda)
noexcept

"Resize" events are unique to Yetani. After a window has been resized, the provided lambda will be called. This event is triggered by the user manually resizing the Window.

If a lambda has been previously set that needs to be removed, then pass a nullptr as the lambda value.

Note
Execution of the lambda will block the Yetani object's event handling.
So keep the lambda as small and simple as possible for best performance.
Parameters
lambdaThe lambda

◆ sizeSet() [1/3]

std::error_code zakero::Yetani::Window::sizeSet ( const Yetani::SizeMm size)
noexcept

The window will be resized to the requested size.

Changing the size in this manner ignores the Window's minimum and maximum size settings. This can result in strange behavior when a user then attempts to manually resize the Window.

Note
The size of a window must be greater than 0.
This method does not trigger the Resize Event.
Returns
An error code. If there was no error, then error_code.value() == 0.
Parameters
sizeThe Window size

◆ sizeSet() [2/3]

std::error_code zakero::Yetani::Window::sizeSet ( const Yetani::SizePercent size)
noexcept

The window will be resized to the requested size.

Changing the size in this manner ignores the Window's minimum and maximum size settings. This can result in strange behavior when a user then attempts to manually resize the Window.

Note
The size of a window must be greater than 0.
This method does not trigger the Resize Event.
Returns
An error code. If there was no error, then error_code.value() == 0.
Parameters
sizeThe Window size

◆ sizeSet() [3/3]

std::error_code zakero::Yetani::Window::sizeSet ( const Yetani::SizePixel size)
noexcept

The window will be resized to the requested size.

Changing the size in this manner ignores the Window's minimum and maximum size settings. This can result in strange behavior when a user then attempts to manually resize the Window.

Note
The size of a window must be greater than 0.
This method does not trigger the Resize Event.
Returns
An error code. If there was no error, then error_code.value() == 0.
Parameters
sizeThe Window size

◆ sizeSetMinMax() [1/3]

std::error_code zakero::Yetani::Window::sizeSetMinMax ( const Yetani::SizeMm size_min,
const Yetani::SizeMm size_max 
)
noexcept

The window will be restricted to the provided size_min and size_max.

If either the width or height values in size_min or size_max are 0, then the size restriction for that dimension will be disabled.

Returns
An error code. If there was no error, then error_code.value() == 0.
Parameters
size_minThe minimum size
size_maxThe maximum size

◆ sizeSetMinMax() [2/3]

std::error_code zakero::Yetani::Window::sizeSetMinMax ( const Yetani::SizePercent size_min,
const Yetani::SizePercent size_max 
)
noexcept

The window will be restricted to the provided size_min and size_max.

If either the width or height values in size_min or size_max are 0, then the size restriction for that dimension will be disabled.

Returns
An error condition. If there was no error, then error_code.value() == 0.
Parameters
size_minThe minimum size
size_maxThe maximum size

◆ sizeSetMinMax() [3/3]

std::error_code zakero::Yetani::Window::sizeSetMinMax ( const Yetani::SizePixel size_min,
const Yetani::SizePixel size_max 
)
noexcept

The window will be restricted to the provided size_min and size_max.

If either the width or height values in size_min or size_max are 0, then the size restriction for that dimension will be disabled.

Returns
An error condition. If there was no error, then error_code.value() == 0.
Parameters
size_minThe minimum size
size_maxThe maximum size

◆ time()

uint32_t zakero::Yetani::Window::time ( ) const
noexcept

Access the time, in milliseconds, of most recent window update. The delta between two window time stamps can be used to determine the Frames-Per-Second.

Note
This is not based on wall-time.
Returns
An error code. If there was no error, then error_code.value() == 0.

◆ titleSet()

void zakero::Yetani::Window::titleSet ( const std::string &  title)
noexcept

The window's title can be changed by using this method. Changing the title does not change the window's name.

Parameters
titleThe window title

◆ windowMode()

Yetani::WindowMode zakero::Yetani::Window::windowMode ( )
noexcept

Provides the current WindowMode of the Window.

Returns
Yetani::WindowMode

◆ windowModeIs()

bool zakero::Yetani::Window::windowModeIs ( const Yetani::WindowMode  window_mode)
noexcept

Compare the provided window_mode with the current window mode.

Return values
trueThe WindowMode matches
falseThe WindowMode's are different
Parameters
window_modeThe WindowMode

◆ windowModeOnChange()

void zakero::Yetani::Window::windowModeOnChange ( Yetani::LambdaWindowMode  lambda)
noexcept

The Desktop Environment is able to change the Window's mode. When that event happens, the provided lambda will be called.

Parameters
lambdaThe lambda

◆ windowModeSet()

void zakero::Yetani::Window::windowModeSet ( const Yetani::WindowMode  window_mode)
noexcept

The current mode of a window can be changed programmatically by using this method.

See also
Yetani::WindowMode
Parameters
window_modeThe WindowMode

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