DeskUp 0.3
Loading...
Searching...
No Matches
windowDesc Struct Reference

Describes a single window instance in the DeskUp system. More...

#include <window_desc.h>

Public Member Functions

 windowDesc ()
 Constructs a window descriptor with default parameters (integers to 0 and strings empty).
 windowDesc (std::string n, int xPos, int yPos, int width, int height, std::string p)
 Constructs a window descriptor with explicit name, geometry, and executable path.
int saveTo (fs::path path)
 Saves the current window description to a file.
bool operator! () const
 Returns whether the window description is invalid or empty.

Public Attributes

std::string name
 Constructs a window descriptor with explicit name, geometry, and executable path.
int x
 The X coordinate (top-left corner) of the window.
int y
 The Y coordinate (top-left corner) of the window.
int w
 The window width in pixels.
int h
 The window height in pixels.
fs::path pathToExec
 The absolute path to the executable that owns this window.

Detailed Description

Describes a single window instance in the DeskUp system.

This structure holds all relevant information needed to represent a window in the abstract DeskUp format. It allows storing the executable path, name, and geometry (x, y, width, height).

Instances of this struct are typically generated by backend functions such as WIN_getAllOpenWindows(), and can later be serialized using saveTo().

See also
windowDesc::saveTo()
WIN_getAllOpenWindows()

Constructor & Destructor Documentation

◆ windowDesc()

windowDesc::windowDesc ( std::string n,
int xPos,
int yPos,
int width,
int height,
std::string p )
inline

Constructs a window descriptor with explicit name, geometry, and executable path.

Parameters
nwindow name.
xX coordinate (top-left) in pixels.
yY coordinate (top-left) in pixels.
wWidth in pixels.
hHeight in pixels.
pAbsolute path to the owning executable.

Member Function Documentation

◆ operator!()

bool windowDesc::operator! ( ) const
inline

Returns whether the window description is invalid or empty.

This operator checks if all window geometry attributes (x, y, w, h) are zero, which indicates an uninitialized or invalid state.

Returns
true if all coordinates and dimensions are zero, false otherwise.

◆ saveTo()

int windowDesc::saveTo ( fs::path path)

Saves the current window description to a file.

Writes the window’s executable path and geometry (x, y, width, height) to the specified file, each on a new line.

This function returns a SaveErrorCode value to indicate whether the operation succeeded or failed, allowing fine-grained error handling. Positive values indicate success; negative values specify different failure modes.

Format written to file (one value per line):

  1. Path to executable (pathToExec)
  2. X coordinate
  3. Y coordinate
  4. Width
  5. Height
Parameters
pathAbsolute or relative path to the file where data will be stored.
Returns
One of the following SaveErrorCode values:
Note
The function performs basic validation and never throws exceptions. Callers are expected to check the return value and propagate or log the appropriate error code using DeskUp::Error::fromSaveError().
See also
windowDesc
SaveErrorCode
Version
0.2.0
Date
2025

Member Data Documentation

◆ name

std::string windowDesc::name

Constructs a window descriptor with explicit name, geometry, and executable path.

Parameters
nwindow name.
xX coordinate (top-left) in pixels.
yY coordinate (top-left) in pixels.
wWidth in pixels.
hHeight in pixels.
pAbsolute path to the owning executable.

The window name.

Usually derived from the executable name or window title.


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