diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-02 20:10:35 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-02 20:10:35 +0200 |
commit | ae3225a4e7ef86d159fdf27834c453ffcd4da76c (patch) | |
tree | f52129b946fdebfee8ffd88bc2b90347786e6e0e /c/common.cpp | |
parent | 288f4c294ac1be89b151a3f96eb9d5cb9d91055f (diff) | |
download | EpisodeBrowser-ae3225a4e7ef86d159fdf27834c453ffcd4da76c.tar.gz |
Implement draggable split.
Next step is to allow a double click to reset the split to be
automatically resized.
Diffstat (limited to 'c/common.cpp')
-rw-r--r-- | c/common.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/c/common.cpp b/c/common.cpp index 2e16c59..fcf1da2 100644 --- a/c/common.cpp +++ b/c/common.cpp @@ -148,3 +148,17 @@ int EBMessageBox(const wchar_t* const wszText, const wchar_t* const wszCaption, require(UnhookWindowsHookEx(hHook)); return r; } + +int GetRelativeCursorPos(HWND hWnd, POINT* pt) +{ + RECT rc; + if (!GetClientRect(hWnd, &rc)) return 0; + SetLastError(ERROR_SUCCESS); + if (!MapWindowPoints(hWnd, NULL, (POINT*)&rc, 2)) return 0; + + POINT ptMouse; + if (!GetCursorPos(&ptMouse)) return 0; + pt->x = ptMouse.x-rc.left; + pt->y = ptMouse.y-rc.top; + return 1; +} |