diff options
| author | Pietro Gagliardi <[email protected]> | 2016-06-09 22:00:02 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2016-06-09 22:00:02 -0400 |
| commit | 0846667ce92deab378169b16c918b137dc68dd81 (patch) | |
| tree | 252a07cb1b6b9dd7cb0ec57de265326472c68b06 /stddialogs.go | |
| parent | a8a9dd456db4a320a9db2350b143582aaeea544d (diff) | |
| parent | a8bcf1a4fab9dc59f6c786c9cc38f0800a5c9990 (diff) | |
Merge pull request #139 from pftbest/local
OpenFile, SaveFile and MsgBox dialogs
Diffstat (limited to 'stddialogs.go')
| -rw-r--r-- | stddialogs.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/stddialogs.go b/stddialogs.go index ed12772..7954512 100644 --- a/stddialogs.go +++ b/stddialogs.go @@ -5,8 +5,6 @@ package ui // #include "ui.h" import "C" -// TODO OpenFile, SaveFile, MsgBox - // TODO func MsgBoxError(w *Window, title string, description string) { ctitle := C.CString(title) @@ -15,3 +13,25 @@ func MsgBoxError(w *Window, title string, description string) { freestr(ctitle) 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) +} |
