-
Notifications
You must be signed in to change notification settings - Fork 15
/
pm_label.h
69 lines (54 loc) · 1.37 KB
/
pm_label.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* File : pm_label.h
* COPYRIGHT (C) 2012-2017, Shanghai Real-Thread Technology Co., Ltd
*
* Change Logs:
* Date Author Notes
* 2017-11-05 realthread the first version
*/
#pragma once
#include <pm_widget.h>
enum AnimationEffect
{
AnimationNone,
AnimationFade,
AnimationMoveUp,
AnimationMoveDown,
AnimationMoveLeft,
AnimationMoveRight,
};
namespace Persimmon
{
class Label : public Widget
{
public:
Label(char* label);
Label(char* label, const Rect& rect);
Label(const char *label, struct rtgui_font* font);
Label(const char *label, struct rtgui_font* font, const Rect& rect);
virtual ~Label();
void setLabel(char* label);
void setLabel(int number);
void setLabel(const char* fmt, ...);
char* getLabel(void);
void clearLabel(void)
{
if (label != RT_NULL) rt_free(label);
label = RT_NULL;
}
void setAnimType(enum AnimationEffect type)
{
this->animType = type;
}
virtual void render(struct rtgui_dc* dc, const Point &dcPoint = Point(),
const Rect &srcRect = Rect(),
RenderFlag flags = DrawNormal);
private:
/* update label display with animation */
void update(char* label);
struct rtgui_dc *getLabelDC(char* label);
private:
char *label;
AnimationEffect animType;
};
}