1 module awebview.wrapper.cpp.webviewlistener; 2 3 4 mixin template Awesomium() 5 { 6 enum Cursor 7 { 8 pointer, 9 cross, 10 hand, 11 iBeam, 12 wait, 13 help, 14 eastResize, 15 northResize, 16 northEastResize, 17 northWestResize, 18 southResize, 19 southEastResize, 20 southWestResize, 21 westResize, 22 northSouthResize, 23 eastWestResize, 24 northEastSouthWestResize, 25 northWestSouthEastResize, 26 columnResize, 27 rowResize, 28 middlePanning, 29 eastPanning, 30 northPanning, 31 northEastPanning, 32 northWestPanning, 33 southPanning, 34 southEastPanning, 35 southWestPanning, 36 westPanning, 37 move, 38 verticalText, 39 cell, 40 contextMenu, 41 alias_, 42 progress, 43 noDrop, 44 copy, 45 none, 46 notAllowed, 47 zoomIn, 48 zoomOut, 49 grab, 50 grabbing, 51 custom 52 } 53 54 55 enum FocusedElementType { none, text, link, input, textInput, editableContext, plugin, other } 56 enum TerminationStatus { normal, abnormall, killed, crashed, stillRunning } 57 enum TextInputType { none, text, password, search, email, number, telephone, url } 58 enum WebFileChooserMode { open, openMultiple, openFolder, save } 59 60 align(1) struct WebFileChooserInfo 61 { 62 WebFileChooserMode mode; 63 WebString.Field title; 64 WebString.Field default_file_name; 65 WebStringArray.Field accept_types; 66 } 67 68 align(1) struct WebPopupMenuInfo 69 { 70 Rect bounds; 71 int item_height; 72 double item_font_size; 73 int selected_item; 74 WebMenuItemArray.Field items; 75 bool right_aligned; 76 } 77 78 enum MediaType { none, image, vide, audio, file, plugin } 79 enum MediaState 80 { 81 none = 0x0, 82 error = 0x1, 83 paused = 0x2, 84 muted = 0x4, 85 loop = 0x8, 86 canSave = 0x10, 87 hasAudio = 0x20, 88 hasVideo = 0x40 89 } 90 91 enum CanEditFlags 92 { 93 nothing = 0x0, 94 undo = 0x1, 95 redo = 0x2, 96 cut = 0x4, 97 copy = 0x8, 98 paste = 0x10, 99 delete_ = 0x20, 100 selectAll = 0x40 101 } 102 103 enum CertError 104 { 105 none, 106 commonNameInvalid, 107 dataInvalid, 108 authorityInvalid, 109 containsErrors, 110 noRevocationMechanism, 111 unableToCheckRevocation, 112 revoked, 113 invalid, 114 weakSignatureAlgorithm, 115 weakKey, 116 notInDNS, 117 unknown 118 } 119 120 align(1) struct WebContextMenuInfo 121 { 122 int pos_x; 123 int pos_y; 124 MediaType media_type; 125 int media_state; 126 WebURL.Field link_url; 127 WebURL.Field src_url; 128 WebURL.Field page_url; 129 WebURL.Field frame_url; 130 long frame_id; 131 WebString.Field selection_text; 132 bool is_editable; 133 int edit_flags; 134 } 135 136 align(1) struct WebLoginDialogInfo 137 { 138 int request_id; 139 WebString.Field request_url; 140 bool is_proxy; 141 WebString.Field host; 142 ushort port; 143 WebString.Field scheme; 144 WebString.Field realm; 145 } 146 147 enum SecurityStatus 148 { 149 unknown, unauthenticated, authenticationBroken, authenticated 150 } 151 152 enum ContentStatusFlags 153 { 154 normal = 0, 155 displayedInsecureContent = 1 << 0, 156 ranInsecureContent = 1 << 1 157 } 158 159 align(1) struct WebPageInfo 160 { 161 WebURL.Field page_url; 162 SecurityStatus security_status; 163 int content_status; 164 CertError cert_error; 165 WebString.Field cert_subject; 166 WebString.Field cert_issuer; 167 } 168 169 170 extern(C++, WebViewListener) 171 { 172 interface View {} 173 interface Load {} 174 interface Process {} 175 interface Menu {} 176 interface Dialog {} 177 interface Print {} 178 interface Download {} 179 interface InputMethodEditor {} 180 } 181 } 182 183 184 mixin template Awesomium4D() 185 { 186 mixin ViewHeader!(); 187 mixin LoadHeader!(); 188 mixin ProcessHeader!(); 189 mixin MenuHeader!(); 190 mixin DialogHeader!(); 191 mixin PrintHeader!(); 192 mixin DownloadHeader!(); 193 mixin InputMethodEditorHeader!(); 194 } 195 196 197 mixin template ViewHeader() 198 { 199 interface IViewListenerD 200 { 201 void onChangeTitle(Awesomium.WebView, const Awesomium.WebString); 202 void onChangeAddressBar(Awesomium.WebView, const Awesomium.WebURL); 203 void onChangeTooltip(Awesomium.WebView, const Awesomium.WebString); 204 void onChangeTargetURL(Awesomium.WebView, const Awesomium.WebURL); 205 void onChangeCursor(Awesomium.WebView, Awesomium.Cursor); 206 void onChangeFocus(Awesomium.WebView, Awesomium.FocusedElementType); 207 void onAddConsoleMessage(Awesomium.WebView, const Awesomium.WebString, int, const Awesomium.WebString); 208 void onShowCreatedWebView(Awesomium.WebView, Awesomium.WebView, const Awesomium.WebURL, const Awesomium.WebURL, const(Awesomium.Rect)*, bool); 209 } 210 211 212 interface ViewListenerD2Cpp : Awesomium.WebViewListener.View {} 213 214 extern(C++, ViewListenerD2CppMember) 215 { 216 ViewListenerD2Cpp newCtor(IViewListenerD p, ulong mid); 217 void deleteDtor(ViewListenerD2Cpp); 218 } 219 220 extern(C++, WebViewListenerViewMember) 221 { 222 void OnChangeTitle(Awesomium.WebViewListener.View, Awesomium.WebView caller, 223 const Awesomium.WebString title); 224 225 void OnChangeAddressBar(Awesomium.WebViewListener.View, Awesomium.WebView caller, 226 const Awesomium.WebURL url); 227 228 void OnChangeTooltip(Awesomium.WebViewListener.View, Awesomium.WebView caller, 229 const Awesomium.WebString tooltip); 230 231 void OnChangeTargetURL(Awesomium.WebViewListener.View, Awesomium.WebView caller, 232 const Awesomium.WebURL url); 233 234 void OnChangeCursor(Awesomium.WebViewListener.View, Awesomium.WebView caller, 235 Cursor cursor); 236 237 void OnChangeFocus(Awesomium.WebViewListener.View, Awesomium.WebView caller, 238 FocusedElementType fet); 239 240 void OnAddConsoleMessage(Awesomium.WebViewListener.View, Awesomium.WebView caller, 241 const Awesomium.WebString msg, 242 int line_num, 243 const Awesomium.WebString src); 244 245 void OnShowCreatedWebView(Awesomium.WebViewListener.View, Awesomium.WebView caller, 246 Awesomium.WebView new_view, 247 const Awesomium.WebURL opener_url, 248 const Awesomium.WebURL target_url, 249 const(Rect)* initial_pos, 250 bool is_popup); 251 } 252 } 253 254 255 mixin template LoadHeader() 256 { 257 interface ILoadListenerD 258 { 259 void onBeginLoadingFrame(Awesomium.WebView, long, bool, const Awesomium.WebURL, bool); 260 void onFailLoadingFrame(Awesomium.WebView, long, bool, const Awesomium.WebURL, int, const Awesomium.WebString); 261 void onFinishLoadingFrame(Awesomium.WebView, long, bool, const Awesomium.WebURL); 262 void onDocumentReady(Awesomium.WebView, const Awesomium.WebURL); 263 } 264 265 266 interface LoadListenerD2Cpp : Awesomium.WebViewListener.Load {} 267 268 extern(C++, LoadListenerD2CppMember) 269 { 270 LoadListenerD2Cpp newCtor(ILoadListenerD, ulong mid); 271 void deleteDtor(LoadListenerD2Cpp); 272 } 273 274 extern(C++, WebViewListenerLoadMember) 275 { 276 void OnBeginLoadingFrame(Awesomium.WebViewListener.Load p, Awesomium.WebView caller, 277 long frame_id, bool is_main_frame, 278 const Awesomium.WebURL url, 279 bool is_error_page); 280 281 void OnFailLoadingFrame(Awesomium.WebViewListener.Load p, Awesomium.WebView caller, 282 long frame_id, bool is_main_frame, 283 const Awesomium.WebURL url, 284 int error_code, 285 const Awesomium.WebString error_desc); 286 287 void OnFinishLoadingFrame(Awesomium.WebViewListener.Load p, Awesomium.WebView caller, 288 long frame_id, bool is_main_frame, 289 const Awesomium.WebURL url); 290 291 void OnDocumentReady(Awesomium.WebViewListener.Load p, Awesomium.WebView caller, 292 const Awesomium.WebURL url); 293 } 294 } 295 296 297 mixin template ProcessHeader() 298 { 299 interface IProcessListenerD 300 { 301 void onLaunch(Awesomium.WebView); 302 void onUnresponsive(Awesomium.WebView); 303 void onResponsive(Awesomium.WebView); 304 void onCrashed(Awesomium.WebView, Awesomium.TerminationStatus); 305 } 306 307 308 interface ProcessListenerD2Cpp : Awesomium.WebViewListener.Process {} 309 310 extern(C++, ProcessListenerD2CppMember) 311 { 312 ProcessListenerD2Cpp newCtor(IProcessListenerD p, ulong mid); 313 void deleteDtor(ProcessListenerD2Cpp); 314 } 315 316 317 extern(C++, WebViewListenerProcessMember) 318 { 319 void OnLaunch(Awesomium.WebViewListener.Process p, Awesomium.WebView caller); 320 void OnUnresponsive(Awesomium.WebViewListener.Process p, Awesomium.WebView caller); 321 void OnResponsive(Awesomium.WebViewListener.Process p, Awesomium.WebView caller); 322 void OnCrashed(Awesomium.WebViewListener.Process p, Awesomium.WebView caller, 323 Awesomium.TerminationStatus status); 324 } 325 } 326 327 328 mixin template MenuHeader() 329 { 330 interface IMenuListenerD 331 { 332 void onShowPopupMenu(Awesomium.WebView, const Awesomium.WebPopupMenuInfo*); 333 void onShowContextMenu(Awesomium.WebView, const WebContextMenuInfo*); 334 } 335 336 interface MenuListenerD2Cpp : Awesomium.WebViewListener.Menu {} 337 extern(C++, MenuListenerD2CppMember) 338 { 339 MenuListenerD2Cpp newCtor(IMenuListenerD, ulong); 340 void deleteDtor(MenuListenerD2Cpp); 341 } 342 343 extern(C++, WebViewListenerMenuMember) 344 { 345 void OnShowPopupMenu(Awesomium.WebViewListener.Menu p, Awesomium.WebView caller, 346 const Awesomium.WebPopupMenuInfo* menu_info); 347 348 void OnShowContextMenu(Awesomium.WebViewListener.Menu p, Awesomium.WebView caller, 349 const Awesomium.WebContextMenuInfo* menu_info); 350 } 351 } 352 353 354 mixin template DialogHeader() 355 { 356 interface IDialogListenerD 357 { 358 void onShowFileChooser(Awesomium.WebView, const Awesomium.WebFileChooserInfo*); 359 void onShowLoginDialog(Awesomium.WebView, const Awesomium.WebLoginDialogInfo*); 360 void onShowCertificateErrorDialog(Awesomium.WebView, bool, const Awesomium.WebURL, Awesomium.CertError); 361 void onShowPageInfoDialog(Awesomium.WebView, const Awesomium.WebPageInfo*); 362 } 363 364 interface DialogListenerD2Cpp : Awesomium.WebViewListener.Dialog {} 365 extern(C++, DialogListenerD2CppMember) 366 { 367 DialogListenerD2Cpp newCtor(IDialogListenerD p, ulong mid); 368 void deleteDtor(DialogListenerD2Cpp); 369 } 370 371 372 extern(C++, WebViewListenerDialogMember) 373 { 374 void OnShowFileChooser(Awesomium.WebViewListener.Dialog p, 375 Awesomium.WebView caller, 376 const Awesomium.WebFileChooserInfo* info); 377 378 void OnShowLoginDialog(Awesomium.WebViewListener.Dialog p, 379 Awesomium.WebView caller, 380 const Awesomium.WebLoginDialogInfo* info); 381 382 void OnShowCertificateErrorDialog(Awesomium.WebViewListener.Dialog p, 383 Awesomium.WebView caller, 384 bool is_overridable, 385 const Awesomium.WebURL url, 386 Awesomium.CertError error); 387 388 void OnShowPageInfoDialog(Awesomium.WebViewListener.Dialog p, 389 Awesomium.WebView caller, 390 const Awesomium.WebPageInfo* info); 391 } 392 } 393 394 395 mixin template PrintHeader() 396 { 397 interface IPrintListenerD 398 { 399 void onRequestPrint(Awesomium.WebView); 400 void onFailPrint(Awesomium.WebView, int); 401 void onFinishPrint(Awesomium.WebView, int, const Awesomium.WebStringArray); 402 } 403 404 405 interface PrintListenerD2Cpp : Awesomium.WebViewListener.Print {} 406 extern(C++, PrintListenerD2CppMember) 407 { 408 PrintListenerD2Cpp newCtor(IPrintListenerD, ulong); 409 void deleteDtor(PrintListenerD2Cpp); 410 } 411 412 413 extern(C++, WebViewListenerPrintMember) 414 { 415 void OnRequestPrint(Awesomium.WebViewListener.Print p, 416 Awesomium.WebView caller); 417 418 void OnFailPrint(Awesomium.WebViewListener.Print p, 419 Awesomium.WebView caller, 420 int request_id); 421 422 void OnFinishPrint(Awesomium.WebViewListener.Print p, 423 Awesomium.WebView caller, 424 int request_id, 425 const Awesomium.WebStringArray file_list); 426 } 427 } 428 429 430 mixin template DownloadHeader() 431 { 432 interface IDownloadListenerD 433 { 434 void onRequestDownload(Awesomium.WebView, int, 435 const Awesomium.WebURL, 436 const Awesomium.WebString, 437 const Awesomium.WebString); 438 439 void onUpdateDownload(Awesomium.WebView, int, 440 long, long, long); 441 442 void onFinishDownload(Awesomium.WebView, int, 443 const Awesomium.WebURL, 444 const Awesomium.WebString); 445 } 446 447 448 interface DownloadListenerD2Cpp : Awesomium.WebViewListener.Download {} 449 extern(C++, DownloadListenerD2CppMember) 450 { 451 DownloadListenerD2Cpp newCtor(IDownloadListenerD, ulong); 452 void deleteDtor(DownloadListenerD2Cpp); 453 } 454 455 extern(C++, WebViewListenerDownloadMember) 456 { 457 void OnRequestDownload(Awesomium.WebViewListener.Download p, 458 Awesomium.WebView caller, 459 int download_id, 460 const Awesomium.WebURL url, 461 const Awesomium.WebString suggested_filename, 462 const Awesomium.WebString mime_type); 463 464 void OnUpdateDownload(Awesomium.WebViewListener.Download p, 465 Awesomium.WebView caller, 466 int download_id, 467 long total_bytes, 468 long received_bytes, 469 long current_speed); 470 471 void OnFinishDownload(Awesomium.WebViewListener.Download p, 472 Awesomium.WebView caller, 473 int download_id, 474 const Awesomium.WebURL url, 475 const Awesomium.WebString saved_path); 476 } 477 } 478 479 480 mixin template InputMethodEditorHeader() 481 { 482 interface IInputMethodEditorD 483 { 484 void onUpdateIME(Awesomium.WebView, 485 Awesomium.TextInputType, 486 int, int); 487 488 void onCancelIME(Awesomium.WebView); 489 490 void onChangeIMERange(Awesomium.WebView, 491 uint, uint); 492 } 493 494 495 interface InputMethodEditorD2Cpp : Awesomium.WebViewListener.InputMethodEditor {} 496 extern(C++, InputMethodEditorD2CppMember) 497 { 498 InputMethodEditorD2Cpp newCtor(IInputMethodEditorD, ulong); 499 void deleteDtor(InputMethodEditorD2Cpp); 500 } 501 502 503 extern(C++, WebViewListenerInputMethodEditorMember) 504 { 505 void OnUpdateIME(Awesomium.WebViewListener.InputMethodEditor p, 506 Awesomium.WebView caller, 507 Awesomium.TextInputType type, 508 int caret_x, int caret_y); 509 510 void OnCancelIME(Awesomium.WebViewListener.InputMethodEditor p, 511 Awesomium.WebView caller); 512 513 void OnChangeIMERange(Awesomium.WebViewListener.InputMethodEditor p, 514 Awesomium.WebView caller, 515 uint start, uint end); 516 } 517 }