package ui import ( "go_dreamfactory/cmd/v2/lib/common" "fyne.io/fyne/v2" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" "github.com/sirupsen/logrus" ) type ToolWindow interface { WindowInterface } type ToolWindowImpl struct { UIImpl w fyne.Window tb *toolBar //工具条 sb *statusBar //状态栏 at *appContainer //tabs } func NewToolWindow(ui *UIImpl) ToolWindow { mw := &ToolWindowImpl{ UIImpl: *ui, } toolWin = mw mw.sb = newStatusBar() toolbar := widget.NewToolbar( widget.NewToolbarAction(theme.ContentCopyIcon(), func() { openApp1(common.TOOLBAR_GEN) }), widget.NewToolbarSpacer(), widget.NewToolbarAction(theme.HelpIcon(), func() { showAbout() }), ) mw.tb = newToolBar(toolbar) mw.at = newAppContainer(toolRegister, ui.obs) return mw } func (ui *ToolWindowImpl) CreateWindow(title string, width, height float32, _ bool) { w := ui.app.NewWindow(title) ui.AddWindow("tool", w) ui.w = w // content content := container.NewBorder(ui.tb.toolbar, ui.sb.widget, nil, nil, ui.at) ui.w.SetContent(content) appName, err := ui.at.openDefaultApp() if err != nil { logrus.WithField("appName", appName).Error(err) } w.Resize(fyne.NewSize(width, height)) w.SetMaster() w.CenterOnScreen() w.Show() }