diff options
-rw-r--r-- | c/layout.cpp | 3 | ||||
-rw-r--r-- | c/layout.h | 28 |
2 files changed, 26 insertions, 5 deletions
diff --git a/c/layout.cpp b/c/layout.cpp index 77aa88e..de1f1f7 100644 --- a/c/layout.cpp +++ b/c/layout.cpp @@ -55,6 +55,9 @@ void Dragger::Drag(const int, const int y) { RECT rrDlv; require(GetRelativeRect(g_dlv->hWnd, &rrDlv)); + + if (y < Dpi(50) || y > rrDlv.bottom-Dpi(20)) return; + int h; h = rrDlv.bottom-y; g_dlv->SetHeight(h); @@ -4,6 +4,7 @@ #include <windows.h> #include "common.h" +#include "datalistview.h" void UpdateLayout(int w = 0, int h = 0); @@ -14,22 +15,39 @@ struct Dragger private: bool InDragArea(int x, int y); bool IsDown(); + bool IsDouble(); void Drag(int x, int y); bool m_bActive = false; + long m_time = 0; }; +inline bool Dragger::IsDouble() +{ + const long time = GetMessageTime(); + const bool dbl = time-m_time <= static_cast<long>(GetDoubleClickTime()); + m_time = time; + return dbl; +} + +inline bool Dragger::IsDown() +{ + return GetKeyState(VK_LBUTTON) & 0x8000; +} + inline bool Dragger::HandleDown() { extern HWND g_hWnd; POINT pt; require(GetRelativeCursorPos(g_hWnd, &pt)); if (!InDragArea(pt.x, pt.y)) return false; - return m_bActive = true; -} -inline bool Dragger::IsDown() -{ - return GetKeyState(VK_LBUTTON) & 0x8000; + if (IsDouble()) { + extern DataListView* g_dlv; + g_dlv->SetHeight(0); + UpdateLayout(); + return false; + } else + return m_bActive = true; } inline bool Dragger::HandleMove() |