Debian Codegraph @

phoenix/windows/widget/console.cpp

raw
1 namespace phoenix {
2
3 static LRESULT CALLBACK Console_windowProc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
4 Console& console = *(Console*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
5 if(msg == WM_CHAR) {
6 if(console.p.keyPress(wparam)) return 0;
7 }
8 return console.p.windowProc(hwnd, msg, wparam, lparam);
9 }
10
11 void pConsole::print(string text) {
12 }
13
14 void pConsole::reset() {
15 }
16
17 void pConsole::constructor() {
18 hwnd = CreateWindowEx(
19 WS_EX_CLIENTEDGE, L"EDIT", L"",
20 WS_CHILD | WS_TABSTOP | ES_READONLY | ES_MULTILINE | ES_WANTRETURN,
21 0, 0, 0, 0, parentHwnd, (HMENU)id, GetModuleHandle(0), 0
22 );
23 SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)&console);
24 setDefaultFont();
25
26 windowProc = (LRESULT CALLBACK (*)(HWND, UINT, LPARAM, WPARAM))GetWindowLongPtr(hwnd, GWLP_WNDPROC);
27 SetWindowLongPtr(hwnd, GWLP_WNDPROC, (LONG_PTR)Console_windowProc);
28 synchronize();
29 }
30
31 void pConsole::destructor() {
32 DestroyWindow(hwnd);
33 }
34
35 void pConsole::orphan() {
36 destructor();
37 constructor();
38 }
39
40 bool pConsole::keyPress(unsigned scancode) {
41 return false;
42 }
43
44 }