From 7ee05f826313410c99a04dcd5907b805d8e1ca3e Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Wed, 4 Jun 2014 23:12:56 -0400 Subject: Added the concept of transience to MsgBox() and MsgBoxError(). Individual implementations will come next. --- dialog.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'dialog.go') diff --git a/dialog.go b/dialog.go index ae94685..5fefd0f 100644 --- a/dialog.go +++ b/dialog.go @@ -11,12 +11,22 @@ import ( // Optionally, secondaryText can be used to show additional information. // If you pass an empty string for secondaryText, neither additional information nor space for additional information will be shown. // On platforms that allow for the message box window to have a title, os.Args[0] is used. -func MsgBox(primaryText string, secondaryText string) { - msgBox(primaryText, secondaryText) +// +// If parent is nil, the message box is modal to the entire application: the user cannot interact with any other window until this one is dismissed. +// Whether or not resizing Windows will still be allowed is implementation-defined; if the implementation does allow it, resizes will still work properly. +// Whether or not the message box stays above all other W+indows in the program is also implementation-defined. +// +// If parent is not nil, the message box is modal to that Window only. +// Attempts to interact with parent will be blocked, but all other Windows in the application can still be used properly. +// The message box will also stay above parent. +// As with parent == nil, resizing is implementation-defined, but will work properly if allowed. [TODO verify] +// If parent has not yet been created, MsgBox() panics. [TODO check what happens if hidden] +func MsgBox(parent *Window, primaryText string, secondaryText string) { + msgBox(parent, primaryText, secondaryText) } // MsgBoxError displays a message box to the user with just an OK button and an icon indicating an error. // Otherwise, it behaves like MsgBox. -func MsgBoxError(primaryText string, secondaryText string) { - msgBoxError(primaryText, secondaryText) +func MsgBoxError(parent *Window, primaryText string, secondaryText string) { + msgBoxError(parent, primaryText, secondaryText) } -- cgit v1.2.3