c_browser.cpp 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* This file was generated by Maki Compiler, do not edit manually */
  2. #include <precomp.h>
  3. #include "c_browser.h"
  4. #include <api/script/objcontroller.h>
  5. C_Browser::C_Browser(ScriptObject *object) : C_GuiObject(object) {
  6. inited = 0;
  7. C_hook(object);
  8. }
  9. C_Browser::C_Browser() {
  10. inited = 0;
  11. obj = NULL;
  12. }
  13. void C_Browser::C_hook(ScriptObject *object) {
  14. ASSERT(!inited);
  15. ScriptObjectController *controller = object->vcpu_getController();
  16. obj = controller->cast(object, browserGuid);
  17. if (obj != object && obj != NULL)
  18. controller = obj->vcpu_getController();
  19. else
  20. obj = NULL;
  21. int iter = WASABI_API_APP->app_getInitCount();
  22. if (!loaded || loaded != iter) {
  23. loaded = iter;
  24. navigateurl_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"navigateUrl", this);
  25. back_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"back", this);
  26. forward_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"forward", this);
  27. stop_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"stop", this);
  28. refresh_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"refresh", this);
  29. home_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"home", this);
  30. settargetname_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"setTargetName", this);
  31. onbeforenavigate_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onBeforeNavigate", this);
  32. ondocumentcomplete_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onDocumentComplete", this);
  33. onmedialink_id = WASABI_API_MAKI->maki_addDlfRef(controller, L"onMediaLink", this);
  34. }
  35. inited = 1;
  36. }
  37. C_Browser::~C_Browser() {
  38. }
  39. ScriptObject *C_Browser::getScriptObject() {
  40. if (obj != NULL) return obj;
  41. return C_BROWSER_PARENT::getScriptObject();
  42. }
  43. void C_Browser::navigateUrl(const wchar_t *url)
  44. {
  45. ASSERT(inited);
  46. scriptVar a = MAKE_SCRIPT_STRING(url);
  47. scriptVar *params[1] = {&a};
  48. WASABI_API_MAKI->maki_callFunction(getScriptObject(), navigateurl_id, params);
  49. }
  50. void C_Browser::back() {
  51. ASSERT(inited);
  52. WASABI_API_MAKI->maki_callFunction(getScriptObject(), back_id, NULL);
  53. }
  54. void C_Browser::forward() {
  55. ASSERT(inited);
  56. WASABI_API_MAKI->maki_callFunction(getScriptObject(), forward_id, NULL);
  57. }
  58. void C_Browser::stop() {
  59. ASSERT(inited);
  60. WASABI_API_MAKI->maki_callFunction(getScriptObject(), stop_id, NULL);
  61. }
  62. void C_Browser::refresh() {
  63. ASSERT(inited);
  64. WASABI_API_MAKI->maki_callFunction(getScriptObject(), refresh_id, NULL);
  65. }
  66. void C_Browser::home() {
  67. ASSERT(inited);
  68. WASABI_API_MAKI->maki_callFunction(getScriptObject(), home_id, NULL);
  69. }
  70. void C_Browser::setTargetName(const wchar_t *targetname) {
  71. ASSERT(inited);
  72. scriptVar a = MAKE_SCRIPT_STRING(targetname);
  73. scriptVar *params[1] = {&a};
  74. WASABI_API_MAKI->maki_callFunction(getScriptObject(), settargetname_id, params);
  75. }
  76. int C_Browser::onBeforeNavigate(const wchar_t *url, int flags, const wchar_t *targetframename) {
  77. ASSERT(inited);
  78. scriptVar a = MAKE_SCRIPT_STRING(url);
  79. scriptVar b = MAKE_SCRIPT_INT(flags);
  80. scriptVar c = MAKE_SCRIPT_STRING(targetframename);
  81. scriptVar *params[3] = {&a, &b, &c};
  82. return GET_SCRIPT_INT(WASABI_API_MAKI->maki_callFunction(getScriptObject(), onbeforenavigate_id, params));
  83. }
  84. void C_Browser::onDocumentComplete(const wchar_t *url) {
  85. ASSERT(inited);
  86. scriptVar a = MAKE_SCRIPT_STRING(url);
  87. scriptVar *params[1] = {&a};
  88. WASABI_API_MAKI->maki_callFunction(getScriptObject(), ondocumentcomplete_id, params);
  89. }
  90. void C_Browser::onMediaLink(const wchar_t *url)
  91. {
  92. ASSERT(inited);
  93. scriptVar a = MAKE_SCRIPT_STRING(url);
  94. scriptVar *params[1] = {&a};
  95. WASABI_API_MAKI->maki_callFunction(getScriptObject(), onmedialink_id, params);
  96. }
  97. int C_Browser::loaded=0;
  98. int C_Browser::navigateurl_id=0;
  99. int C_Browser::back_id=0;
  100. int C_Browser::forward_id=0;
  101. int C_Browser::stop_id=0;
  102. int C_Browser::refresh_id=0;
  103. int C_Browser::home_id=0;
  104. int C_Browser::settargetname_id=0;
  105. int C_Browser::onbeforenavigate_id=0;
  106. int C_Browser::ondocumentcomplete_id=0;
  107. int C_Browser::onmedialink_id=0;