DeskUp 0.3
Loading...
Searching...
No Matches
window_desc.h
Go to the documentation of this file.
1
36
37#ifndef WINDOWDESC_H
38#define WINDOWDESC_H
39
40#include <string>
41#include <filesystem>
42
43namespace fs = std::filesystem;
44
60struct windowDesc {
61
65 windowDesc();
66
76 windowDesc(std::string n, int xPos, int yPos, int width, int height, std::string p) : name(n), x(xPos), y(yPos), w(width), h(height), pathToExec(fs::path(p)) {}
77
78 // /**
79 // * @brief Constructs a window descriptor with explicit name, geometry, and executable path.
80 // * @param n window name.
81 // * @param x X coordinate (top-left) in pixels.
82 // * @param y Y coordinate (top-left) in pixels.
83 // * @param w Width in pixels.
84 // * @param h Height in pixels.
85 // * @param p Absolute path to the owning executable.
86 // */
87 // windowDesc(std::string n, int xPos, int yPos, int width, int height, fs::path p) : name(n), x(xPos), y(yPos), w(width), h(height), pathToExec(p) {}
88
93 std::string name;
94
98 int x;
99
103 int y;
104
108 int w;
109
113 int h;
114
118 fs::path pathToExec;
119
157 int saveTo(fs::path path);
158
168 bool operator!() const {
169 return !x && !y && !w && !h;
170 }
171
172};
173
234
235#endif
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.
Definition window_desc.h:76
int h
The window height in pixels.
Definition window_desc.h:113
bool operator!() const
Returns whether the window description is invalid or empty.
Definition window_desc.h:168
std::string name
Constructs a window descriptor with explicit name, geometry, and executable path.
Definition window_desc.h:93
windowDesc()
Constructs a window descriptor with default parameters (integers to 0 and strings empty).
Definition window_desc.cc:12
int x
The X coordinate (top-left corner) of the window.
Definition window_desc.h:98
int saveTo(fs::path path)
Saves the current window description to a file.
Definition window_desc.cc:21
fs::path pathToExec
The absolute path to the executable that owns this window.
Definition window_desc.h:118
int y
The Y coordinate (top-left corner) of the window.
Definition window_desc.h:103
int w
The window width in pixels.
Definition window_desc.h:108
SaveErrorCode
Enumerates possible results and error codes for windowDesc::saveTo().
Definition window_desc.h:191
@ ERR_FILE_NOT_FOUND
File not found or directory path invalid.
Definition window_desc.h:220
@ ERR_UNKNOWN
Unknown or unexpected error during save.
Definition window_desc.h:232
@ ERR_NO_PERMISSION
Insufficient permissions to write the file.
Definition window_desc.h:214
@ ERR_FILE_NOT_OPEN
The target file could not be opened.
Definition window_desc.h:208
@ SAVE_SUCCESS
File successfully written.
Definition window_desc.h:196
@ ERR_DISK_FULL
Disk or storage device is full.
Definition window_desc.h:226
@ ERR_EMPTY_PATH
The provided file path is empty.
Definition window_desc.h:202