-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscrollnotify.cpp
More file actions
35 lines (27 loc) · 890 Bytes
/
Copy pathscrollnotify.cpp
File metadata and controls
35 lines (27 loc) · 890 Bytes
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
#include "scrollnotify.h"
#include "application.h"
#include "text_renderer.h"
ScrollNotify::ScrollNotify(Widget *parent, Positioner positioner) : Widget(parent) {
POSITIONER = positioner;
clickthrough = true;
id = icu::UnicodeString::fromUTF8("ScrollNotify - ") + text;
}
void ScrollNotify::position(int x, int y, int width, int height) {
POSITIONER(this, x, y, width, height);
}
void ScrollNotify::render() {
if (!is_visible || text.length() == 0) {
return;
}
TextRenderer::draw_text(t_x+offset, t_y+App::text_padding, text, App::theme.main_text_color);
offset -= App::text_padding*0.75*App::settings->getValue("anim_speed", 1.0f);
if (offset < -TextRenderer::get_text_width(text.length())) {
text = icu::UnicodeString();
}
App::time_till_regular = 2;
Widget::render();
}
void ScrollNotify::displayMessage(icu::UnicodeString txt) {
offset = t_w;
text = txt;
}