2014-03-02 17:37:25 -06:00
|
|
|
// 2 march 2014
|
2014-03-12 20:55:45 -05:00
|
|
|
|
2014-03-02 17:37:25 -06:00
|
|
|
package ui
|
|
|
|
|
|
|
|
import (
|
|
|
|
// ...
|
|
|
|
)
|
|
|
|
|
|
|
|
// #include "objc_darwin.h"
|
|
|
|
import "C"
|
|
|
|
|
2014-06-04 23:53:26 -05:00
|
|
|
func _msgBox(parent *Window, primarytext string, secondarytext string, style uintptr) {
|
2014-03-02 17:37:25 -06:00
|
|
|
ret := make(chan struct{})
|
|
|
|
defer close(ret)
|
|
|
|
uitask <- func() {
|
2014-06-04 23:53:26 -05:00
|
|
|
var pwin C.id = nil
|
|
|
|
|
|
|
|
if parent != nil {
|
|
|
|
pwin = parent.sysData.id
|
|
|
|
}
|
2014-05-15 18:08:24 -05:00
|
|
|
primary := toNSString(primarytext)
|
|
|
|
secondary := C.id(nil)
|
2014-04-10 11:34:30 -05:00
|
|
|
if secondarytext != "" {
|
2014-05-15 18:08:24 -05:00
|
|
|
secondary = toNSString(secondarytext)
|
|
|
|
}
|
|
|
|
switch style {
|
|
|
|
case 0: // normal
|
2014-06-04 23:53:26 -05:00
|
|
|
C.msgBox(pwin, primary, secondary)
|
2014-05-15 18:08:24 -05:00
|
|
|
case 1: // error
|
2014-06-04 23:53:26 -05:00
|
|
|
C.msgBoxError(pwin, primary, secondary)
|
2014-04-10 11:34:30 -05:00
|
|
|
}
|
2014-03-02 17:37:25 -06:00
|
|
|
ret <- struct{}{}
|
|
|
|
}
|
|
|
|
<-ret
|
|
|
|
}
|
|
|
|
|
2014-06-04 23:53:26 -05:00
|
|
|
func msgBox(parent *Window, primarytext string, secondarytext string) {
|
|
|
|
_msgBox(parent, primarytext, secondarytext, 0)
|
2014-03-02 17:37:25 -06:00
|
|
|
}
|
|
|
|
|
2014-06-04 23:53:26 -05:00
|
|
|
func msgBoxError(parent *Window, primarytext string, secondarytext string) {
|
|
|
|
_msgBox(parent, primarytext, secondarytext, 1)
|
2014-03-02 17:37:25 -06:00
|
|
|
}
|