-
Notifications
You must be signed in to change notification settings - Fork 0
/
ABCIndex_add.h
58 lines (57 loc) · 1.26 KB
/
ABCIndex_add.h
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
55
56
57
58
// ABCIndex.h : main header file for the PROJECT_NAME application
//
#pragma once
#include "Scintilla.h"
using namespace std;
class SciEdit //: public SimpleControl
{
public:
SciEdit(HWND hwndParent, int id, BOOL initialState = TRUE)// : SimpleControl (hwndParent, id, initialState)
{
UNREFERENCED_PARAMETER(id);
Scintilla_RegisterClasses(GetModuleHandle(NULL));
hwnd = ::CreateWindow(
"Scintilla",
"Source",
WS_BORDER | WS_CHILD | WS_VSCROLL,
20, 150, 500, 250,
hwndParent,
0,
GetModuleHandle(NULL),
0);
::ShowWindow(hwnd, SW_SHOW);
::SetFocus(hwnd);
SendEditor(SCI_SETCODEPAGE, SC_CP_UTF8);
SendEditor(SCI_STYLESETSIZE, STYLE_DEFAULT, 10);
SendEditor(SCI_STYLESETFONT, STYLE_DEFAULT, reinterpret_cast<LPARAM>("courier new"));
SendEditor(SCI_SETEOLMODE, SC_EOL_CRLF);
Enable(initialState);
}
LRESULT SendEditor(UINT Msg, WPARAM wParam = 0, LPARAM lParam = 0)
{
return ::SendMessage(hwnd, Msg, wParam, lParam);
}
void SetFocus()
{
::SetFocus(hwnd);
}
void Show(BOOL state)
{
int show = state ? SW_SHOW : SW_HIDE;
::ShowWindow(hwnd, show);
}
void Enable(BOOL state)
{
::EnableWindow(hwnd, state);
}
BOOL IsVisible()
{
return (::IsWindowVisible(hwnd));
}
HWND Hwnd() const
{
return hwnd;
}
protected:
HWND hwnd;
};