-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMyRichView.h
37 lines (33 loc) · 906 Bytes
/
MyRichView.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
#ifndef _MobiView_MyLogBox_h_
#define _MobiView_MyLogBox_h_
class MyRichView : public RichTextView {
public:
MyRichView() {
zoomlevel = 7;
IsLogWindow = true;
}
virtual void Layout() {
RichTextView::Layout();
PageWidth( int(zoomlevel*GetSize().cx) ); // Smaller the total, the bigger the text
if(IsLogWindow) ScrollEnd(); //TODO: This is not ideal, but it is better than it always scrolling to top.
}
double zoomlevel;
bool IsLogWindow;
void Append(const String &ToAppend) {
String Data = GetQTF();
Data += ToAppend;
SetQTF(Data);
}
virtual void MouseWheel(Point p, int zdelta, dword keyflags) {
if (keyflags == K_CTRL) { // Zooms font
zoomlevel += zdelta/240.;
if (zoomlevel < 1)
zoomlevel = 10;
else if (zoomlevel > 9)
zoomlevel = 1;
RefreshLayoutDeep();
} else // Scrolls down
RichTextView::MouseWheel(p, zdelta, keyflags);
}
};
#endif