aboutsummaryrefslogtreecommitdiff
path: root/c/layout.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/layout.h')
-rw-r--r--c/layout.h43
1 files changed, 31 insertions, 12 deletions
diff --git a/c/layout.h b/c/layout.h
index 1b78945..47702c4 100644
--- a/c/layout.h
+++ b/c/layout.h
@@ -9,19 +9,39 @@
void UpdateLayout(int w = 0, int h = 0);
+/* Draggable portions of the client area, such as the split between
+ * two list views, are implemented in Dragger singletons.
+ *
+ * HandleDown and HandleMove are called by the relevant window
+ * procedures for WM_(NC)LBUTTONDOWN and WM_SETCURSOR. */
+
struct Dragger
{
bool HandleDown();
bool HandleMove();
-private:
- bool InDragArea(int x, int y);
+protected:
bool IsDown();
bool IsDouble();
- void Drag(int x, int y);
+ virtual bool InDragArea(int x, int y);
+ virtual void Drag(int x, int y);
+ virtual void Reset();
+ virtual void Done();
+private:
bool m_bActive = false;
long m_time = 0;
};
+/* Dragger for data list view (upper border). */
+
+struct DlvDragger : public Dragger
+{
+private:
+ bool InDragArea(int x, int y) override;
+ void Drag(int x, int y) override;
+ void Reset() override;
+ void Done() override;
+};
+
inline bool Dragger::IsDouble()
{
const long time = GetMessageTime();
@@ -43,13 +63,12 @@ inline bool Dragger::HandleDown()
if (!InDragArea(pt.x, pt.y)) return false;
if (IsDouble()) {
- extern DataListView* g_dlv;
- g_dlv->SetHeight(0);
- Pl("cfg","set_dlv_height",0);
- UpdateLayout();
- return false;
+ m_bActive = false;
+ Reset();
} else
- return m_bActive = true;
+ m_bActive = true;
+
+ return m_bActive;
}
inline bool Dragger::HandleMove()
@@ -64,12 +83,12 @@ inline bool Dragger::HandleMove()
SetCursor(g_hcSizeNs);
else
r = false;
- if (!m_bActive) return r;
+ if (!m_bActive)
+ return r;
Drag(pt.x, pt.y);
if (!IsDown()) {
- extern DataListView* g_dlv;
m_bActive = false;
- Pl("cfg","set_dlv_height",g_dlv->Height());
+ Done();
}
return r;
}