diff options
author | nyamatongwe <devnull@localhost> | 2007-07-07 02:54:22 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2007-07-07 02:54:22 +0000 |
commit | 3f2f73d410c84aa74ec109085e51e3338b6b532b (patch) | |
tree | 7681b30a848dc22928a9a8c6fb1b1e71ea2c51fc /win32/PlatWin.cxx | |
parent | 4747b6df30d5d411aafa631fa4436bce0acddfb6 (diff) | |
download | scintilla-mirror-3f2f73d410c84aa74ec109085e51e3338b6b532b.tar.gz |
Allows the popup to be displayed below as long as it can fit on the monitor
the cursor is on rather than flipping up above the current point when near
bottom of window.
Implemented for GTK+ by John Ehresman.
Partial Windows implementation #ifdefed out because it uses calls
unavailable on Windows 95.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r-- | win32/PlatWin.cxx | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 36479e0f2..948e5e655 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -1052,6 +1052,34 @@ void Window::SetTitle(const char *s) { ::SetWindowTextA(reinterpret_cast<HWND>(id), s); } +/* Returns rectangle of monitor pt is on, both rect and pt are in Window's + coordinates */ +#ifdef MULTIPLE_MONITOR_SUPPORT +PRectangle Window::GetMonitorRect(Point pt) { + // MonitorFromPoint and GetMonitorInfoare not available on Windows 95 so are not used. + // There could be conditional code and dynamic loading in a future version + // so this would work on those platforms where they are available. + PRectangle rcPosition = GetPosition(); + POINT ptDesktop = {pt.x + rcPosition.left, pt.y + rcPosition.top}; + HMONITOR hMonitor = ::MonitorFromPoint(ptDesktop, MONITOR_DEFAULTTONEAREST); + MONITORINFOEX mi; + memset(&mi, 0, sizeof(mi)); + mi.cbSize = sizeof(mi); + if (::GetMonitorInfo(hMonitor, &mi)) { + PRectangle rcMonitor( + mi.rcWork.left - rcPosition.left, + mi.rcWork.top - rcPosition.top, + mi.rcWork.right - rcPosition.left, + mi.rcWork.bottom - rcPosition.top); + return rcMonitor; + } +} +#else +PRectangle Window::GetMonitorRect(Point) { + return PRectangle(); +} +#endif + struct ListItemData { const char *text; int pixId; |