ppforge/internal/ui/main.go

60 lines
1.5 KiB
Go
Raw Normal View History

2023-01-05 09:06:39 +01:00
package ui
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
type ppfApp struct {
// Container for the borderlayout
Toolbar fyne.CanvasObject
Metadata *Metadata
Extensions *fyne.Container
ContextBar *fyne.Container
ContentTabs *fyne.Container
Workarea *fyne.Container
// Once initialized metadata containers for swapping
ProtocolMeta *ProtocolMetadata
PacketMeta *PacketMetadata
// Global important stuff
Settings map[string]string
ProtocolForging bool
// Once initialized instances of the editor views
EditorPacket *PacketEditor
EditorProtocol *ProtocolEditor
}
var PPF ppfApp
func CreateToolbar(fyneApp fyne.App) fyne.CanvasObject {
toolbar := widget.NewToolbar()
toolbar.Append(widget.NewToolbarAction(theme.StorageIcon(), func() {
PPF.ProtocolForging = !PPF.ProtocolForging
//TODO: implement the switch
}))
toolbar.Append(widget.NewToolbarSeparator())
toolbar.Append(widget.NewToolbarAction(theme.FolderNewIcon(), func() {
}))
toolbar.Append(widget.NewToolbarAction(theme.FolderOpenIcon(), func() {
}))
toolbar.Append(widget.NewToolbarAction(theme.DocumentSaveIcon(), func() {
}))
toolbar.Append(widget.NewToolbarAction(theme.SettingsIcon(), func() {
}))
toolbar.Append(widget.NewToolbarSpacer())
toolbar.Append(widget.NewToolbarAction(theme.LogoutIcon(), func() {
fyneApp.Quit()
}))
return toolbar
}
func CreateWorkarea() *fyne.Container {
return GetProtocolEditor().Representation
}