-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathModeFind.h
More file actions
48 lines (39 loc) · 1.14 KB
/
ModeFind.h
File metadata and controls
48 lines (39 loc) · 1.14 KB
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
#include "ConUtils.h"
#include "Mode.h"
class EditScheme;
typedef void(*findcb)(void* data, bool forward, bool next);
class ModeFind : public ModeBase
{
public:
ModeFind(Mode* base, COORD size, COORD pos, findcb cb, void* data)
: ModeBase(base)
, buffer(size)
, pos(pos)
, editPos(0)
, visible(false)
, FindCB(cb)
, data(data)
, caseSensitive(false)
{
}
void Draw(Screen& screen, const EditScheme& scheme, bool focus) const;
bool Do(const KEY_EVENT_RECORD& ker, Screen& screen, const EditScheme& scheme);
bool Do(const MOUSE_EVENT_RECORD& /*mer*/, Screen& /*screen*/, const EditScheme& /*scheme*/) { return true; }
const std::wstring& Find() const { return find; }
bool CaseSensitive() const { return caseSensitive; }
void ToggleCaseSensitive() { caseSensitive = !caseSensitive; }
void setFind(const std::wstring& f)
{
find = f;
editPos = find.length();
}
bool visible;
mutable Buffer buffer;
COORD pos;
private:
std::wstring find;
size_t editPos;
findcb FindCB;
void* data;
bool caseSensitive;
};