Skip to content

Commit fc50326

Browse files
committed
add setWindowFocus and isWindowFocused
1 parent 2f8a18b commit fc50326

File tree

9 files changed

+160
-2
lines changed

9 files changed

+160
-2
lines changed

source/scripting/api/index.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ Functions related to windows and monitors.
252252
- Returns the window's opacity.
253253
* - :doc:`/types/Script/getWindowDroppedFiles/index`
254254
- Returns the path to the files dropped on the window.
255+
* - :doc:`/types/Script/setWindowFocus/index`
256+
- Focuses the window.
257+
* - :doc:`/types/Script/isWindowFocused/index`
258+
- Checks if the window is focused.
255259
* - :doc:`/types/Script/setWindowTitle/index`
256260
- Sets the window's title.
257261
* - :doc:`/types/Script/getWindowTitle/index`

source/types/Script/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,10 @@ Functions
247247
- Returns the window's opacity.
248248
* - :doc:`/types/Script/getWindowDroppedFiles/index`
249249
- Returns the path to the files dropped on the window.
250+
* - :doc:`/types/Script/setWindowFocus/index`
251+
- Focuses the window.
252+
* - :doc:`/types/Script/isWindowFocused/index`
253+
- Checks if the window is focused.
250254
* - :doc:`/types/Script/setWindowTitle/index`
251255
- Sets the window's title.
252256
* - :doc:`/types/Script/getWindowTitle/index`
@@ -457,6 +461,8 @@ Functions
457461
./setWindowOpacity/index.rst
458462
./getWindowOpacity/index.rst
459463
./getWindowDroppedFiles/index.rst
464+
./setWindowFocus/index.rst
465+
./isWindowFocused/index.rst
460466
./setWindowTitle/index.rst
461467
./getWindowTitle/index.rst
462468
./setWindowIcon/index.rst
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
isWindowFocused
2+
===============
3+
4+
:doc:`/types/Script/index`::isWindowFocused
5+
6+
Checks if the window is focused.
7+
8+
Declaration
9+
-----------
10+
11+
.. code-block:: cpp
12+
13+
bool isWindowFocused(WindowID windowID = NTSHENGN_WINDOW_UNKNOWN);
14+
15+
Parameters
16+
----------
17+
18+
.. list-table::
19+
:width: 100%
20+
:header-rows: 1
21+
:class: code-table
22+
23+
* - Name
24+
- Type
25+
- Description
26+
* - windowID
27+
- :doc:`/types/WindowID/index`
28+
- The window to check. By default, this window will be the main window.
29+
30+
Returns
31+
-------
32+
33+
``true`` if the window is focused, else, returns ``false``.
34+
35+
Notes
36+
-----
37+
38+
The main window will be used if ``windowID`` is equal to ``NTSHENGN_WINDOW_UNKNOWN``.

source/types/Script/isWindowOpen/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Parameters
3030
Returns
3131
-------
3232

33-
None.
33+
``true`` if the window is open, else, returns ``false``.
3434

3535
Notes
3636
-----
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
setWindowFullscreen
2+
===================
3+
4+
:doc:`/types/Script/index`::setWindowFocus
5+
6+
Focuses the window.
7+
8+
Declaration
9+
-----------
10+
11+
.. code-block:: cpp
12+
13+
void setWindowFocus(WindowID windowID = NTSHENGN_WINDOW_UNKNOWN);
14+
15+
Parameters
16+
----------
17+
18+
.. list-table::
19+
:width: 100%
20+
:header-rows: 1
21+
:class: code-table
22+
23+
* - Name
24+
- Type
25+
- Description
26+
* - windowID
27+
- :doc:`/types/WindowID/index`
28+
- The window to focus. By default, this window will be the main window.
29+
30+
Returns
31+
-------
32+
33+
None.
34+
35+
Notes
36+
-----
37+
38+
The main window will be used if ``windowID`` is equal to ``NTSHENGN_WINDOW_UNKNOWN``.

source/types/WindowModuleInterface/index.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ Functions
5454
- Returns the window's opacity.
5555
* - :doc:`/types/WindowModuleInterface/getWindowDroppedFiles/index`
5656
- Returns the path to the files dropped on the window.
57+
* - :doc:`/types/WindowModuleInterface/setWindowFocus/index`
58+
- Focuses the window.
59+
* - :doc:`/types/WindowModuleInterface/isWindowFocused/index`
60+
- Checks if the window is focused.
5761
* - :doc:`/types/WindowModuleInterface/pollEvents/index`
5862
- Polls the window system events.
5963
* - :doc:`/types/WindowModuleInterface/setWindowTitle/index`
@@ -128,6 +132,8 @@ Functions
128132
./setWindowOpacity/index.rst
129133
./getWindowOpacity/index.rst
130134
./getWindowDroppedFiles/index.rst
135+
./setWindowFocus/index.rst
136+
./isWindowFocused/index.rst
131137
./pollEvents/index.rst
132138
./setWindowTitle/index.rst
133139
./getWindowTitle/index.rst
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
isWindowFocused
2+
===============
3+
4+
:doc:`/types/WindowModuleInterface/index`::isWindowFocused
5+
6+
Checks if the window is focused.
7+
8+
Declaration
9+
-----------
10+
11+
.. code-block:: cpp
12+
13+
virtual bool isWindowFocused(WindowID windowID) = 0;
14+
15+
Parameters
16+
----------
17+
18+
.. list-table::
19+
:width: 100%
20+
:header-rows: 1
21+
:class: code-table
22+
23+
* - Name
24+
- Type
25+
- Description
26+
* - windowID
27+
- :doc:`/types/WindowID/index`
28+
- The window to check.
29+
30+
Returns
31+
-------
32+
33+
``true`` if the window is focused, else, returns ``false``.

source/types/WindowModuleInterface/isWindowOpen/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ Parameters
3030
Returns
3131
-------
3232

33-
None.
33+
``true`` if the window is open, else, returns ``false``.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
setWindowFullscreen
2+
===================
3+
4+
:doc:`/types/WindowModuleInterface/index`::setWindowFocus
5+
6+
Focuses the window.
7+
8+
Declaration
9+
-----------
10+
11+
.. code-block:: cpp
12+
13+
virtual void setWindowFocus(WindowID windowID) = 0;
14+
15+
Parameters
16+
----------
17+
18+
.. list-table::
19+
:width: 100%
20+
:header-rows: 1
21+
:class: code-table
22+
23+
* - Name
24+
- Type
25+
- Description
26+
* - windowID
27+
- :doc:`/types/WindowID/index`
28+
- The window to focus.
29+
30+
Returns
31+
-------
32+
33+
None.

0 commit comments

Comments
 (0)