Skip to content

Commit 012456d

Browse files
committed
Add window sizes
1 parent e91ce73 commit 012456d

File tree

1 file changed

+81
-6
lines changed

1 file changed

+81
-6
lines changed

Writerside/topics/window.md

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,86 @@ $window->isVisible = false;
296296

297297
## Window Size
298298

299-
<tooltip term="TODO">Documentation in progress...</tooltip>
299+
The window size can be controlled through several properties that allow you
300+
to manage the current size, minimum and maximum bounds of the window.
301+
302+
### Current Size
303+
304+
The <code>Window::$size</code> property provides access to the current window
305+
dimensions. The object in the window is <b>mutable</b> which allows both
306+
reading and updating the size.
307+
308+
<code-block lang="PHP">
309+
// Get current size
310+
echo $window->size; // Size(640 × 480)
311+
312+
// Update width and height separately
313+
$window->size->width = 800;
314+
$window->size->height = 600;
315+
316+
// Update both dimensions simultaneously
317+
$window->size->update(800, 600);
318+
319+
// Set size using Size object
320+
$window->size = new Boson\Window\Size(800, 600);
321+
</code-block>
322+
323+
<warning>
324+
Window dimensions must be uint32 (positive integer between 0 and 2147483647).
325+
326+
Attempting to set values outside this range will result in an exception.
327+
</warning>
328+
329+
### Minimum Size
330+
331+
The <code>Window::$min</code> property controls the minimum allowed dimensions
332+
of the window. Users cannot resize the window smaller than these values.
333+
334+
<code-block lang="PHP">
335+
// Get minimum size
336+
echo $window->min; // Size(0 × 0)
337+
338+
// Set minimum size separately
339+
$window->min->width = 400;
340+
$window->min->height = 300;
341+
342+
// Or update all dimensions at once
343+
$window->min->update(400, 300);
344+
</code-block>
345+
346+
<tip>
347+
Setting minimum size helps prevent the window from being resized too small,
348+
which could make the content unreadable or unusable.
349+
</tip>
350+
351+
<warning>
352+
Window minimal size dimensions must be uint32 (positive integer between 0 and
353+
2147483647).
354+
355+
Attempting to set values outside this range will result in an exception.
356+
</warning>
357+
358+
### Maximum Size
359+
360+
The <code>Window::$max</code> property controls the maximum allowed dimensions
361+
of the window. Users cannot resize the window larger than these values.
362+
363+
<code-block lang="PHP">
364+
// Get maximum size
365+
echo $window->max; // Size(3840 × 2160)
366+
367+
// Set maximum size
368+
$window->max->width = 1920;
369+
$window->max->height = 1080;
370+
371+
// Or update both at once
372+
$window->max->update(1920, 1080);
373+
</code-block>
374+
375+
<note>
376+
The maximum size is typically limited by the screen resolution. Setting a value
377+
larger than the screen size may not have the desired effect.
378+
</note>
300379

301380
## Window Decorations
302381

@@ -495,8 +574,4 @@ if ($window->isClosed) {
495574
} else {
496575
$window->close();
497576
}
498-
</code-block>
499-
500-
## Window Events
501-
502-
<tooltip term="TODO">Documentation in progress...</tooltip>
577+
</code-block>

0 commit comments

Comments
 (0)