Mercurial > godwindows
changeset 94:63d6eb6fcb17
Added Dialog related functions... for consistency using HDIALOG instead
of DWDialog in the C version of the code.
author | Brian Smith <brian@dbsoft.org> |
---|---|
date | Tue, 22 Oct 2013 15:12:05 -0500 |
parents | ce016a1b9034 |
children | 996d862896fb |
files | src/dw/dw.go src/dw/dwglue.c |
diffstat | 2 files changed, 48 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dw/dw.go Thu Oct 03 20:54:15 2013 -0500 +++ b/src/dw/dw.go Tue Oct 22 15:12:05 2013 -0500 @@ -108,6 +108,9 @@ hcont HANDLE filesystem bool } +type HDIALOG struct { + hdialog unsafe.Pointer +} type HEV struct { hev unsafe.Pointer } @@ -4727,6 +4730,36 @@ return Mutex_trylock(handle); } +// Allocates and initializes a dialog. +func Dialog_new() HDIALOG { + return HDIALOG{C.go_dialog_new()}; +} + +// Allocates and initializes a dialog. +func DialogNew() HDIALOG { + return Dialog_new(); +} + +// Accepts a dialog and returns the given data to the initial call of Dialog_wait(). +func Dialog_dismiss(handle HDIALOG, result POINTER) int { + return int(C.go_dialog_dismiss(unsafe.Pointer(handle.hdialog), unsafe.Pointer(result))); +} + +// Returns the given data to the initial call of Wait(). +func (handle HDIALOG) Dismiss(result uintptr) int { + return Dialog_dismiss(handle, POINTER(result)); +} + +// Accepts a dialog, waits for Dialog_dismiss() to be called by a signal handler with the given dialog. +func Dialog_wait(handle HDIALOG) POINTER { + return POINTER(C.go_dialog_wait(unsafe.Pointer(handle.hdialog))); +} + +// Waits for Dismiss() to be called by a signal handler. +func (handle HDIALOG) Wait() uintptr { + return uintptr(Dialog_wait(handle)); +} + // Creates an unnamed event semaphore. func Event_new() HEV { return HEV{C.go_event_new()};
--- a/src/dw/dwglue.c Thu Oct 03 20:54:15 2013 -0500 +++ b/src/dw/dwglue.c Tue Oct 22 15:12:05 2013 -0500 @@ -1126,6 +1126,21 @@ return dw_mutex_trylock((HMTX)mutex); } +static void *go_dialog_new(void) +{ + return (void *)dw_dialog_new(NULL); +} + +static int go_dialog_dismiss(void *dialog, void *result) +{ + return dw_dialog_dismiss((DWDialog *)dialog, result); +} + +static void *go_dialog_wait(void *dialog) +{ + return (void *)dw_dialog_wait((DWDialog *)dialog); +} + static void *go_event_new(void) { return (void *)dw_event_new();