This repository has been archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 223
/
sciter-x-msg.h
156 lines (135 loc) · 4.86 KB
/
sciter-x-msg.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
/*
* The Sciter Engine of Terra Informatica Software, Inc.
* http://sciter.com
*
* The code and information provided "as-is" without
* warranty of any kind, either expressed or implied.
*
* (C) Terra Informatica Software, Inc.
*/
/*
* Message definitions to be passed to SciterProcX function
*/
#ifndef __sciter_x_msg_h__
#define __sciter_x_msg_h__
#include "sciter-x-types.h"
#include "sciter-x-def.h"
/** #SCITER_X_MSG_CODE message/function identifier */
typedef enum SCITER_X_MSG_CODE {
SXM_CREATE = 0,
SXM_DESTROY = 1,
SXM_SIZE = 2,
SXM_PAINT = 3,
SXM_RESOLUTION = 4,
SXM_HEARTBIT = 5,
SXM_MOUSE = 6,
SXM_KEY = 7,
SXM_FOCUS = 8,
} SCITER_X_MSG_CODE;
/** #SCITER_X_MSG common header of message structures passed to SciterProcX */
typedef struct SCITER_X_MSG
{
UINT msg; /**< [in] one of the codes of #SCITER_X_MSG_CODE.*/
#ifdef __cplusplus
SCITER_X_MSG(UINT m) : msg(m) {}
#endif
} SCITER_X_MSG;
typedef struct SCITER_X_MSG_CREATE
{
SCITER_X_MSG header;
UINT backend;
SBOOL transparent;
#ifdef __cplusplus
SCITER_X_MSG_CREATE(UINT backendType = GFX_LAYER_SKIA_OPENGL, SBOOL isTransparent = TRUE )
: header(SXM_CREATE), backend(backendType), transparent(isTransparent) {}
#endif
} SCITER_X_MSG_CREATE;
typedef struct SCITER_X_MSG_DESTROY {
SCITER_X_MSG header;
#ifdef __cplusplus
SCITER_X_MSG_DESTROY() : header(SXM_DESTROY) {}
#endif
} SCITER_X_MSG_DESTROY;
typedef struct SCITER_X_MSG_SIZE {
SCITER_X_MSG header;
UINT width;
UINT height;
#ifdef __cplusplus
SCITER_X_MSG_SIZE(UINT w, UINT h) : header(SXM_SIZE), width(w), height(h) {}
#endif
} SCITER_X_MSG_SIZE;
typedef struct SCITER_X_MSG_RESOLUTION {
SCITER_X_MSG header;
UINT pixelsPerInch;
#ifdef __cplusplus
SCITER_X_MSG_RESOLUTION(UINT ppi) : header(SXM_RESOLUTION), pixelsPerInch(ppi) {}
#endif
} SCITER_X_MSG_RESOLUTION;
typedef struct SCITER_X_MSG_MOUSE {
SCITER_X_MSG header;
MOUSE_EVENTS event;
MOUSE_BUTTONS button;
KEYBOARD_STATES modifiers;
POINT pos;
#ifdef __cplusplus
SCITER_X_MSG_MOUSE(MOUSE_EVENTS e, MOUSE_BUTTONS b, KEYBOARD_STATES mods, POINT p) : header(SXM_MOUSE), event(e), button(b), modifiers(mods), pos(p) {}
#endif
} SCITER_X_MSG_MOUSE;
typedef struct SCITER_X_MSG_KEY {
SCITER_X_MSG header;
KEY_EVENTS event;
UINT code;
KEYBOARD_STATES modifiers;
#ifdef __cplusplus
SCITER_X_MSG_KEY(KEY_EVENTS e, UINT c, KEYBOARD_STATES mods) : header(SXM_KEY), event(e), code(c), modifiers(mods) {}
#endif
} SCITER_X_MSG_KEY;
typedef struct SCITER_X_MSG_FOCUS {
SCITER_X_MSG header;
SBOOL got; // true - got, false - lost
#ifdef __cplusplus
SCITER_X_MSG_FOCUS(SBOOL g) : header(SXM_FOCUS), got(g) {}
#endif
} SCITER_X_MSG_FOCUS;
typedef struct SCITER_X_MSG_HEARTBIT {
SCITER_X_MSG header;
UINT time;
#ifdef __cplusplus
SCITER_X_MSG_HEARTBIT(UINT t) : header(SXM_HEARTBIT), time(t) {}
#endif
} SCITER_X_MSG_HEARTBIT;
/** #ELEMENT_BITMAP_RECEIVER - callback function that receives pointer to pixmap and location
* \param[in] bgra \b LPCBYTE, pointer to BGRA bitmap, number of bytes = width * height * 4
* \param[in] x \b INT, position of the bitmap on elements window.
* \param[in] y \b INT, position of the bitmap on elements window.
* \param[in] width \b UINT, width of bitmap (and element's shape).
* \param[in] height \b UINT, height of bitmap (and element's shape).
* \param[in] param \b LPVOID, param that passed as SCITER_X_MSG_PAINT::receiver::param .
**/
typedef VOID SC_CALLBACK ELEMENT_BITMAP_RECEIVER(LPCBYTE rgba, INT x, INT y, UINT width, UINT height, LPVOID param);
/** #SCITER_X_MSG_PAINT target identifier. */
typedef enum SCITER_PAINT_TARGET_TYPE {
SPT_DEFAULT = 0, /**< default rendering target - window surface */
SPT_RECEIVER = 1, /**< target::receiver fields are valid */
SPT_SURFACE = 2, /**< target::pSurface is valid */
//SPT_OPENGL = 3, /**< target is not used - caller shall set current context on its side */
//SPT_OPENGLES = 4, /**< target is not used - caller shall set current context on its side */
//SPT_
} SCITER_PAINT_TARGET_TYPE;
typedef struct SCITER_X_MSG_PAINT {
SCITER_X_MSG header;
HELEMENT element; /**< [in] layer #HELEMENT, can be NULL if whole tree (document) needs to be rendered.*/
SBOOL isFore; /**< [in] if element is not null tells if that element is fore-layer.*/
UINT targetType; /**< [in] one of #SCITER_PAINT_TARGET_TYPE values */
union {
LPVOID pSurface; /**< [in] must be IDXGISurface* */
struct {
VOID* param;
ELEMENT_BITMAP_RECEIVER* callback;
} receiver;
} target;
#ifdef __cplusplus
SCITER_X_MSG_PAINT(HELEMENT layerElement = NULL, SBOOL foreLayer = TRUE) : header(SXM_PAINT), element(layerElement), isFore(foreLayer), targetType(SPT_DEFAULT) {}
#endif
} SCITER_X_MSG_PAINT;
#endif