mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 02:00:10 +08:00
222 lines
5.9 KiB
Plaintext
222 lines
5.9 KiB
Plaintext
---
|
|
sidebar_position: 4
|
|
---
|
|
|
|
# Fenêtre
|
|
|
|
Ces méthodes donnent le contrôle de la fenêtre de l'application.
|
|
|
|
### WindowSetTitle
|
|
|
|
Définit le texte dans la barre de titre de la fenêtre.
|
|
|
|
Go: `WindowSetTitle(ctx context.Context, title string)`<br/> JS: `WindowSetTitle(title: string)`
|
|
|
|
### WindowFullscreen
|
|
|
|
Mets la fenêtre en plein écran.
|
|
|
|
Go: `WindowFullscreen(ctx context.Context)`<br/> JS: `WindowFullscreen()`
|
|
|
|
### WindowUnfullscreen
|
|
|
|
Restaure les dimensions et la position de la fenêtre avant le plein écran.
|
|
|
|
Go: `WindowUnfullscreen(ctx context.Context)`<br/> JS: `WindowUnfullscreen()`
|
|
|
|
### WindowIsFullscreen
|
|
|
|
Renvoie vrai si la fenêtre est en plein écran.
|
|
|
|
Go: `WindowIsFullscreen(ctx context.Context) bool`<br/> JS: `WindowIsFullscreen() bool`
|
|
|
|
### WindowCenter
|
|
|
|
Centre la fenêtre sur le moniteur sur laquelle la fenêtre est actuellement ouverte.
|
|
|
|
Go: `WindowCenter(ctx context.Context)`<br/> JS: `WindowCenter()`
|
|
|
|
### WindowExecJS
|
|
|
|
Exécute du code JS dans la fenêtre.
|
|
|
|
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.
|
|
|
|
Go: `WindowExecJS(ctx context.Context, js string)`
|
|
|
|
### WindowReload
|
|
|
|
Effectue un "rechargement" (Recharge la page courante).
|
|
|
|
Go: `WindowReload(ctx context.Context)`<br/> JS: `WindowReload()`
|
|
|
|
### WindowReloadApp
|
|
|
|
Recharge le frontend de l'application.
|
|
|
|
Go: `WindowReloadApp(ctx context.Context)`<br/> JS: `WindowReloadApp()`
|
|
|
|
### WindowSetSystemDefaultTheme
|
|
|
|
Windows seulement.
|
|
|
|
Go: `WindowSetSystemDefaultTheme(ctx context.Context)`<br/> JS: `WindowSetSystemDefaultTheme()`
|
|
|
|
Définit le thème de fenêtre à la valeur par défaut du système (sombre/clair).
|
|
|
|
### WindowSetLightTheme
|
|
|
|
Windows seulement.
|
|
|
|
Go: `WindowSetLightTheme(ctx context.Context)`<br/> JS: `WindowSetLightTheme()`
|
|
|
|
Définit le thème clair à la fenêtre.
|
|
|
|
### WindowSetDarkTheme
|
|
|
|
Windows seulement.
|
|
|
|
Go: `WindowSetDarkTheme(ctx context.Context)`<br/> JS: `WindowSetDarkTheme()`
|
|
|
|
Définit le thème sombre à la fenêtre.
|
|
|
|
### WindowShow
|
|
|
|
Affiche la fenêtre, si elle est actuellement masquée.
|
|
|
|
Go: `WindowShow(ctx context.Context)`<br/> JS: `WindowShow()`
|
|
|
|
### WindowHide
|
|
|
|
Masque la fenêtre, si elle est actuellement visible.
|
|
|
|
Go: `WindowHide(ctx context.Context)`<br/> JS: `WindowHide()`
|
|
|
|
### WindowIsNormal
|
|
|
|
Renvoie vrai si la fenêtre n'est pas minimisée, maximisée ou plein écran.
|
|
|
|
Go: `WindowIsNormal(ctx context.Context) bool`<br/> JS: `WindowIsNormal() bool`
|
|
|
|
### WindowSetSize
|
|
|
|
Définit la largeur et la hauteur de la fenêtre.
|
|
|
|
Go: `WindowSetSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetSize(size: Size)`
|
|
|
|
### WindowGetSize
|
|
|
|
Retourne la largeur et la hauteur de la fenêtre.
|
|
|
|
Go: `WindowGetSize(ctx context.Context) (width int, height int)`<br/> JS: `WindowGetSize() : Size`
|
|
|
|
### WindowSetMinSize
|
|
|
|
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.
|
|
|
|
Définir une taille de `0,0` désactivera cette contrainte.
|
|
|
|
Go: `WindowSetMinSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetMinSize(size: Size)`
|
|
|
|
### WindowSetMaxSize
|
|
|
|
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.
|
|
|
|
Définir une taille de `0,0` désactivera cette contrainte.
|
|
|
|
Go: `WindowSetMaxSize(ctx context.Context, width int, height int)`<br/> JS: `WindowSetMaxSize(size: Size)`
|
|
|
|
### WindowSetAlwaysOnTop
|
|
|
|
Paramètre pour faire en sorte que la fenêtre soit toujours au dessus des autres ou non.
|
|
|
|
Go: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`<br/> JS: `WindowSetAlwaysOnTop(b: Boolen)`
|
|
|
|
### WindowSetPosition
|
|
|
|
Définit la position de la fenêtre par rapport au moniteur sur lequel la fenêtre est activée.
|
|
|
|
Go: `WindowSetPosition(ctx context.Context, x int, y int)`<br/> JS: `WindowSetPosition(position: Position)`
|
|
|
|
### WindowGetPosition
|
|
|
|
Récupère la position de la fenêtre relative au moniteur sur lequel la fenêtre est activée.
|
|
|
|
Go: `WindowGetPosition(ctx context.Context) (x int, y int)`<br/> JS: `WindowGetPosition() : Position`
|
|
|
|
### WindowMaximiseWindowMaximise
|
|
|
|
Maximise la fenêtre pour remplir l'écran.
|
|
|
|
Go: `WindowMaximise(ctx context.Context)`<br/> JS: `WindowMaximise()`
|
|
|
|
### WindowUnmaximise
|
|
|
|
Restaure la fenêtre aux dimensions et à la position avant qu'elle soit maximisée.
|
|
|
|
Go: `WindowUnmaximise(ctx context.Context)`<br/> JS: `WindowUnmaximise()`
|
|
|
|
### WindowIsMaximised
|
|
|
|
Renvoie vrai si la fenêtre est maximisée.
|
|
|
|
Go: `WindowIsMaximised(ctx context.Context) bool`<br/> JS: `WindowIsMaximised() bool`
|
|
|
|
### WindowToggleMaximise
|
|
|
|
Option permettant de basculer entre la maximisation de la fenêtre et sa non maximisation.
|
|
|
|
Go: `WindowToggleMaximise(ctx context.Context)`<br/> JS: `WindowToggleMaximise()`
|
|
|
|
### WindowMinimise
|
|
|
|
Minimise la fenêtre.
|
|
|
|
Go: `WindowMinimise(ctx context.Context)`<br/> JS: `WindowMinimise()`
|
|
|
|
### WindowUnminimise
|
|
|
|
Restaure la fenêtre aux dimensions et à la position avant qu'elle soit minimisée.
|
|
|
|
Go: `WindowUnminimise(ctx context.Context)`<br/> JS: `WindowUnminimise()`
|
|
|
|
### WindowIsMinimised
|
|
|
|
Renvoie vrai si la fenêtre est minimisée.
|
|
|
|
Go: `WindowIsMinimised(ctx context.Context) bool`<br/> JS: `WindowIsMinimised() bool`
|
|
|
|
### WindowSetBackgroundColour
|
|
|
|
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.
|
|
|
|
Les valeurs valides pour R, G, B et A sont entre 0 et 255 inclus.
|
|
|
|
:::info Windows
|
|
|
|
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.
|
|
|
|
:::
|
|
|
|
Go: `WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8)`<br/> JS: `WindowSetBackgroundColour(R, G, B, A)`
|
|
|
|
## TypeScript Object Definitions
|
|
|
|
### Position
|
|
|
|
```ts
|
|
interface Position {
|
|
x: number;
|
|
y: number;
|
|
}
|
|
```
|
|
|
|
### Size (taille)
|
|
|
|
```ts
|
|
interface Size {
|
|
w: number;
|
|
h: number;
|
|
}
|
|
```
|