Merge pull request #139 from pftbest/local

OpenFile, SaveFile and MsgBox dialogs
This commit is contained in:
Pietro Gagliardi 2016-06-09 22:00:02 -04:00 committed by GitHub
commit 0846667ce9
1 changed files with 22 additions and 2 deletions

View File

@ -5,8 +5,6 @@ package ui
// #include "ui.h" // #include "ui.h"
import "C" import "C"
// TODO OpenFile, SaveFile, MsgBox
// TODO // TODO
func MsgBoxError(w *Window, title string, description string) { func MsgBoxError(w *Window, title string, description string) {
ctitle := C.CString(title) ctitle := C.CString(title)
@ -15,3 +13,25 @@ func MsgBoxError(w *Window, title string, description string) {
freestr(ctitle) freestr(ctitle)
freestr(cdescription) freestr(cdescription)
} }
func OpenFile(w *Window) string {
cname := C.uiOpenFile(w.w)
name := C.GoString(cname)
C.uiFreeText(cname)
return name
}
func SaveFile(w *Window) string {
cname := C.uiSaveFile(w.w)
name := C.GoString(cname)
C.uiFreeText(cname)
return name
}
func MsgBox(w *Window, title string, description string) {
ctitle := C.CString(title)
cdescription := C.CString(description)
C.uiMsgBox(w.w, ctitle, cdescription)
freestr(ctitle)
freestr(cdescription)
}