blob: 4780821b482e9b0c1930b454b31d71b250bda4c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#ifndef LAYOUT_H
#define LAYOUT_H
#include <windows.h>
#include "win.h"
/* Given main window's width and height, set appropriate positions and
* sizes for child windows. */
void UpdateLayout(int w = 0, int h = 0);
/* Dragger objects implement draggable portions of the client area,
* such as the split between two list views. HandleLButtonDown and
* HandleSetCursor are called by relevant window procedures upon
* WM_(NC)LBUTTONDOWN and WM_SETCURSOR. */
struct Window;
struct Dragger
{
Window& parent;
bool HandleLButtonDown();
bool HandleSetCursor();
inline Dragger(Window& parent) : parent(parent) {}
protected:
bool IsDown() const;
bool IsDouble(const long time, const POINT& pt);
virtual bool InDragArea(int x, int y) const = 0;
/* Perform drag, resizing relevant windows. */
virtual void Drag(int x, int y) const = 0;
/* Reset dragger to automatic position. */
virtual void Reset() const = 0;
/* Called after drag, when mouse button is released. */
virtual void Done() const = 0;
private:
bool m_bActive = false;
long m_time0 = 0;
POINT m_pt0 = {0, 0};
};
/* DlvDragger implements the draggable split between the data list
* view and the episode list view. */
struct DlvDragger : public Dragger
{
inline DlvDragger(Window& parent) : Dragger(parent) {}
private:
bool InDragArea(int x, int y) const override;
void Drag(int x, int y) const override;
void Reset() const override;
void Done() const override;
};
#endif
|