aboutsummaryrefslogtreecommitdiff
path: root/c/common.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-02 20:10:35 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-02 20:10:35 +0200
commitae3225a4e7ef86d159fdf27834c453ffcd4da76c (patch)
treef52129b946fdebfee8ffd88bc2b90347786e6e0e /c/common.cpp
parent288f4c294ac1be89b151a3f96eb9d5cb9d91055f (diff)
downloadEpisodeBrowser-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.cpp14
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;
+}