-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebview.ads
216 lines (163 loc) · 6.06 KB
/
webview.ads
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
with Interfaces.C.Strings;
with Interfaces.C;
with System;
package Webview is
type Version is record
major : Interfaces.C.unsigned;
minor : Interfaces.C.unsigned;
patch : Interfaces.C.unsigned;
end record
with Convention => C_Pass_By_Copy;
type Version_Info is record
version_t : Version;
version_number : Interfaces.C.char_array (0 .. 31);
pre_release : Interfaces.C.char_array (0 .. 47);
build_metadata : Interfaces.C.char_array (0 .. 47);
end record
with Convention => C_Pass_By_Copy;
type Webview_Type is new System.Address;
type Native_Handle_Kind is
(UI_Window,
UI_Widget,
Browser_Controller)
with Convention => C;
type Hint is
(None,
Min,
Max,
Fixed)
with Convention => C;
Webview_Error : exception;
function Create (debug : Boolean := False; window : System.Address := System.Null_Address) return Webview_Type;
procedure Destroy (w : Webview_Type);
procedure Run (w : Webview_Type);
procedure Terminate_It (w : Webview_Type);
procedure Dispatch
(w : Webview_Type;
fn : access procedure (w : Webview_Type; arg : System.Address);
arg : System.Address);
function Get_Window (w : Webview_Type) return System.Address;
function Get_Native_Handle (w : Webview_Type; kind : Native_Handle_Kind) return System.Address;
procedure Set_Title (w : Webview_Type; title : String);
procedure Set_Size
(w : Webview_Type;
width : Integer;
height : Integer;
hints : Hint);
procedure Navigate (w : Webview_Type; url : String);
procedure Set_Html (w : Webview_Type; html : String);
procedure Init (w : Webview_Type; js : String);
procedure Eval (w : Webview_Type; js : String);
procedure Bind
(w : Webview_Type;
name : String;
fn : access procedure
(id : Interfaces.C.Strings.chars_ptr;
req : Interfaces.C.Strings.chars_ptr;
arg : System.Address);
arg : System.Address);
procedure Unbind (w : Webview_Type; name : String);
procedure Ret
(w : Webview_Type;
id : String;
status : Integer;
result : String);
function Get_Version return access constant Version_Info;
package Raw is
type Error is new Interfaces.C.int;
Error_Missing_Dependency : constant Error := -5;
Error_Canceled : constant Error := -4;
Error_Invalid_State : constant Error := -3;
Error_Invalid_Argument : constant Error := -2;
Error_Unspecified : constant Error := -1;
Error_Ok : constant Error := 0;
Error_Duplicate : constant Error := 1;
Error_Not_Found : constant Error := 2;
function Create (debug : Interfaces.C.int; window : System.Address) return Webview_Type
with Import => True,
Convention => C,
External_Name => "webview_create";
function Destroy (w : Webview_Type) return Error
with Import => True,
Convention => C,
External_Name => "webview_destroy";
function Run (w : Webview_Type) return Error
with Import => True,
Convention => C,
External_Name => "webview_run";
function Terminate_It (w : Webview_Type) return Error
with Import => True,
Convention => C,
External_Name => "webview_terminate";
function Dispatch
(w : Webview_Type;
fn : access procedure (w : Webview_Type; arg : System.Address);
arg : System.Address) return Error
with Import => True,
Convention => C,
External_Name => "webview_dispatch";
function Get_Window (w : Webview_Type) return System.Address
with Import => True,
Convention => C,
External_Name => "webview_get_window";
function Get_Native_Handle (w : Webview_Type; kind : Native_Handle_Kind) return System.Address
with Import => True,
Convention => C,
External_Name => "webview_get_native_handle";
function Set_Title (w : Webview_Type; title : Interfaces.C.Strings.chars_ptr) return Error
with Import => True,
Convention => C,
External_Name => "webview_set_title";
function Set_Size
(w : Webview_Type;
width : Interfaces.C.int;
height : Interfaces.C.int;
hints : Hint) return Error
with Import => True,
Convention => C,
External_Name => "webview_set_size";
function Navigate (w : Webview_Type; url : Interfaces.C.Strings.chars_ptr) return Error
with Import => True,
Convention => C,
External_Name => "webview_navigate";
function Set_Html (w : Webview_Type; html : Interfaces.C.Strings.chars_ptr) return Error
with Import => True,
Convention => C,
External_Name => "webview_set_html";
function Init (w : Webview_Type; js : Interfaces.C.Strings.chars_ptr) return Error
with Import => True,
Convention => C,
External_Name => "webview_init";
function Eval (w : Webview_Type; js : Interfaces.C.Strings.chars_ptr) return Error
with Import => True,
Convention => C,
External_Name => "webview_eval";
function Bind
(w : Webview_Type;
name : Interfaces.C.Strings.chars_ptr;
fn : access procedure
(id : Interfaces.C.Strings.chars_ptr;
req : Interfaces.C.Strings.chars_ptr;
arg : System.Address);
arg : System.Address) return Error
with Import => True,
Convention => C,
External_Name => "webview_bind";
function Unbind (w : Webview_Type; name : Interfaces.C.Strings.chars_ptr) return Error
with Import => True,
Convention => C,
External_Name => "webview_unbind";
function Ret
(w : Webview_Type;
id : Interfaces.C.Strings.chars_ptr;
status : Interfaces.C.int;
result : Interfaces.C.Strings.chars_ptr) return Error
with Import => True,
Convention => C,
External_Name => "webview_return";
function Get_Version return access constant Version_Info
with Import => True,
Convention => C,
External_Name => "webview_version";
end Raw;
end Webview;