11import { invoke } from './tauri'
22
3+ /**
4+ * Updates the window resizable flag.
5+ */
6+ function setResizable ( resizable : boolean ) : void {
7+ invoke ( {
8+ module : 'Window' ,
9+ message : {
10+ cmd : 'setResizable' ,
11+ resizable
12+ }
13+ } )
14+ }
15+
316/**
417 * sets the window title
518 *
@@ -15,4 +28,301 @@ function setTitle(title: string): void {
1528 } )
1629}
1730
18- export { setTitle }
31+ /**
32+ * Maximizes the window.
33+ */
34+ function maximize ( ) : void {
35+ invoke ( {
36+ module : 'Window' ,
37+ message : {
38+ cmd : 'maximize'
39+ }
40+ } )
41+ }
42+
43+ /**
44+ * Unmaximizes the window.
45+ */
46+ function unmaximize ( ) : void {
47+ invoke ( {
48+ module : 'Window' ,
49+ message : {
50+ cmd : 'unmaximize'
51+ }
52+ } )
53+ }
54+
55+ /**
56+ * Minimizes the window.
57+ */
58+ function minimize ( ) : void {
59+ invoke ( {
60+ module : 'Window' ,
61+ message : {
62+ cmd : 'minimize'
63+ }
64+ } )
65+ }
66+
67+ /**
68+ * Unminimizes the window.
69+ */
70+ function unminimize ( ) : void {
71+ invoke ( {
72+ module : 'Window' ,
73+ message : {
74+ cmd : 'unminimize'
75+ }
76+ } )
77+ }
78+
79+ /**
80+ * Sets the window visibility to true.
81+ */
82+ function show ( ) : void {
83+ invoke ( {
84+ module : 'Window' ,
85+ message : {
86+ cmd : 'show'
87+ }
88+ } )
89+ }
90+
91+ /**
92+ * Sets the window visibility to false.
93+ */
94+ function hide ( ) : void {
95+ invoke ( {
96+ module : 'Window' ,
97+ message : {
98+ cmd : 'hide'
99+ }
100+ } )
101+ }
102+
103+ /**
104+ * Sets the window transparent flag.
105+ *
106+ * @param {boolean } transparent whether the the window should be transparent or not
107+ */
108+ function setTransparent ( transparent : boolean ) : void {
109+ invoke ( {
110+ module : 'Window' ,
111+ message : {
112+ cmd : 'setTransparent' ,
113+ transparent
114+ }
115+ } )
116+ }
117+
118+ /**
119+ * Whether the window should have borders and bars.
120+ *
121+ * @param {boolean } decorations whether the window should have borders and bars
122+ */
123+ function setDecorations ( decorations : boolean ) : void {
124+ invoke ( {
125+ module : 'Window' ,
126+ message : {
127+ cmd : 'setDecorations' ,
128+ decorations
129+ }
130+ } )
131+ }
132+
133+ /**
134+ * Whether the window should always be on top of other windows.
135+ *
136+ * @param {boolean } alwaysOnTop whether the window should always be on top of other windows or not
137+ */
138+ function setAlwaysOnTop ( alwaysOnTop : boolean ) : void {
139+ invoke ( {
140+ module : 'Window' ,
141+ message : {
142+ cmd : 'setAlwaysOnTop' ,
143+ alwaysOnTop
144+ }
145+ } )
146+ }
147+
148+ /**
149+ * Sets the window width.
150+ *
151+ * @param {number } width the new window width
152+ */
153+ function setWidth ( width : number ) : void {
154+ invoke ( {
155+ module : 'Window' ,
156+ message : {
157+ cmd : 'setWidth' ,
158+ width
159+ }
160+ } )
161+ }
162+
163+ /**
164+ * Sets the window height.
165+ *
166+ * @param {number } height the new window height
167+ */
168+ function setHeight ( height : number ) : void {
169+ invoke ( {
170+ module : 'Window' ,
171+ message : {
172+ cmd : 'setHeight' ,
173+ height
174+ }
175+ } )
176+ }
177+
178+ /**
179+ * Resizes the window.
180+ *
181+ * @param {number } width the new window width
182+ * @param {number } height the new window height
183+ */
184+ function resize ( width : number , height : number ) : void {
185+ invoke ( {
186+ module : 'Window' ,
187+ message : {
188+ cmd : 'resize' ,
189+ width,
190+ height,
191+ }
192+ } )
193+ }
194+
195+ /**
196+ * Sets the window min size.
197+ *
198+ * @param {number } minWidth the new window min width
199+ * @param {number } minHeight the new window min height
200+ */
201+ function setMinSize ( minWidth : number , minHeight : number ) : void {
202+ invoke ( {
203+ module : 'Window' ,
204+ message : {
205+ cmd : 'setMinSize' ,
206+ minWidth,
207+ minHeight
208+ }
209+ } )
210+ }
211+
212+ /**
213+ * Sets the window max size.
214+ *
215+ * @param {number } maxWidth the new window max width
216+ * @param {number } maxHeight the new window max height
217+ */
218+ function setMaxSize ( maxWidth : number , maxHeight : number ) : void {
219+ invoke ( {
220+ module : 'Window' ,
221+ message : {
222+ cmd : 'setMaxSize' ,
223+ maxWidth,
224+ maxHeight
225+ }
226+ } )
227+ }
228+
229+ /**
230+ * Sets the window x position.
231+ *
232+ * @param {number } x the new window x position
233+ */
234+ function setX ( x : number ) : void {
235+ invoke ( {
236+ module : 'Window' ,
237+ message : {
238+ cmd : 'setX' ,
239+ x
240+ }
241+ } )
242+ }
243+
244+ /**
245+ * Sets the window y position.
246+ *
247+ * @param {number } y the new window y position
248+ */
249+ function setY ( y : number ) : void {
250+ invoke ( {
251+ module : 'Window' ,
252+ message : {
253+ cmd : 'setY' ,
254+ y
255+ }
256+ } )
257+ }
258+
259+ /**
260+ * Sets the window position.
261+ *
262+ * @param {number } x the new window x position
263+ * @param {number } y the new window y position
264+ */
265+ function setPosition ( x : number , y : number ) : void {
266+ invoke ( {
267+ module : 'Window' ,
268+ message : {
269+ cmd : 'setPosition' ,
270+ x,
271+ y
272+ }
273+ } )
274+ }
275+
276+ /**
277+ * Sets the window fullscreen state.
278+ *
279+ * @param {boolean } fullscreen whether the window should go to fullscreen or not
280+ */
281+ function setFullscreen ( fullscreen : boolean ) : void {
282+ invoke ( {
283+ module : 'Window' ,
284+ message : {
285+ cmd : 'setFullscreen' ,
286+ fullscreen
287+ }
288+ } )
289+ }
290+
291+ /**
292+ * Sets the window icon
293+ *
294+ * @param {string | number[] } icon icon bytes or path to the icon file
295+ */
296+ function setIcon ( icon : 'string' | number [ ] ) : void {
297+ invoke ( {
298+ module : 'Window' ,
299+ message : {
300+ cmd : 'setIcon' ,
301+ icon
302+ }
303+ } )
304+ }
305+
306+ export {
307+ setResizable ,
308+ setTitle ,
309+ maximize ,
310+ unmaximize ,
311+ minimize ,
312+ unminimize ,
313+ show ,
314+ hide ,
315+ setTransparent ,
316+ setDecorations ,
317+ setAlwaysOnTop ,
318+ setWidth ,
319+ setHeight ,
320+ resize ,
321+ setMinSize ,
322+ setMaxSize ,
323+ setX ,
324+ setY ,
325+ setPosition ,
326+ setFullscreen ,
327+ setIcon
328+ }
0 commit comments