5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-05 02:22:11 +08:00
wails/mkdocs-website/docs/cy/API/application_window.md
2024-03-18 21:52:39 +11:00

64 lines
1.6 KiB
Markdown

Dyma'r testun wedi'i gyfieithu i'r Gymraeg:
### NewWebviewWindow
API: `NewWebviewWindow() *WebviewWindow`
Mae `NewWebviewWindow()` yn creu ffenestr Webview newydd gyda'r opsiynau rhagosodedig, ac yn ei dychwelyd.
```go
// Creu ffenestr webview newydd
window := app.NewWebviewWindow()
```
### NewWebviewWindowWithOptions
API:
`NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow`
Mae `NewWebviewWindowWithOptions()` yn creu ffenestr webview newydd gydag opsiynau custom. Caiff y ffenestr newydd ei ychwanegu at fap o ffenestri a reolir gan y cymhwysiad.
```go
// Creu ffenestr webview newydd gydag opsiynau custom
window := app.NewWebviewWindowWithOptions(WebviewWindowOptions{
Name: "Main",
Title: "Fy Ffenestr",
Width: 800,
Height: 600,
})
```
### OnWindowCreation
API: `OnWindowCreation(callback func(window *WebviewWindow))`
Mae `OnWindowCreation()` yn cofrestru ffwythiant alw-nôl i'w alw pan grëir ffenestr.
```go
// Cofrestru ffwythiant alw-nôl i'w alw pan grëir ffenestr
app.OnWindowCreation(func(window *WebviewWindow) {
// Gwneud rhywbeth
})
```
### GetWindowByName
API: `GetWindowByName(name string) *WebviewWindow`
Mae `GetWindowByName()` yn nôl ac yn dychwelyd ffenestr gyda enw penodol.
```go
// Cael ffenestr drwy ei henw
window := app.GetWindowByName("Main")
```
### CurrentWindow
API: `CurrentWindow() *WebviewWindow`
Mae `CurrentWindow()` yn nôl ac yn dychwelyd cyfeiriad at y ffenestr weithredol yn y cymhwysiad. Os nad oes ffenestr, mae'n dychwelyd nil.
```go
// Cael y ffenestr gyfredol
window := app.CurrentWindow()
```