web-external.h
2.13 KB
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
/*
TE4 - T-Engine 4
Copyright (C) 2009 - 2018 Nicolas Casalini
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Nicolas Casalini "DarkGod"
darkgod@te4.org
*/
#ifndef __TE4WEB_EXTERNAL_H__
#define __TE4WEB_EXTERNAL_H__
enum web_event_kind {
// Internal stuff
TE4_WEB_EVENT_DELETE_TEXTURE,
// Eternal stuff
TE4_WEB_EVENT_TITLE_CHANGE,
TE4_WEB_EVENT_REQUEST_POPUP_URL,
TE4_WEB_EVENT_DOWNLOAD_REQUEST,
TE4_WEB_EVENT_DOWNLOAD_UPDATE,
TE4_WEB_EVENT_DOWNLOAD_FINISH,
TE4_WEB_EVENT_LOADING,
TE4_WEB_EVENT_LOCAL_REQUEST,
TE4_WEB_EVENT_RUN_LUA,
TE4_WEB_EVENT_END_BROWSER,
TE4_WEB_EVENT_BROWSER_COUNT,
};
typedef struct {
enum web_event_kind kind;
int handlers;
union {
const char *title;
struct {
const char *url;
int w, h;
} popup;
struct {
long id;
const char *url;
const char *mime;
const char *name;
} download_request;
struct {
long id;
long total, got, speed;
int percent;
} download_update;
struct {
long id;
} download_finish;
struct {
const char *url;
signed char status;
} loading;
struct {
int id;
const char *path;
} local_request;
struct {
const char *code;
} run_lua;
void *texture;
int count;
} data;
} WebEvent;
enum web_js_kind {
TE4_WEB_JS_NULL,
TE4_WEB_JS_BOOLEAN,
TE4_WEB_JS_NUMBER,
TE4_WEB_JS_STRING,
};
typedef struct {
enum web_js_kind kind;
union {
bool b;
double n;
const char *s;
} data;
} WebJsValue;
typedef struct {
void *opaque;
int w, h;
int last_mouse_x, last_mouse_y;
int handlers;
bool closed;
} web_view_type;
#endif