mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
[v3] use concrete *WebviewWindow
This commit is contained in:
parent
7b84b1c79c
commit
af54419a0b
6 changed files with 15 additions and 14 deletions
|
|
@ -179,7 +179,7 @@ type OpenFileDialogOptions struct {
|
|||
TreatsFilePackagesAsDirectories bool
|
||||
AllowsOtherFileTypes bool
|
||||
Filters []FileFilter
|
||||
Window Window
|
||||
Window *WebviewWindow
|
||||
|
||||
Title string
|
||||
Message string
|
||||
|
|
@ -205,7 +205,7 @@ type OpenFileDialogStruct struct {
|
|||
message string
|
||||
buttonText string
|
||||
directory string
|
||||
window Window
|
||||
window *WebviewWindow
|
||||
|
||||
impl openFileDialogImpl
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ func (d *OpenFileDialogStruct) TreatsFilePackagesAsDirectories(treatsFilePackage
|
|||
}
|
||||
|
||||
func (d *OpenFileDialogStruct) AttachToWindow(window Window) *OpenFileDialogStruct {
|
||||
d.window = window
|
||||
d.window = window.(*WebviewWindow)
|
||||
return d
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -507,7 +507,7 @@ func (m *macosSaveFileDialog) show() (string, error) {
|
|||
nsWindow := unsafe.Pointer(nil)
|
||||
if m.dialog.window != nil {
|
||||
// get NSWindow from window
|
||||
nsWindow = (m.dialog.window).(*WebviewWindow).impl.(*macosWebviewWindow).nsWindow
|
||||
nsWindow, _ = m.dialog.window.NativeWindowHandle()
|
||||
}
|
||||
C.showSaveFileDialog(C.uint(m.dialog.id),
|
||||
C.bool(m.dialog.canCreateDirectories),
|
||||
|
|
|
|||
|
|
@ -2,16 +2,16 @@ package application
|
|||
|
||||
func (m *linuxApp) showAboutDialog(title string, message string, icon []byte) {
|
||||
window := globalApplication.getWindowForID(m.getCurrentWindowID())
|
||||
var parent pointer
|
||||
var parent uintptr
|
||||
if window != nil {
|
||||
parent = (window.(*WebviewWindow).impl).(*linuxWebviewWindow).window
|
||||
parent, _ = window.(*WebviewWindow).NativeWindowHandle()
|
||||
}
|
||||
about := newMessageDialog(InfoDialogType)
|
||||
about.SetTitle(title).
|
||||
SetMessage(message).
|
||||
SetIcon(icon)
|
||||
runQuestionDialog(
|
||||
parent,
|
||||
pointer(parent),
|
||||
about,
|
||||
)
|
||||
}
|
||||
|
|
@ -23,12 +23,12 @@ type linuxDialog struct {
|
|||
func (m *linuxDialog) show() {
|
||||
windowId := getNativeApplication().getCurrentWindowID()
|
||||
window := globalApplication.getWindowForID(windowId)
|
||||
var parent pointer
|
||||
var parent uintptr
|
||||
if window != nil {
|
||||
parent = (window.(*WebviewWindow).impl).(*linuxWebviewWindow).window
|
||||
parent, _ = window.(*WebviewWindow).NativeWindowHandle()
|
||||
}
|
||||
|
||||
response := runQuestionDialog(parent, m.dialog)
|
||||
response := runQuestionDialog(pointer(parent), m.dialog)
|
||||
if response >= 0 && response < len(m.dialog.Buttons) {
|
||||
button := m.dialog.Buttons[response]
|
||||
if button.Callback != nil {
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@
|
|||
package application
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/wailsapp/wails/v3/internal/go-common-file-dialog/cfd"
|
||||
"github.com/wailsapp/wails/v3/pkg/w32"
|
||||
"golang.org/x/sys/windows"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func (m *windowsApp) showAboutDialog(title string, message string, icon []byte) {
|
||||
|
|
|
|||
|
|
@ -1044,7 +1044,7 @@ func runOpenFileDialog(dialog *OpenFileDialogStruct) ([]string, error) {
|
|||
|
||||
window := nilPointer
|
||||
if dialog.window != nil {
|
||||
window = (dialog.window.(*WebviewWindow).impl).(*linuxWebviewWindow).window
|
||||
window = (dialog.window.impl).(*linuxWebviewWindow).window
|
||||
}
|
||||
|
||||
buttonText := dialog.buttonText
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ func (m *MessageProcessor) processDialogMethod(method int, rw http.ResponseWrite
|
|||
}
|
||||
var detached = args.Bool("Detached")
|
||||
if detached == nil || !*detached {
|
||||
options.Window = window
|
||||
options.Window = window.(*WebviewWindow)
|
||||
}
|
||||
dialog := OpenFileDialogWithOptions(&options)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue