/
EditBox.cpp
43 lines (33 loc) · 961 Bytes
/
EditBox.cpp
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
#include "EditBox.h"
WinGui::EditBox::EditBox(unsigned int _type){
type = _type;
setClassName("RICHEDIT");
newClassReg(false);
setType(type);
memset(&format, NULL, sizeof(CHARFORMAT2));
format.cbSize = sizeof(CHARFORMAT2);
text = new char;
}
WinGui::EditBox::~EditBox(){}
void WinGui::EditBox::SelectUrl(bool yn){
SendMessage(hWnd, EM_AUTOURLDETECT, yn, NULL);
}
void WinGui::EditBox::setBgColor(COLORREF clr){
SendMessage(hWnd, EM_SETBKGNDCOLOR, NULL, clr);
}
void WinGui::EditBox::setTextColor(COLORREF text_clr){
format.dwMask = CFM_COLOR;
format.crTextColor = text_clr;
SendMessage(hWnd, EM_SETCHARFORMAT, SCF_ALL, (LPARAM)&format);
}
int WinGui::EditBox::getText(char* to){
GetWindowText(hWnd, to, GetWindowTextLength(hWnd) + 1);
return 0;
}
int WinGui::EditBox::setText(char* str){
SetWindowText(hWnd, str);
return 0;
}
int WinGui::EditBox::length(){
return GetWindowTextLength(hWnd);
}