Add raw API docs

This commit is contained in:
Lea Anthony
2023-09-25 20:50:53 +10:00
parent fb820bcdad
commit 4663a45e59
9 changed files with 4644 additions and 30 deletions
+14 -23
View File
@@ -186,29 +186,6 @@ API: `CurrentWindow() *WebviewWindow`
window := app.CurrentWindow()
```
### NewSystemTray
API: `NewSystemTray() *SystemTray`
`NewSystemTray()` creates and returns a new system tray instance.
```go
// Create a new system tray
tray := app.NewSystemTray()
```
### NewMenu
API: `NewMenu() *Menu`
This method, belonging to App struct and not Menu struct, also initialises and returns a new `Menu`.
```go
// Create a new menu
menu := app.NewMenu()
```
### RegisterContextMenu
API: `RegisterContextMenu(name string, menu *Menu)`
@@ -251,31 +228,45 @@ API: `ShowAboutDialog()`
### Info
API: `InfoDialog()`
`InfoDialog()` creates and returns a new instance of `MessageDialog` with an `InfoDialogType`. This dialog is typically used to display informational messages to the user.
### Question
API: `QuestionDialog()`
`QuestionDialog()` creates and returns a new instance of `MessageDialog` with a `QuestionDialogType`. This dialog is often used to ask a question to the user and expect a response.
### Warning
API: `WarningDialog()`
`WarningDialog()` creates and returns a new instance of `MessageDialog` with a `WarningDialogType`. As the name suggests, this dialog is primarily used to display warning messages to the user.
### Error
API: `ErrorDialog()`
`ErrorDialog()` creates and returns a new instance of `MessageDialog` with an `ErrorDialogType`. This dialog is designed to be used when you need to display an error message to the user.
### OpenFile
API: `OpenFileDialog()`
`OpenFileDialog()` creates and returns a new `OpenFileDialogStruct`. This dialog prompts the user to select one or more files from their file system.
### SaveFile
API: `SaveFileDialog()`
`SaveFileDialog()` creates and returns a new `SaveFileDialogStruct`. This dialog prompts the user to choose a location on their file system where a file should be saved.
### OpenDirectory
API: `OpenDirectoryDialog()`
`OpenDirectoryDialog()` creates and returns a new instance of `MessageDialog` with an `OpenDirectoryDialogType`. This dialog enables the user to choose a directory from their file system.
File diff suppressed because it is too large Load Diff
+7 -4
View File
@@ -1,12 +1,15 @@
# Menu
### `type Menu struct`
Menus can be created and added to the application. They can be used to create context menus, system tray menus and application menus.
The `Menu` struct holds information about a menu, including which items it contains and its label.
To create a new menu, call:
### `func NewMenu() *Menu`
```go
// Create a new menu
menu := app.NewMenu()
```
This function initializes a new Menu.
The following operations are then available on the `Menu` type:
### Add
+6 -3
View File
@@ -2,11 +2,14 @@
The system tray houses notification area on a desktop environment, which can contain both icons of currently-running applications and specific system notifications.
### NewSystemTray
You create a system tray by calling `app.NewSystemTray()`:
API: `NewSystemTray(id uint) *SystemTray`
```go
// Create a new system tray
tray := app.NewSystemTray()
```
The `NewSystemTray` function constructs an instance of the `SystemTray` struct. This function takes a unique identifier of type `uint`. It returns a pointer to a `SystemTray` instance.
The following methods are available on the `SystemTray` type:
### SetLabel