-
Notifications
You must be signed in to change notification settings - Fork 15
/
pm_window.h
92 lines (72 loc) · 2.09 KB
/
pm_window.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* File : pm_window.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 <rtgui/widgets/window.h>
#include <pm_widget.h>
#include <pm_container.h>
#include <vector>
namespace Persimmon
{
class Window : public Container
{
typedef Container super;
public:
/* create a main window */
Window(const char *title);
/* create a normal window */
Window(struct rtgui_win *parent, const char *title, rtgui_rect_t *rect, rt_uint16_t style);
virtual ~Window();
virtual int show(rt_bool_t isModal = RT_FALSE);
virtual void close(int code);
void close()
{
close(0);
}
void hide()
{
rtgui_win_hide(getWindow());
}
void move(int x, int y);
struct rtgui_win* getWindow(void)
{
return RTGUI_WIN(widget);
}
void winPaintEnable(bool paint = true)
{
WIN_PAINT = paint;
}
rt_bool_t privateEventHandler(struct rtgui_event *event);
virtual rt_bool_t eventHandler(struct rtgui_event *event);
virtual bool dealKbd(struct rtgui_event_kbd *kev);
void saveClip(struct rtgui_region ®ion);
void restoreClip(struct rtgui_region ®ion);
void addFloatingWidget(Widget *widget);
void removeFloatingWidget(Widget *widget);
void renderFloatingWidget(rtgui_rect_t *rect);
void renderLogo(rtgui_rect_t *rect);
void claerMouse(void)
{
RTGUI_MOUSE_BUTTON_IS_DOWN = false;
}
protected:
void paintChildren();
bool dealMouseButton(struct rtgui_event_mouse *mev);
bool dealMouseMotion(struct rtgui_event_mouse *mev);
bool dealGesture(struct rtgui_event_gesture *mev);
private:
void setupMouseOwner(struct rtgui_event_mouse *mev);
Widget *setupMouseOwnerFloating(struct rtgui_event_mouse *mev);
struct rtgui_gesture gesture;
Widget *mouseEventOwner;
rt_uint32_t curMouseId;
bool WIN_PAINT, RTGUI_MOUSE_BUTTON_IS_DOWN;
/* floating widget */
std::vector<Widget*> childrenFloating;
};
}