diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-30 09:57:44 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-30 09:57:44 -0400 |
| commit | 33155f7496a818a1ed83fe49cccb63be7842bc81 (patch) | |
| tree | bbb14af3d92becf7d5ca5abfb28630a2b413ad93 /dialog.go | |
| parent | e032807546a96e6489d18a0e42ced51b7c31a55c (diff) | |
Reverted everything back to the old API.
Diffstat (limited to 'dialog.go')
| -rw-r--r-- | dialog.go | 22 |
1 files changed, 7 insertions, 15 deletions
@@ -2,16 +2,8 @@ package ui -// Response denotes a response from the user to a Dialog. -type Response uint -const ( - NotDone Response = iota - OK -) - // sentinel (not nil so programmer errors don't go undetected) // this window is invalid and cannot be used directly -// notice the support it uses var dialogWindow = new(Window) // MsgBox displays an informational message box to the user with just an OK button. @@ -22,16 +14,16 @@ var dialogWindow = new(Window) // // See "On Dialogs" in the package overview for behavioral information. func MsgBox(primaryText string, secondaryText string) { - dialogWindow.msgBox(primaryText, secondaryText) + <-dialogWindow.msgBox(primaryText, secondaryText) } // MsgBox is the Window method version of the package-scope function MsgBox. // See that function's documentation and "On Dialogs" in the package overview for more information. -func (w *Window) MsgBox(primaryText string, secondaryText string) { +func (w *Window) MsgBox(primaryText string, secondaryText string) (done chan struct{}) { if !w.created { panic("parent window passed to Window.MsgBox() before it was created") } - w.msgBox(primaryText, secondaryText) + return w.msgBox(primaryText, secondaryText) } // MsgBoxError displays a message box to the user with just an OK button and an icon indicating an error. @@ -39,14 +31,14 @@ func (w *Window) MsgBox(primaryText string, secondaryText string) { // // See "On Dialogs" in the package overview for more information. func MsgBoxError(primaryText string, secondaryText string) { - dialogWindow.msgBoxError(primaryText, secondaryText) + <-dialogWindow.msgBoxError(primaryText, secondaryText) } // MsgBoxError is the Window method version of the package-scope function MsgBoxError. // See that function's documentation and "On Dialogs" in the package overview for more information. -func (w *Window) MsgBoxError(primaryText string, secondaryText string) { +func (w *Window) MsgBoxError(primaryText string, secondaryText string) (done chan struct{}) { if !w.created { - panic("parent window passed to Window.MsgBox() before it was created") + panic("parent window passed to MsgBoxError() before it was created") } - w.msgBoxError(primaryText, secondaryText) + return w.msgBoxError(primaryText, secondaryText) } |
