Files

228 lines
6.8 KiB
Plaintext
Raw Permalink Normal View History

2022-08-09 20:48:29 +10:00
---
sidebar_position: 4
---
2022-09-30 05:17:34 +08:00
# ウィンドウ
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
アプリケーションウィンドウを制御できるメソッド群です。
2022-08-09 20:48:29 +10:00
### WindowSetTitle
2022-09-30 05:17:34 +08:00
ウィンドウのタイトルバーにテキストを設定します。
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
Go: `WindowSetTitle(ctx context.Context, title string)`<br/> JS: `WindowSetTitle(title: string)`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowFullscreen
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウをフルスクリーンにします。
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
Go: `WindowFullscreen(ctx context.Context)`<br/> JS: `WindowFullscreen()`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowUnfullscreen
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
フルスクリーンにする前のウィンドウサイズおよび位置に戻します。
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
Go: `WindowUnfullscreen(ctx context.Context)`<br/> JS: `WindowUnfullscreen()`
2022-08-09 20:48:29 +10:00
2022-09-12 21:56:43 +10:00
### WindowIsFullscreen
2022-09-30 05:17:34 +08:00
ウィンドウがフルスクリーンの場合は、trueを返します。
2022-09-12 21:56:43 +10:00
2022-09-18 11:00:39 +10:00
Go: `WindowIsFullscreen(ctx context.Context) bool`<br/> JS: `WindowIsFullscreen() bool`
2022-09-12 21:56:43 +10:00
2022-08-27 20:17:15 +10:00
### WindowCenter
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウが現在表示されているモニターの中央に、ウィンドウを配置させます。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowCenter(ctx context.Context)`<br/> JS: `WindowCenter()`
2022-08-09 20:48:29 +10:00
2022-10-15 07:29:31 +08:00
### WindowExecJS
2022-11-09 03:25:18 +08:00
ウィンドウ内で、任意のJSコードを実行します。
2022-10-15 07:29:31 +08:00
2022-11-09 03:25:18 +08:00
このメソッドは、ブラウザ上で非同期にコードを実行し、すぐにリターンされます。 スクリプトでエラーが発生した場合、エラーログはブラウザコンソールでのみ確認できます。
2022-10-15 07:29:31 +08:00
Go: `WindowExecJS(ctx context.Context, js string)`
2022-08-27 20:17:15 +10:00
### WindowReload
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
リロードします。(現在表示されているページをリロード)
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowReload(ctx context.Context)`<br/> JS: `WindowReload()`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowReloadApp
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
アプリケーションフロントエンドをリロードします。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowReloadApp(ctx context.Context)`<br/> JS: `WindowReloadApp()`
2022-08-09 20:48:29 +10:00
### WindowSetSystemDefaultTheme
2022-09-30 05:17:34 +08:00
Windowsのみ使用可能。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowSetSystemDefaultTheme(ctx context.Context)`<br/> JS: `WindowSetSystemDefaultTheme()`
2022-08-27 20:17:15 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウのテーマをシステムデフォルト(ダーク/ライト) に設定します。
2022-08-09 20:48:29 +10:00
### WindowSetLightTheme
2022-09-30 05:17:34 +08:00
Windowsのみ使用可能。
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
Go: `WindowSetLightTheme(ctx context.Context)`<br/> JS: `WindowSetLightTheme()`
2022-09-30 05:17:34 +08:00
ウィンドウのテーマをライトに設定します。
2022-08-09 20:48:29 +10:00
### WindowSetDarkTheme
2022-09-30 05:17:34 +08:00
Windowsのみ使用可能。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowSetDarkTheme(ctx context.Context)`<br/> JS: `WindowSetDarkTheme()`
2022-08-27 20:17:15 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウのテーマをダークに設定します。
2022-08-09 20:48:29 +10:00
### WindowShow
2022-09-30 05:17:34 +08:00
ウィンドウが非表示になっている場合は、表示させます。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowShow(ctx context.Context)`<br/> JS: `WindowShow()`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowHide
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
現在表示されているウィンドウを非表示にします。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowHide(ctx context.Context)`<br/> JS: `WindowHide()`
2022-09-12 21:56:43 +10:00
### WindowIsNormal
2022-09-30 05:17:34 +08:00
ウィンドウが最小化、最大化、またはフルスクリーンになっていない場合、trueを返します。
2022-09-12 21:56:43 +10:00
2022-09-18 11:00:39 +10:00
Go: `WindowIsNormal(ctx context.Context) bool`<br/> JS: `WindowIsNormal() bool`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowSetSize
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウの幅と高さを設定します。
2022-08-09 20:48:29 +10: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-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowGetSize
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウの幅と高さを取得します。
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
Go: `WindowGetSize(ctx context.Context) (width int, height int)`<br/> JS: `WindowGetSize() : Size`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowSetMinSize
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウの最小サイズを設定します。 現在のウィンドウサイズが、指定された最小サイズよりも小さい場合、現在のウィンドウサイズは変更されます。
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
サイズを`0,0`に設定すると、サイズの制約が無効化されます。
2022-08-09 20:48:29 +10: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-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowSetMaxSize
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウの最大サイズを設定します。 現在のウィンドウサイズが、指定された最大サイズよりも大きい場合、現在のウィンドウサイズは変更されます。
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
サイズを`0,0`に設定すると、サイズの制約が無効化されます。
2022-08-09 20:48:29 +10: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-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowSetAlwaysOnTop
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウを常に最前面に表示するかを切り替えます。
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
Go: `WindowSetAlwaysOnTop(ctx context.Context, b bool)`<br/> JS: `WindowSetAlwaysOnTop(b: Boolen)`
2022-08-09 20:48:29 +10:00
### WindowSetPosition
2022-09-30 05:17:34 +08:00
現在ウィンドウが表示されているモニターに対する、相対的なウィンドウ位置を設定します。
2022-08-09 20:48:29 +10: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-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowGetPosition
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
現在ウィンドウが表示されているモニターに対する、相対的なウィンドウ位置を取得します。
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
Go: `WindowGetPosition(ctx context.Context) (x int, y int)`<br/> JS: `WindowGetPosition() : Position`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowMaximise
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウを最大化します。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowMaximise(ctx context.Context)`<br/> JS: `WindowMaximise()`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowUnmaximise
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウの最大化を解除し、最大化する前のサイズおよび位置に戻します。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowUnmaximise(ctx context.Context)`<br/> JS: `WindowUnmaximise()`
2022-09-12 21:56:43 +10:00
### WindowIsMaximised
2022-09-30 05:17:34 +08:00
ウィンドウが最大化している場合はtrueを返します。
2022-09-12 21:56:43 +10:00
2022-09-18 11:00:39 +10:00
Go: `WindowIsMaximised(ctx context.Context) bool`<br/> JS: `WindowIsMaximised() bool`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowToggleMaximise
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
最大化の状態を切り替えます。
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
Go: `WindowToggleMaximise(ctx context.Context)`<br/> JS: `WindowToggleMaximise()`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowMinimise
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウを最小化します。
2022-08-09 20:48:29 +10:00
2022-11-18 19:11:25 +08:00
Go: `WindowMinimise(ctx context.Context)`<br/> JS: `WindowMinimise()`
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
### WindowUnminimise
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウの最小化を解除し、最小化する前のサイズおよび位置に戻します。
2022-08-09 20:48:29 +10:00
2022-08-27 20:17:15 +10:00
Go: `WindowUnminimise(ctx context.Context)`<br/> JS: `WindowUnminimise()`
2022-08-09 20:48:29 +10:00
2022-09-12 21:56:43 +10:00
### WindowIsMinimised
2022-09-30 05:17:34 +08:00
ウィンドウが最小化している場合はtrueを返します。
2022-09-12 21:56:43 +10:00
2022-09-18 11:00:39 +10:00
Go: `WindowIsMinimised(ctx context.Context) bool`<br/> JS: `WindowIsMinimised() bool`
2022-09-12 21:56:43 +10:00
2022-08-27 20:17:15 +10:00
### WindowSetBackgroundColour
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
ウィンドウの背景色をRGBAカラー定義で設定します。 この色は、すべての透過ピクセルに対して表示されます。
2022-08-09 20:48:29 +10:00
2022-09-30 05:17:34 +08:00
R、G、B、Aの有効な値の範囲は0~255です。
2022-08-09 20:48:29 +10:00
2022-09-18 11:00:39 +10:00
:::info Windows
2022-09-30 05:17:34 +08:00
Windowsの場合、0または255のアルファ値(A) のみがサポートされています。 0以外の値を指定すると、すべて255とみなされます。
2022-09-18 11:00:39 +10:00
:::
2022-08-27 20:17:15 +10: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
2023-10-23 20:38:03 +11:00
ネイティブな印刷ダイアログを開きます。
2023-09-08 23:25:21 +10:00
Go: `WindowPrint(ctx context.Context)`<br/> JS: `WindowPrint()`
2023-03-11 17:57:56 +11:00
## TypeScript型定義
2022-08-09 20:48:29 +10:00
### Position
```ts
interface Position {
2022-11-18 19:11:25 +08:00
x: number;
y: number;
2022-08-09 20:48:29 +10:00
}
```
### Size
```ts
interface Size {
2022-11-18 19:11:25 +08:00
w: number;
h: number;
2022-08-09 20:48:29 +10:00
}
```