diff options
author | Toni Uhlig <matzeton@googlemail.com> | 2020-05-24 16:48:22 +0200 |
---|---|---|
committer | Toni Uhlig <matzeton@googlemail.com> | 2020-05-25 21:57:14 +0200 |
commit | 31c69b6ca1b91e7fd9fd8e14082fd2584c5f538c (patch) | |
tree | 16e789c7d68608831b498f41f54d9482b82a711a /source/tools/dummy_gui/callbacks.c |
first public release
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'source/tools/dummy_gui/callbacks.c')
-rw-r--r-- | source/tools/dummy_gui/callbacks.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/source/tools/dummy_gui/callbacks.c b/source/tools/dummy_gui/callbacks.c new file mode 100644 index 0000000..3bc40fd --- /dev/null +++ b/source/tools/dummy_gui/callbacks.c @@ -0,0 +1,94 @@ +#include "callbacks.h" +#include "resource.h" + +// Window procedure for our main window. +LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) +{ + static HINSTANCE hInstance; + + switch (msg) + { + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case ID_HELP_ABOUT: + { + DialogBox(hInstance, MAKEINTRESOURCE(IDD_ABOUTDIALOG), hWnd, &AboutDialogProc); + return 0; + } + + case ID_FILE_EXIT: + { + DestroyWindow(hWnd); + return 0; + } + } + break; + } + + case WM_GETMINMAXINFO: + { + MINMAXINFO *minMax = (MINMAXINFO*) lParam; + minMax->ptMinTrackSize.x = 220; + minMax->ptMinTrackSize.y = 110; + + return 0; + } + + case WM_SYSCOMMAND: + { + switch (LOWORD(wParam)) + { + case ID_HELP_ABOUT: + { + DialogBox(hInstance, MAKEINTRESOURCE(IDD_ABOUTDIALOG), hWnd, &AboutDialogProc); + return 0; + } + } + break; + } + + case WM_CREATE: + { + hInstance = ((LPCREATESTRUCT) lParam)->hInstance; + return 0; + } + + case WM_DESTROY: + { + PostQuitMessage(0); + return 0; + } + } + + return DefWindowProc(hWnd, msg, wParam, lParam); +} + + +// Dialog procedure for our "about" dialog. +INT_PTR CALLBACK AboutDialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + (void)lParam; + switch (uMsg) + { + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDOK: + case IDCANCEL: + { + EndDialog(hwndDlg, (INT_PTR) LOWORD(wParam)); + return (INT_PTR) TRUE; + } + } + break; + } + + case WM_INITDIALOG: + return (INT_PTR) TRUE; + } + + return (INT_PTR) FALSE; +} |