Files

77 lines
1.6 KiB
Go
Raw Permalink Normal View History

2023-06-15 13:53:22 -05:00
package application
2024-02-07 22:19:33 +11:00
func (a *linuxApp) showAboutDialog(title string, message string, icon []byte) {
window := globalApplication.getWindowForID(a.getCurrentWindowID())
2023-09-29 11:29:31 -05:00
var parent uintptr
2023-06-15 13:53:22 -05:00
if window != nil {
2023-09-29 11:29:31 -05:00
parent, _ = window.(*WebviewWindow).NativeWindowHandle()
2023-06-15 13:53:22 -05:00
}
2023-06-24 13:57:51 +10:00
about := newMessageDialog(InfoDialogType)
2023-06-15 13:53:22 -05:00
about.SetTitle(title).
SetMessage(message).
SetIcon(icon)
2024-04-07 18:40:10 -06:00
InvokeAsync(func() {
runQuestionDialog(
pointer(parent),
about,
)
})
2023-06-15 13:53:22 -05:00
}
type linuxDialog struct {
dialog *MessageDialog
}
func (m *linuxDialog) show() {
windowId := getNativeApplication().getCurrentWindowID()
window := globalApplication.getWindowForID(windowId)
2023-09-29 11:29:31 -05:00
var parent uintptr
2023-06-15 13:53:22 -05:00
if window != nil {
2023-09-29 11:29:31 -05:00
parent, _ = window.(*WebviewWindow).NativeWindowHandle()
2023-06-15 13:53:22 -05:00
}
2024-04-07 18:40:10 -06:00
InvokeAsync(func() {
response := runQuestionDialog(pointer(parent), m.dialog)
if response >= 0 && response < len(m.dialog.Buttons) {
button := m.dialog.Buttons[response]
if button.Callback != nil {
go button.Callback()
}
2023-06-15 13:53:22 -05:00
}
2024-04-07 18:40:10 -06:00
})
2023-06-15 13:53:22 -05:00
}
func newDialogImpl(d *MessageDialog) *linuxDialog {
return &linuxDialog{
dialog: d,
}
}
type linuxOpenFileDialog struct {
2023-06-24 13:57:51 +10:00
dialog *OpenFileDialogStruct
2023-06-15 13:53:22 -05:00
}
2023-06-24 13:57:51 +10:00
func newOpenFileDialogImpl(d *OpenFileDialogStruct) *linuxOpenFileDialog {
2023-06-15 13:53:22 -05:00
return &linuxOpenFileDialog{
dialog: d,
}
}
2023-09-29 23:54:57 -05:00
func (m *linuxOpenFileDialog) show() (chan string, error) {
return runOpenFileDialog(m.dialog)
2023-06-15 13:53:22 -05:00
}
type linuxSaveFileDialog struct {
2023-06-24 13:57:51 +10:00
dialog *SaveFileDialogStruct
2023-06-15 13:53:22 -05:00
}
2023-06-24 13:57:51 +10:00
func newSaveFileDialogImpl(d *SaveFileDialogStruct) *linuxSaveFileDialog {
2023-06-15 13:53:22 -05:00
return &linuxSaveFileDialog{
dialog: d,
}
}
2023-09-29 23:54:57 -05:00
func (m *linuxSaveFileDialog) show() (chan string, error) {
return runSaveFileDialog(m.dialog)
2023-06-15 13:53:22 -05:00
}