-
Notifications
You must be signed in to change notification settings - Fork 15
/
pm_textbox.h
62 lines (47 loc) · 1.11 KB
/
pm_textbox.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
/*
* File : pm_textbox.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>
namespace Persimmon
{
class TextBox : public Widget
{
public:
TextBox(const Rect& rect);
TextBox(struct rtgui_font* font, const Rect& rect);
virtual ~TextBox();
void addText(char* text);
void addText(char text);
void addText(int num);
void cutText(void);
char* getText(void);
void clearText(void)
{
if (text != RT_NULL) rt_free(text);
text = RT_NULL;
textLen = 0;
}
void setTextMaxLen(int len)
{
textMaxLen = len;
}
void enableMask(bool mas = true)
{
mask = mas;
}
virtual void render(struct rtgui_dc* dc, const Point &dcPoint = Point(),
const Rect &srcRect = Rect(),
RenderFlag flags = DrawNormal);
private:
void updateText(const char* fmt, ...);
char *text;
int textMaxLen, textLen;
bool mask;
};
}