Files

228 lines
6.1 KiB
Plaintext
Raw Permalink Normal View History

2022-11-21 19:13:43 +08:00
---
sidebar_position: 4
---
2022-11-28 17:13:22 +08:00
# Fenêtre
2022-11-21 19:13:43 +08:00
2022-11-28 17:13:22 +08:00
Ces méthodes donnent le contrôle de la fenêtre de l'application.
2022-11-21 19:13:43 +08:00
### WindowSetTitle
2022-11-28 17:13:22 +08:00
Définit le texte dans la barre de titre de la fenêtre.
2022-11-21 19:13:43 +08:00
Go: `WindowSetTitle(ctx context.Context, title string)`<br/> JS: `WindowSetTitle(title: string)`
### WindowFullscreen
2022-11-28 17:13:22 +08:00
Mets la fenêtre en plein écran.
2022-11-21 19:13:43 +08:00
Go: `WindowFullscreen(ctx context.Context)`<br/> JS: `WindowFullscreen()`
### WindowUnfullscreen
2022-11-28 17:13:22 +08:00
Restaure les dimensions et la position de la fenêtre avant le plein écran.
2022-11-21 19:13:43 +08:00
Go: `WindowUnfullscreen(ctx context.Context)`<br/> JS: `WindowUnfullscreen()`
### WindowIsFullscreen
2022-11-28 17:13:22 +08:00
Renvoie vrai si la fenêtre est en plein écran.
2022-11-21 19:13:43 +08:00
Go: `WindowIsFullscreen(ctx context.Context) bool`<br/> JS: `WindowIsFullscreen() bool`
### WindowCenter
2022-11-28 17:13:22 +08:00
Centre la fenêtre sur le moniteur sur laquelle la fenêtre est actuellement ouverte.
2022-11-21 19:13:43 +08:00
Go: `WindowCenter(ctx context.Context)`<br/> JS: `WindowCenter()`
### WindowExecJS
2022-11-28 17:13:22 +08:00
Exécute du code JS dans la fenêtre.
2022-11-21 19:13:43 +08:00
2022-11-28 17:13:22 +08:00
Cette méthode exécute le code dans le navigateur de manière asynchrone et retourne immédiatement le résultat. Si le script cause des erreurs, elles ne seront disponibles que dans la console du navigateur.
2022-11-21 19:13:43 +08:00
Go: `WindowExecJS(ctx context.Context, js string)`
### WindowReload
2022-11-28 17:13:22 +08:00
Effectue un "rechargement" (Recharge la page courante).
2022-11-21 19:13:43 +08:00
Go: `WindowReload(ctx context.Context)`<br/> JS: `WindowReload()`
### WindowReloadApp
2022-11-28 17:13:22 +08:00
Recharge le frontend de l'application.
2022-11-21 19:13:43 +08:00
Go: `WindowReloadApp(ctx context.Context)`<br/> JS: `WindowReloadApp()`
### WindowSetSystemDefaultTheme
2022-11-28 17:13:22 +08:00
Windows seulement.
2022-11-21 19:13:43 +08:00
Go: `WindowSetSystemDefaultTheme(ctx context.Context)`<br/> JS: `WindowSetSystemDefaultTheme()`
2022-11-28 17:13:22 +08:00
Définit le thème de fenêtre à la valeur par défaut du système (sombre/clair).
2022-11-21 19:13:43 +08:00
### WindowSetLightTheme
2022-11-28 17:13:22 +08:00
Windows seulement.
2022-11-21 19:13:43 +08:00
Go: `WindowSetLightTheme(ctx context.Context)`<br/> JS: `WindowSetLightTheme()`
2022-11-28 17:13:22 +08:00
Définit le thème clair à la fenêtre.
2022-11-21 19:13:43 +08:00
### WindowSetDarkTheme
2022-11-28 17:13:22 +08:00
Windows seulement.
2022-11-21 19:13:43 +08:00
Go: `WindowSetDarkTheme(ctx context.Context)`<br/> JS: `WindowSetDarkTheme()`
2022-11-28 17:13:22 +08:00
Définit le thème sombre à la fenêtre.
2022-11-21 19:13:43 +08:00
### WindowShow
2022-11-28 17:13:22 +08:00
Affiche la fenêtre, si elle est actuellement masquée.
2022-11-21 19:13:43 +08:00
Go: `WindowShow(ctx context.Context)`<br/> JS: `WindowShow()`
### WindowHide
2022-11-28 17:13:22 +08:00
Masque la fenêtre, si elle est actuellement visible.
2022-11-21 19:13:43 +08:00
Go: `WindowHide(ctx context.Context)`<br/> JS: `WindowHide()`
### WindowIsNormal
2022-11-28 17:13:22 +08:00
Renvoie vrai si la fenêtre n'est pas minimisée, maximisée ou plein écran.
2022-11-21 19:13:43 +08:00
Go: `WindowIsNormal(ctx context.Context) bool`<br/> JS: `WindowIsNormal() bool`
### WindowSetSize
2022-11-28 17:13:22 +08:00
Définit la largeur et la hauteur de la fenêtre.
2022-11-21 19:13:43 +08:00
2023-09-08 23:25:21 +10:00
Go: `WindowSetSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetSize(width: number, height: number)`
2022-11-21 19:13:43 +08:00
### WindowGetSize
2022-11-28 17:13:22 +08:00
Retourne la largeur et la hauteur de la fenêtre.
2022-11-21 19:13:43 +08:00
Go: `WindowGetSize(ctx context.Context) (width int, height int)`<br/> JS: `WindowGetSize() : Size`
### WindowSetMinSize
2022-11-28 17:13:22 +08:00
Définit la taille minimale de la fenêtre. Redimensionnera la fenêtre si la fenêtre est actuellement plus petite que les dimensions données.
2022-11-21 19:13:43 +08:00
2022-11-28 17:13:22 +08:00
Définir une taille de `0,0` désactivera cette contrainte.
2022-11-21 19:13:43 +08:00
2023-09-08 23:25:21 +10:00
Go: `WindowSetMinSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetMinSize(width: number, height: number)`
2022-11-21 19:13:43 +08:00
### WindowSetMaxSize
2022-11-28 17:13:22 +08:00
Définit la taille maximale de la fenêtre. Redimensionnera la fenêtre si la fenêtre est actuellement plus grande que les dimensions données.
2022-11-21 19:13:43 +08:00
2022-11-28 17:13:22 +08:00
Définir une taille de `0,0` désactivera cette contrainte.
2022-11-21 19:13:43 +08:00
2023-09-08 23:25:21 +10:00
Go: `WindowSetMaxSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetMaxSize(width: number, height: number)`
2022-11-21 19:13:43 +08:00
### WindowSetAlwaysOnTop
2022-11-28 17:13:22 +08:00
Paramètre pour faire en sorte que la fenêtre soit toujours au dessus des autres ou non.
2022-11-21 19:13:43 +08:00
Go: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`<br/> JS: `WindowSetAlwaysOnTop(b: Boolen)`
### WindowSetPosition
2022-11-28 17:13:22 +08:00
Définit la position de la fenêtre par rapport au moniteur sur lequel la fenêtre est activée.
2022-11-21 19:13:43 +08:00
2023-09-08 23:25:21 +10:00
Go: `WindowSetPosition(ctx context.Context, x int, y int)`<br/> JS: `WindowSetPosition(x: number, y: number)`
2022-11-21 19:13:43 +08:00
### WindowGetPosition
2022-11-28 17:13:22 +08:00
Récupère la position de la fenêtre relative au moniteur sur lequel la fenêtre est activée.
2022-11-21 19:13:43 +08:00
Go: `WindowGetPosition(ctx context.Context) (x int, y int)`<br/> JS: `WindowGetPosition() : Position`
2022-11-28 17:13:22 +08:00
### WindowMaximiseWindowMaximise
2022-11-21 19:13:43 +08:00
2022-11-28 17:13:22 +08:00
Maximise la fenêtre pour remplir l'écran.
2022-11-21 19:13:43 +08:00
Go: `WindowMaximise(ctx context.Context)`<br/> JS: `WindowMaximise()`
### WindowUnmaximise
2022-11-28 17:13:22 +08:00
Restaure la fenêtre aux dimensions et à la position avant qu'elle soit maximisée.
2022-11-21 19:13:43 +08:00
Go: `WindowUnmaximise(ctx context.Context)`<br/> JS: `WindowUnmaximise()`
### WindowIsMaximised
2022-11-28 17:13:22 +08:00
Renvoie vrai si la fenêtre est maximisée.
2022-11-21 19:13:43 +08:00
Go: `WindowIsMaximised(ctx context.Context) bool`<br/> JS: `WindowIsMaximised() bool`
### WindowToggleMaximise
2022-11-28 17:13:22 +08:00
Option permettant de basculer entre la maximisation de la fenêtre et sa non maximisation.
2022-11-21 19:13:43 +08:00
Go: `WindowToggleMaximise(ctx context.Context)`<br/> JS: `WindowToggleMaximise()`
### WindowMinimise
2022-11-28 17:13:22 +08:00
Minimise la fenêtre.
2022-11-21 19:13:43 +08:00
Go: `WindowMinimise(ctx context.Context)`<br/> JS: `WindowMinimise()`
### WindowUnminimise
2022-11-28 17:13:22 +08:00
Restaure la fenêtre aux dimensions et à la position avant qu'elle soit minimisée.
2022-11-21 19:13:43 +08:00
Go: `WindowUnminimise(ctx context.Context)`<br/> JS: `WindowUnminimise()`
### WindowIsMinimised
2022-11-28 17:13:22 +08:00
Renvoie vrai si la fenêtre est minimisée.
2022-11-21 19:13:43 +08:00
Go: `WindowIsMinimised(ctx context.Context) bool`<br/> JS: `WindowIsMinimised() bool`
### WindowSetBackgroundColour
2022-11-28 17:13:22 +08:00
Définit la couleur de fond de la fenêtre avec la couleur RGBA donnée. Cette couleur sera visible au travers de tous les pixels transparents.
2022-11-21 19:13:43 +08:00
2022-11-28 17:13:22 +08:00
Les valeurs valides pour R, G, B et A sont entre 0 et 255 inclus.
2022-11-21 19:13:43 +08:00
:::info Windows
2022-11-28 17:13:22 +08:00
Sous Windows, seules les valeurs 0 et 255 sont prises en charge pour A. Toute valeur qui n'est pas 0 sera considérée comme 255.
2022-11-21 19:13:43 +08:00
:::
Go: `WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)`<br/> JS: `WindowSetBackgroundColour(R, G, B, A)`
2023-09-08 23:25:21 +10:00
### WindowPrint
Opens tha native print dialog.
Go: `WindowPrint(ctx context.Context)`<br/> JS: `WindowPrint()`
2023-03-11 17:57:56 +11:00
## Définitions d'objets TypeScript
2022-11-21 19:13:43 +08:00
### Position
```ts
interface Position {
x: number;
y: number;
}
```
2022-11-28 17:13:22 +08:00
### Size (taille)
2022-11-21 19:13:43 +08:00
```ts
interface Size {
w: number;
h: number;
}
```