note: StandardOverflowMenu must be a method on toolbar to get context scene standardOverflowMenu adds standard overflow menu items for an app bar.
(m *Scene)
| 191 | |
| 192 | // standardOverflowMenu adds standard overflow menu items for an app bar. |
| 193 | func (tb *Toolbar) standardOverflowMenu(m *Scene) { //types:add |
| 194 | NewButton(m).SetText("About").SetIcon(icons.Info).OnClick(func(e events.Event) { |
| 195 | d := NewBody(TheApp.Name()) |
| 196 | d.Styler(func(s *styles.Style) { |
| 197 | s.CenterAll() |
| 198 | }) |
| 199 | NewText(d).SetType(TextHeadlineLarge).SetText(TheApp.Name()) |
| 200 | if AppIcon != "" { |
| 201 | errors.Log(NewSVG(d).ReadString(AppIcon)) |
| 202 | } |
| 203 | if AppAbout != "" { |
| 204 | NewText(d).SetText(AppAbout) |
| 205 | } |
| 206 | NewText(d).SetText("App version: " + system.AppVersion) |
| 207 | NewText(d).SetText("Core version: " + system.CoreVersion) |
| 208 | d.AddOKOnly().RunDialog(m) |
| 209 | }) |
| 210 | NewFuncButton(m).SetFunc(SettingsWindow).SetText("Settings").SetIcon(icons.Settings).SetShortcut("Command+,") |
| 211 | if webCanInstall { |
| 212 | icon := icons.InstallDesktop |
| 213 | if TheApp.SystemPlatform().IsMobile() { |
| 214 | icon = icons.InstallMobile |
| 215 | } |
| 216 | NewFuncButton(m).SetFunc(webInstall).SetText("Install").SetIcon(icon).SetTooltip("Install this app to your device as a Progressive Web App (PWA)") |
| 217 | } |
| 218 | NewButton(m).SetText("Inspect").SetIcon(icons.Edit).SetShortcut("Command+Shift+I"). |
| 219 | SetTooltip("Developer tools for inspecting the content of the app"). |
| 220 | OnClick(func(e events.Event) { |
| 221 | InspectorWindow(tb.Scene) |
| 222 | }) |
| 223 | NewButton(m).SetText("Edit").SetMenu(func(m *Scene) { |
| 224 | // todo: these need to actually do something -- currently just show keyboard shortcut |
| 225 | NewButton(m).SetText("Copy").SetIcon(icons.Copy).SetKey(keymap.Copy) |
| 226 | NewButton(m).SetText("Cut").SetIcon(icons.Cut).SetKey(keymap.Cut) |
| 227 | NewButton(m).SetText("Paste").SetIcon(icons.Paste).SetKey(keymap.Paste) |
| 228 | }) |
| 229 | |
| 230 | // no window menu on single-window platforms |
| 231 | if TheApp.Platform().IsMobile() { |
| 232 | return |
| 233 | } |
| 234 | NewButton(m).SetText("Window").SetMenu(func(m *Scene) { |
| 235 | NewButton(m).SetText("Focus next").SetIcon(icons.CenterFocusStrong). |
| 236 | SetKey(keymap.WinFocusNext).OnClick(func(e events.Event) { |
| 237 | AllRenderWindows.focusNext() |
| 238 | }) |
| 239 | NewButton(m).SetText("Minimize").SetIcon(icons.Minimize). |
| 240 | OnClick(func(e events.Event) { |
| 241 | win := tb.Scene.RenderWindow() |
| 242 | if win != nil { |
| 243 | win.minimize() |
| 244 | } |
| 245 | }) |
| 246 | NewSeparator(m) |
| 247 | NewButton(m).SetText("Close window").SetIcon(icons.Close).SetKey(keymap.WinClose). |
| 248 | OnClick(func(e events.Event) { |
| 249 | win := tb.Scene.RenderWindow() |
| 250 | if win != nil { |
nothing calls this directly
no test coverage detected