diff options
Diffstat (limited to 'win32/oscilloview.c')
-rw-r--r-- | win32/oscilloview.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/win32/oscilloview.c b/win32/oscilloview.c index 1478614..12851f4 100644 --- a/win32/oscilloview.c +++ b/win32/oscilloview.c @@ -24,12 +24,15 @@ static struct { struct oscillodata oscillodata[LIBOPNA_OSCILLO_TRACK_COUNT]; UINT mmtimer; HPEN whitepen; + void (*closecb)(void *ptr); + void *cbptr; } g; static void on_destroy(HWND hwnd) { g.oscilloview = 0; timeKillEvent(g.mmtimer); DeleteObject(g.whitepen); + if (g.closecb) g.closecb(g.cbptr); } static void CALLBACK mmtimer_cb(UINT timerid, UINT msg, @@ -111,7 +114,9 @@ static LRESULT CALLBACK wndproc( return DefWindowProc(hwnd, msg, wParam, lParam); } -void show_oscilloview(HINSTANCE hinst, HWND parent) { +void oscilloview_open(HINSTANCE hinst, HWND parent, void (*closecb)(void *ptr), void *cbptr) { + g.closecb = closecb; + g.cbptr = cbptr; g.hinst = hinst; g.parent = parent; if (!g.oscilloview) { @@ -140,3 +145,10 @@ void show_oscilloview(HINSTANCE hinst, HWND parent) { SetForegroundWindow(g.oscilloview); } } + +void oscilloview_close(void) { + if (g.oscilloview) { + g.closecb = 0; + DestroyWindow(g.oscilloview); + } +} |