-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmyrect.cpp
More file actions
38 lines (31 loc) · 808 Bytes
/
Copy pathmyrect.cpp
File metadata and controls
38 lines (31 loc) · 808 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
36
37
38
#include "myrect.h"
#include "application.h"
MyRect::MyRect(Widget *parent, App::PosFunction positioner) : Widget(parent) {
POSITIONER = positioner;
background_color = App::theme.main_background_color;
id = icu::UnicodeString::fromUTF8("MyRect");
}
void MyRect::position(int x, int y, int width, int height) {
t_w = width;
t_h = height;
t_x = x;
t_y = y;
POSITIONER(this);
}
void MyRect::render() {
if (!is_visible) {
return;
}
if (rounded) {
App::DrawRoundedRect(t_x, t_y, t_w, t_h, App::text_padding, background_color);
}else{
App::DrawRect(t_x, t_y, t_w, t_h, background_color);
}
if (border) {
if (rounded) {
App::DrawRoundBorder(t_x, t_y, t_w, t_h, App::theme.border, 5, App::text_padding);
}else{
App::DrawBorder(t_x, t_y, t_w, t_h, App::theme.border);
}
}
}