This repository has been archived by the owner on Sep 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
driver.go
71 lines (61 loc) · 2.32 KB
/
driver.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright ©2018-2020 by Richard A. Wilkes. All rights reserved.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, version 2.0. If a copy of the MPL was not distributed with
// this file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// This Source Code Form is "Incompatible With Secondary Licenses", as
// defined by the Mozilla Public License, version 2.0.
package webapp
import (
"unsafe"
"github.com/richardwilkes/cef/cef"
"github.com/richardwilkes/toolbox/xmath/geom"
"github.com/richardwilkes/webapp/keys"
)
// Driver defines the required functions each platform driver must provide.
type Driver interface {
PrepareForStart() error
PrepareForEventLoop()
RunEventLoop()
OnPreKeyEvent(event *cef.KeyEvent, isKeyboardShortcut *int32) int32
OnKeyEvent(event *cef.KeyEvent) int32
AttemptQuit()
MayQuitNow(quit bool)
MenuBarForWindow(wnd *Window) (bar *MenuBar, isGlobal, isFirst bool)
MenuBarMenuAtIndex(bar *MenuBar, index int) *Menu
MenuBarInsert(bar *MenuBar, beforeIndex int, menu *Menu)
MenuBarRemove(bar *MenuBar, index int)
MenuBarCount(bar *MenuBar) int
MenuBarHeightInWindow() float64
MenuInit(menu *Menu)
MenuItemAtIndex(menu *Menu, index int) *MenuItem
MenuItemAtIndexSetTitle(menu *Menu, index int, title string)
MenuInsertSeparator(menu *Menu, beforeIndex int)
MenuInsertItem(menu *Menu, beforeIndex, id int, title string, key *keys.Key, keyModifiers keys.Modifiers, validator func() bool, handler func())
MenuInsertMenu(menu *Menu, beforeIndex, id int, title string) *Menu
MenuRemove(menu *Menu, index int)
MenuCount(menu *Menu) int
MenuDispose(menu *Menu)
Displays() []*Display
KeyWindow() *Window
BringAllWindowsToFront()
WindowInit(wnd *Window, style StyleMask, bounds geom.Rect, title string) error
WindowBrowserParent(wnd *Window) unsafe.Pointer
WindowClose(wnd *Window)
WindowSetTitle(wnd *Window, title string)
WindowBounds(wnd *Window) geom.Rect
WindowSetBounds(wnd *Window, bounds geom.Rect)
WindowContentSize(wnd *Window) geom.Size
WindowToFront(wnd *Window)
WindowMinimize(wnd *Window)
WindowZoom(wnd *Window)
WindowThemeIsDark(wnd *Window) bool
}
// AppVisibilityController defines optional APIs a platform can provide for
// manipulating application visibility.
type AppVisibilityController interface {
HideApp()
HideOtherApps()
ShowAllApps()
}