diff --git a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj index 9cd4ad5..0474516 100644 --- a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj +++ b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj @@ -100,10 +100,11 @@ + + - @@ -116,12 +117,14 @@ + + diff --git a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.filters b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.filters index 7ff2528..61eef75 100644 --- a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.filters +++ b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.filters @@ -37,7 +37,7 @@ Header Files - + Header Files @@ -60,6 +60,9 @@ Header Files + + Header Files + @@ -83,6 +86,9 @@ Source Files + + Source Files + @@ -97,5 +103,8 @@ Form Files + + Form Files + \ No newline at end of file diff --git a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user index d642770..93cae60 100644 --- a/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user +++ b/OfficeAssistant_msvc/OfficeAssistant_msvc.vcxproj.user @@ -5,9 +5,9 @@ WindowsLocalDebugger - 2023-07-29T22:55:59.2650920Z + 2023-07-30T09:15:49.0117730Z - 2023-07-29T22:56:00.1037375Z + 2023-07-30T09:15:57.3451755Z \ No newline at end of file diff --git a/OfficeAssistant_msvc/mainscreen.cpp b/OfficeAssistant_msvc/mainscreen.cpp index 0dffaec..1ee0f69 100644 --- a/OfficeAssistant_msvc/mainscreen.cpp +++ b/OfficeAssistant_msvc/mainscreen.cpp @@ -9,71 +9,70 @@ #include "netio.h" #include #include +#include MainScreen::MainScreen(QWidget *parent) : QWidget(parent), ui(new Ui::MainScreen) { ui->setupUi(this); - layout = nullptr; - layout_left = nullptr; - broswer = nullptr; + broswer = new QWidget(this); + button = new QPushButton(this); + button->setHidden(true); + button->setStyleSheet("border-style:none;padding:10px;border-radius:5px;background-color:#FFFFFF"); + //Plus Math icon by Icons8 + QString dir = QApplication::applicationDirPath(); + icon = new QIcon(dir + "/images/add.png"); + button->setIcon(*icon); + layout = new QHBoxLayout; + layout->addWidget(broswer,4); + this->setLayout(layout); + //QSizePolicy sizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::QSizePolicy::Expanding); + //broswer->setSizePolicy(sizePolicy); + miniblink = new QMiniBlink(broswer,this); + miniblink->show(); + //miniblink->setSizePolicy(sizePolicy); + thread = new QThread; + miniblink->moveToThread(thread); + connect(thread, &QThread::started, miniblink, &QMiniBlink::init); + connect(thread, &QThread::finished, thread, &QThread::deleteLater); + connect(this, &MainScreen::destroy, miniblink, &QMiniBlink::destroy); + connect(this, &MainScreen::changeUrl, miniblink, &QMiniBlink::switchUrl); + thread->start(); } MainScreen::~MainScreen() { - delete ui; + + delete ui; } void MainScreen::clickButton1(QString text, QString url) { - LRESULT *result=new LRESULT; - try { - mbFireWindowsMessage(mbView, mbGetHostHWND(mbView), WM_DESTROY, 0, 0, result); - delete result; - } - catch(std::exception e){ - delete result; - } - if (text == "微信多开") { - if (layout == nullptr) { - layout = new QHBoxLayout; - button = new QPushButton; - button->setStyleSheet("border-style:none;padding:10px;border-radius:5px;background-color:#FFFFFF"); - //Plus Math icon by Icons8 - QString dir = QApplication::applicationDirPath(); - icon = new QIcon(dir + "/images/add.png"); - button->setIcon(*icon); - connect(button, &QPushButton::click, this, &MainScreen::startWeChat); - layout->addWidget(button, 1); - if (broswer == nullptr) { - broswer = new QWidget; - } - layout->addWidget(broswer,4); - this->setLayout(layout); - mbView = mbCreateWebWindow(MB_WINDOW_TYPE_CONTROL, (HWND)broswer->winId(), 0, 0, broswer->width(), broswer->height()); - mbShowWindow(mbView, TRUE); - mbLoadURL(mbView, url.toStdString().c_str()); - mbRunMessageLoop(); - mbUninit(); + if (text == QString::fromLocal8Bit("微信多开")) { + button->setHidden(false); + connect(button, &QPushButton::click, this, &MainScreen::startWeChat); + if (button->layout() == nullptr) { + layout->insertWidget(1, button); } - else { - mbView = mbCreateWebWindow(MB_WINDOW_TYPE_CONTROL, (HWND)broswer->winId(), 0, 0, broswer->width(), broswer->height()); - mbShowWindow(mbView, TRUE); - mbLoadURL(mbView, url.toStdString().c_str()); - mbRunMessageLoop(); - mbUninit(); + if (broswer->layout() == nullptr) { + layout->addWidget(broswer, 4); } + emit changeUrl(url); + } else { - if (broswer == nullptr) { - broswer = new QWidget; + if (button->layout() != nullptr) { + layout->removeWidget(button); + button->setHidden(true); } - setLayout(nullptr); - broswer->setGeometry(0, 0, width(), height()); - mbView = mbCreateWebWindow(MB_WINDOW_TYPE_CONTROL, (HWND)broswer->winId(), 0, 0, broswer->width(), broswer->height()); - mbShowWindow(mbView, TRUE); - mbLoadURL(mbView, url.toStdString().c_str()); - mbRunMessageLoop(); - mbUninit(); + emit changeUrl(url); } } void MainScreen::startWeChat() { - ShellExecute(GetDesktopWindow(), L"open", L"wxdk.exe", L"", QApplication::applicationDirPath().toStdWString().c_str(), SW_SHOW); -} \ No newline at end of file + QString path = QApplication::applicationDirPath(); + QString exe = path + "/wxdk.exe"; + ShellExecute(GetDesktopWindow(), L"open", exe.toStdWString().c_str(), L"", path.toStdWString().c_str(), SW_SHOW); +} +//void MainScreen::resizeEvent(QResizeEvent *event) { +// QWidget::resizeEvent(event); +// //broswer->resize(event->size().width() / 5 * 4, event->size().height()); +// miniblink->resize(event->size().width() / 5 * 4, event->size().height()); +// miniblink->update(); +//} diff --git a/OfficeAssistant_msvc/mainscreen.h b/OfficeAssistant_msvc/mainscreen.h index 5b5b817..52882a1 100644 --- a/OfficeAssistant_msvc/mainscreen.h +++ b/OfficeAssistant_msvc/mainscreen.h @@ -9,7 +9,8 @@ #include #include #include -#include "mb.h" +#include "wke.h" +#include "qminiblink.h" QT_BEGIN_NAMESPACE namespace Ui { class MainScreen; } @@ -17,12 +18,16 @@ QT_END_NAMESPACE class MainScreen : public QWidget { Q_OBJECT - +signals: + void destroy(); + void changeUrl(QString url); public: explicit MainScreen(QWidget *parent = nullptr); ~MainScreen() override; public slots: void clickButton1(QString text, QString url); +protected: + //void resizeEvent(QResizeEvent *event) override; private: Ui::MainScreen *ui; QHBoxLayout *layout; @@ -30,9 +35,12 @@ private: QPushButton *button; QIcon *icon; QWidget *broswer; - mbWebView mbView; + static bool isInited(); + QThread *thread; + QMiniBlink *miniblink; private slots: void startWeChat(); + }; diff --git a/OfficeAssistant_msvc/mainwindow.cpp b/OfficeAssistant_msvc/mainwindow.cpp index ef8af04..39df1eb 100644 --- a/OfficeAssistant_msvc/mainwindow.cpp +++ b/OfficeAssistant_msvc/mainwindow.cpp @@ -19,10 +19,10 @@ MainWindow::MainWindow(QWidget *parent) : setCentralWidget(mainWindowLayout); if(deskRect.width()*scale>1920){ resize(1600,1080); - this->setMaximumWidth(1600); + //this->setMaximumWidth(1600); }else{ resize(800, 540); - this->setMaximumWidth(800); + //this->setMaximumWidth(800); } diff --git a/OfficeAssistant_msvc/mainwindowlayout.cpp b/OfficeAssistant_msvc/mainwindowlayout.cpp index 1e15099..3d89ab2 100644 --- a/OfficeAssistant_msvc/mainwindowlayout.cpp +++ b/OfficeAssistant_msvc/mainwindowlayout.cpp @@ -17,12 +17,12 @@ MainWindowLayout::MainWindowLayout(QWidget *parent) : configRequest->sendRequest(configResponse); navBar=new NavBar(configResponse,this); mainScreen=new MainScreen(); - //QSizePolicy sizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::QSizePolicy::Fixed); - //navBar->setSizePolicy(sizePolicy); + layout->setMargin(0); layout->addWidget(navBar,1); - layout->addWidget(mainScreen,4); + layout->addWidget(mainScreen,7); setLayout(layout); + connect(this, &MainWindowLayout::clickButton1, mainScreen, &MainScreen::clickButton1); } MainWindowLayout::~MainWindowLayout() { @@ -35,13 +35,15 @@ MainWindowLayout::~MainWindowLayout() { void MainWindowLayout::resizeEvent(QResizeEvent *event) { QWidget::resizeEvent(event); - navBar->resize(navBar->width(),height()/5); + navBar->resize(navBar->width(),height()/8); //layout->setAlignment(Qt::AlignmentFlag::AlignHCenter); } void MainWindowLayout::clickButton(QString text, QString url) { - if (text == "计算器") { - ShellExecute(GetDesktopWindow(), L"open", L"startclas.exe", L"", QApplication::applicationDirPath().toStdWString().c_str(), SW_SHOW); + QString path = QApplication::applicationDirPath(); + path += "/startcalc.exe"; + if (text== QString::fromLocal8Bit("计算器")) { + WinExec(path.toStdString().c_str(), SW_SHOW); } else{ emit clickButton1(text, url); diff --git a/OfficeAssistant_msvc/mb.h b/OfficeAssistant_msvc/mb.h deleted file mode 100644 index 2597526..0000000 --- a/OfficeAssistant_msvc/mb.h +++ /dev/null @@ -1,1176 +0,0 @@ -锘/* -* -* wolar@qq.com -* http://miniblink.net -* https://github.com/weolar/miniblink49 -* https://miniblink.net/views/doc/index.html api鏂囨。鍦板潃 -* licence Apache-2.0 -* -*/ - -#ifndef MB_DEFINE_H -#define MB_DEFINE_H - -#include - -////////////////////////////////////////////////////////////////////////// - -#define MB_CALL_TYPE __stdcall - -typedef struct _mbRect { - int x; - int y; - int w; - int h; - -#if defined(__cplusplus) - _mbRect() - { - x = 0; - y = 0; - w = 0; - h = 0; - } - _mbRect(int xVal, int yVal, int wVal, int hVal) - { - x = xVal; - y = yVal; - w = wVal; - h = hVal; - } - _mbRect(const _mbRect& other) - { - x = other.x; - y = other.y; - w = other.w; - h = other.h; - } -#endif -} mbRect; - -typedef struct _mbPoint { - int x; - int y; -} mbPoint; - -typedef struct _mbSize { - int w; - int h; -} mbSize; - -typedef enum { - MB_LBUTTON = 0x01, - MB_RBUTTON = 0x02, - MB_SHIFT = 0x04, - MB_CONTROL = 0x08, - MB_MBUTTON = 0x10, -} mbMouseFlags; - -typedef enum { - MB_EXTENDED = 0x0100, - MB_REPEAT = 0x4000, -} mbKeyFlags; - -typedef enum { - MB_MSG_MOUSEMOVE = 0x0200, - MB_MSG_LBUTTONDOWN = 0x0201, - MB_MSG_LBUTTONUP = 0x0202, - MB_MSG_LBUTTONDBLCLK = 0x0203, - MB_MSG_RBUTTONDOWN = 0x0204, - MB_MSG_RBUTTONUP = 0x0205, - MB_MSG_RBUTTONDBLCLK = 0x0206, - MB_MSG_MBUTTONDOWN = 0x0207, - MB_MSG_MBUTTONUP = 0x0208, - MB_MSG_MBUTTONDBLCLK = 0x0209, - MB_MSG_MOUSEWHEEL = 0x020A, -} mbMouseMsg; - -#if !defined(__cplusplus) -#ifndef HAVE_WCHAR_T -typedef unsigned short wchar_t; -#endif -#endif - -#include - -#if defined(__cplusplus) -#define MB_EXTERN_C extern "C" -#else -#define MB_EXTERN_C -#endif - -typedef char utf8; - -typedef enum { - MB_PROXY_NONE, - MB_PROXY_HTTP, - MB_PROXY_SOCKS4, - MB_PROXY_SOCKS4A, - MB_PROXY_SOCKS5, - MB_PROXY_SOCKS5HOSTNAME -} mbProxyType; - -typedef struct { - mbProxyType type; - char hostname[100]; - unsigned short port; - char username[50]; - char password[50]; -} mbProxy; - -typedef enum _mbSettingMask { - MB_SETTING_PROXY = 1, - MB_ENABLE_NODEJS = 1 << 3, - MB_ENABLE_DISABLE_H5VIDEO = 1 << 4, - MB_ENABLE_DISABLE_PDFVIEW = 1 << 5, - MB_ENABLE_DISABLE_CC = 1 << 6, - MB_ENABLE_ENABLE_EGLGLES2 = 1 << 7, // 娴嬭瘯鍔熻兘锛岃鍕夸娇鐢 - MB_ENABLE_ENABLE_SWIFTSHAER = 1 << 8, // 娴嬭瘯鍔熻兘锛岃鍕夸娇鐢 -} mbSettingMask; - -typedef void(MB_CALL_TYPE* mbOnBlinkThreadInitCallback)(void* param); - -#define kMbVersion 20200319 -#define kMbMaxVersion 20600319 - -typedef struct _mbSettings { - mbProxy proxy; - unsigned int mask; // 208 offset - mbOnBlinkThreadInitCallback blinkThreadInitCallback; - void* blinkThreadInitCallbackParam; - intptr_t version; - const wchar_t* mainDllPath; - HMODULE mainDllHandle; - const char* config; -} mbSettings; - -typedef struct _mbViewSettings { - int size; - unsigned int bgColor; -} mbViewSettings; - -typedef void* mbWebFrameHandle; -typedef void* mbNetJob; - -#if defined(__cplusplus) -namespace mb { class MbWebView; } -#else -struct _tagMbWebView; -#endif -typedef intptr_t mbWebView; - -#ifdef _WIN64 -typedef __int64 mbWebView; -#else -typedef int mbWebView; -#endif - -#define NULL_WEBVIEW 0 - -typedef BOOL(*mbCookieVisitor)( - void* params, - const char* name, - const char* value, - const char* domain, - const char* path, // If |path| is non-empty only URLs at or below the path will get the cookie value. - int secure, // If |secure| is true the cookie will only be sent for HTTPS requests. - int httpOnly, // If |httponly| is true the cookie will only be sent for HTTP requests. - int* expires // The cookie expiration date is only valid if |has_expires| is true. - ); - -typedef enum { - mbCookieCommandClearAllCookies, - mbCookieCommandClearSessionCookies, - mbCookieCommandFlushCookiesToFile, - mbCookieCommandReloadCookiesFromFile, -} mbCookieCommand; - -typedef enum { - MB_NAVIGATION_TYPE_LINKCLICK, - MB_NAVIGATION_TYPE_FORMSUBMITTE, - MB_NAVIGATION_TYPE_BACKFORWARD, - MB_NAVIGATION_TYPE_RELOAD, - MB_NAVIGATION_TYPE_FORMRESUBMITT, - MB_NAVIGATION_TYPE_OTHER -} mbNavigationType; - -typedef enum { - kMbCursorInfoPointer, - kMbCursorInfoCross, - kMbCursorInfoHand, - kMbCursorInfoIBeam, - kMbCursorInfoWait, - kMbCursorInfoHelp, - kMbCursorInfoEastResize, - kMbCursorInfoNorthResize, - kMbCursorInfoNorthEastResize, - kMbCursorInfoNorthWestResize, - kMbCursorInfoSouthResize, - kMbCursorInfoSouthEastResize, - kMbCursorInfoSouthWestResize, - kMbCursorInfoWestResize, - kMbCursorInfoNorthSouthResize, - kMbCursorInfoEastWestResize, - kMbCursorInfoNorthEastSouthWestResize, - kMbCursorInfoNorthWestSouthEastResize, - kMbCursorInfoColumnResize, - kMbCursorInfoRowResize, - kMbCursorInfoMiddlePanning, - kMbCursorInfoEastPanning, - kMbCursorInfoNorthPanning, - kMbCursorInfoNorthEastPanning, - kMbCursorInfoNorthWestPanning, - kMbCursorInfoSouthPanning, - kMbCursorInfoSouthEastPanning, - kMbCursorInfoSouthWestPanning, - kMbCursorInfoWestPanning, - kMbCursorInfoMove, - kMbCursorInfoVerticalText, - kMbCursorInfoCell, - kMbCursorInfoContextMenu, - kMbCursorInfoAlias, - kMbCursorInfoProgress, - kMbCursorInfoNoDrop, - kMbCursorInfoCopy, - kMbCursorInfoNone, - kMbCursorInfoNotAllowed, - kMbCursorInfoZoomIn, - kMbCursorInfoZoomOut, - kMbCursorInfoGrab, - kMbCursorInfoGrabbing, - kMbCursorInfoCustom -} mbCursorInfoType; - -typedef struct { - int x; - int y; - int width; - int height; - - BOOL menuBarVisible; - BOOL statusBarVisible; - BOOL toolBarVisible; - BOOL locationBarVisible; - BOOL scrollbarsVisible; - BOOL resizable; - BOOL fullscreen; -} mbWindowFeatures; - -typedef struct _mbPrintSettings { - int structSize; - int dpi; - int width; - int height; - int marginTop; - int marginBottom; - int marginLeft; - int marginRight; - BOOL isPrintPageHeadAndFooter; - BOOL isPrintBackgroud; - BOOL isLandscape; - BOOL isPrintToMultiPage; -} mbPrintSettings; - -struct mbString; -typedef mbString* mbStringPtr; - -typedef struct _mbMemBuf { - int size; - void* data; - size_t length; -} mbMemBuf; - -typedef struct { - struct Item { - enum mbStorageType { - // String data with an associated MIME type. Depending on the MIME type, there may be - // optional metadata attributes as well. - StorageTypeString, - // Stores the name of one file being dragged into the renderer. - StorageTypeFilename, - // An image being dragged out of the renderer. Contains a buffer holding the image data - // as well as the suggested name for saving the image to. - StorageTypeBinaryData, - // Stores the filesystem URL of one file being dragged into the renderer. - StorageTypeFileSystemFile, - } storageType; - - // Only valid when storageType == StorageTypeString. - mbMemBuf* stringType; - mbMemBuf* stringData; - - // Only valid when storageType == StorageTypeFilename. - mbMemBuf* filenameData; - mbMemBuf* displayNameData; - - // Only valid when storageType == StorageTypeBinaryData. - mbMemBuf* binaryData; - - // Title associated with a link when stringType == "text/uri-list". - // Filename when storageType == StorageTypeBinaryData. - mbMemBuf* title; - - // Only valid when storageType == StorageTypeFileSystemFile. - mbMemBuf* fileSystemURL; - long long fileSystemFileSize; - - // Only valid when stringType == "text/html". - mbMemBuf* baseURL; - }; - - struct Item* m_itemList; - int m_itemListLength; - - int m_modifierKeyState; // State of Shift/Ctrl/Alt/Meta keys. - mbMemBuf* m_filesystemId; -} mbWebDragData; - -typedef enum { - mbWebDragOperationNone = 0, - mbWebDragOperationCopy = 1, - mbWebDragOperationLink = 2, - mbWebDragOperationGeneric = 4, - mbWebDragOperationPrivate = 8, - mbWebDragOperationMove = 16, - mbWebDragOperationDelete = 32, - mbWebDragOperationEvery = 0xffffffff -} mbWebDragOperation; - -typedef mbWebDragOperation mbWebDragOperationsMask; - -typedef enum { - MB_RESOURCE_TYPE_MAIN_FRAME = 0, // top level page - MB_RESOURCE_TYPE_SUB_FRAME = 1, // frame or iframe - MB_RESOURCE_TYPE_STYLESHEET = 2, // a CSS stylesheet - MB_RESOURCE_TYPE_SCRIPT = 3, // an external script - MB_RESOURCE_TYPE_IMAGE = 4, // an image (jpg/gif/png/etc) - MB_RESOURCE_TYPE_FONT_RESOURCE = 5, // a font - MB_RESOURCE_TYPE_SUB_RESOURCE = 6, // an "other" subresource. - MB_RESOURCE_TYPE_OBJECT = 7, // an object (or embed) tag for a plugin, - // or a resource that a plugin requested. - MB_RESOURCE_TYPE_MEDIA = 8, // a media resource. - MB_RESOURCE_TYPE_WORKER = 9, // the main resource of a dedicated - // worker. - MB_RESOURCE_TYPE_SHARED_WORKER = 10, // the main resource of a shared worker. - MB_RESOURCE_TYPE_PREFETCH = 11, // an explicitly requested prefetch - MB_RESOURCE_TYPE_FAVICON = 12, // a favicon - MB_RESOURCE_TYPE_XHR = 13, // a XMLHttpRequest - MB_RESOURCE_TYPE_PING = 14, // a ping request for - MB_RESOURCE_TYPE_SERVICE_WORKER = 15, // the main resource of a service worker. - MB_RESOURCE_TYPE_LAST_TYPE -} mbResourceType; - -typedef enum _mbRequestType { - kMbRequestTypeInvalidation, - kMbRequestTypeGet, - kMbRequestTypePost, - kMbRequestTypePut, -} mbRequestType; - -typedef struct _mbSlist { - char* data; - struct _mbSlist* next; -} mbSlist; - -typedef enum _mbMenuItemId { - kMbMenuSelectedAllId = 1 << 1, - kMbMenuSelectedTextId = 1 << 2, - kMbMenuUndoId = 1 << 3, - kMbMenuCopyImageId = 1 << 4, - kMbMenuInspectElementAtId = 1 << 5, - kMbMenuCutId = 1 << 6, - kMbMenuPasteId = 1 << 7, - kMbMenuPrintId = 1 << 8, - kMbMenuGoForwardId = 1 << 9, - kMbMenuGoBackId = 1 << 10, - kMbMenuReloadId = 1 << 11, -} mbMenuItemId; - -typedef void* mbWebSocketChannel; - -typedef struct _mbWebsocketHookCallbacks { - mbStringPtr(MB_CALL_TYPE* onWillConnect)(mbWebView webView, void* param, mbWebSocketChannel channel, const utf8* url, BOOL* needHook); - - BOOL(MB_CALL_TYPE* onConnected)(mbWebView webView, void* param, mbWebSocketChannel channel); - mbStringPtr(MB_CALL_TYPE* onReceive)(mbWebView webView, void* param, mbWebSocketChannel channel, int opCode, const char* buf, size_t len, BOOL* isContinue); - mbStringPtr(MB_CALL_TYPE* onSend)(mbWebView webView, void* param, mbWebSocketChannel channel, int opCode, const char* buf, size_t len, BOOL* isContinue); - void(MB_CALL_TYPE* onError)(mbWebView webView, void* param, mbWebSocketChannel channel); -} mbWebsocketHookCallbacks; - -////////////////////////////////////////////////////////////////////////// - -typedef enum { - kMbJsTypeNumber = 0, - kMbJsTypeString = 1, - kMbJsTypeBool = 2, - //kMbJsTypeObject = 3, - //kMbJsTypeFunction = 4, - kMbJsTypeUndefined = 5, - //kMbJsTypeArray = 6, - kMbJsTypeNull = 7, - kMbJsTypeV8Value = 8, -} mbJsType; - -typedef long long int64_t; -typedef int64_t mbJsValue; -typedef void* mbJsExecState; - -typedef void(MB_CALL_TYPE *mbOnGetPdfPageDataCallback)(mbWebView webView, void* param, void* data, size_t size); - -typedef void(MB_CALL_TYPE *mbRunJsCallback)(mbWebView webView, void* param, mbJsExecState es, mbJsValue v); -typedef void(MB_CALL_TYPE* mbJsQueryCallback)(mbWebView webView, void* param, mbJsExecState es, int64_t queryId, int customMsg, const utf8* request); - -typedef void(MB_CALL_TYPE *mbTitleChangedCallback)(mbWebView webView, void* param, const utf8* title); -typedef void(MB_CALL_TYPE *mbMouseOverUrlChangedCallback)(mbWebView webView, void* param, const utf8* url); -typedef void(MB_CALL_TYPE *mbURLChangedCallback)(mbWebView webView, void* param, const utf8* url, BOOL canGoBack, BOOL canGoForward); -typedef void(MB_CALL_TYPE *mbURLChangedCallback2)(mbWebView webView, void* param, mbWebFrameHandle frameId, const utf8* url); -typedef void(MB_CALL_TYPE *mbPaintUpdatedCallback)(mbWebView webView, void* param, const HDC hdc, int x, int y, int cx, int cy); -typedef void(MB_CALL_TYPE* mbAcceleratedPaintCallback)(mbWebView webView, void* param, int type, const mbRect* dirytRects, const size_t dirytRectsSize,void* sharedHandle); -typedef void(MB_CALL_TYPE *mbPaintBitUpdatedCallback)(mbWebView webView, void* param, const void* buffer, const mbRect* r, int width, int height); -typedef void(MB_CALL_TYPE *mbAlertBoxCallback)(mbWebView webView, void* param, const utf8* msg); -typedef BOOL(MB_CALL_TYPE *mbConfirmBoxCallback)(mbWebView webView, void* param, const utf8* msg); -typedef mbStringPtr(MB_CALL_TYPE *mbPromptBoxCallback)(mbWebView webView, void* param, const utf8* msg, const utf8* defaultResult); -typedef BOOL(MB_CALL_TYPE *mbNavigationCallback)(mbWebView webView, void* param, mbNavigationType navigationType, const utf8* url); -typedef mbWebView(MB_CALL_TYPE *mbCreateViewCallback)(mbWebView webView, void* param, mbNavigationType navigationType, const utf8* url, const mbWindowFeatures* windowFeatures); -typedef void(MB_CALL_TYPE *mbDocumentReadyCallback)(mbWebView webView, void* param, mbWebFrameHandle frameId); -typedef BOOL(MB_CALL_TYPE *mbCloseCallback)(mbWebView webView, void* param, void* unuse); -typedef BOOL(MB_CALL_TYPE *mbDestroyCallback)(mbWebView webView, void* param, void* unuse); -typedef void(MB_CALL_TYPE *mbOnShowDevtoolsCallback)(mbWebView webView, void* param); -typedef void(MB_CALL_TYPE *mbDidCreateScriptContextCallback)(mbWebView webView, void* param, mbWebFrameHandle frameId, void* context, int extensionGroup, int worldId); -typedef BOOL(MB_CALL_TYPE *mbGetPluginListCallback)(BOOL refresh, void* pluginListBuilder, void* param); -typedef BOOL(MB_CALL_TYPE *mbNetResponseCallback)(mbWebView webView, void* param, const utf8* url, mbNetJob job); -typedef void(MB_CALL_TYPE *mbThreadCallback)(void* param1, void* param2); -typedef void(MB_CALL_TYPE *mbNodeOnCreateProcessCallback)(mbWebView webView, void* param, const WCHAR* applicationPath, const WCHAR* arguments, STARTUPINFOW* startup); - -typedef enum { - MB_LOADING_SUCCEEDED, - MB_LOADING_FAILED, - MB_LOADING_CANCELED -} mbLoadingResult; - -typedef void(MB_CALL_TYPE *mbLoadingFinishCallback)(mbWebView webView, void* param, mbWebFrameHandle frameId, const utf8* url, mbLoadingResult result, const utf8* failedReason); -typedef BOOL(MB_CALL_TYPE *mbDownloadCallback)(mbWebView webView, void* param, mbWebFrameHandle frameId, const char* url, void* downloadJob); - -typedef enum { - mbLevelDebug = 4, - mbLevelLog = 1, - mbLevelInfo = 5, - mbLevelWarning = 2, - mbLevelError = 3, - mbLevelRevokedError = 6, - mbLevelLast = mbLevelRevokedError -} mbConsoleLevel; -typedef void(MB_CALL_TYPE *mbConsoleCallback)(mbWebView webView, void* param, mbConsoleLevel level, const utf8* message, const utf8* sourceName, unsigned sourceLine, const utf8* stackTrace); - -typedef void(MB_CALL_TYPE *mbOnCallUiThread)(mbWebView webView, void* paramOnInThread); -typedef void(MB_CALL_TYPE *mbCallUiThread)(mbWebView webView, mbOnCallUiThread func, void* param); - -//mbNet-------------------------------------------------------------------------------------- -typedef BOOL(MB_CALL_TYPE *mbLoadUrlBeginCallback)(mbWebView webView, void* param, const char* url, mbNetJob job); -typedef void(MB_CALL_TYPE *mbLoadUrlEndCallback)(mbWebView webView, void* param, const char* url, mbNetJob job, void* buf, int len); -typedef void(MB_CALL_TYPE *mbLoadUrlFailCallback)(mbWebView webView, void* param, const char* url, mbNetJob job); -typedef void(MB_CALL_TYPE *mbLoadUrlHeadersReceivedCallback)(mbWebView webView, void* param, const char* url, mbNetJob job); -typedef void(MB_CALL_TYPE *mbLoadUrlFinishCallback)(mbWebView webView, void* param, const utf8* url, mbNetJob job, int len); - -typedef void(MB_CALL_TYPE *mbDidCreateScriptContextCallback)(mbWebView webView, void* param, mbWebFrameHandle frameId, void* context, int extensionGroup, int worldId); -typedef void(MB_CALL_TYPE *mbWillReleaseScriptContextCallback)(mbWebView webView, void* param, mbWebFrameHandle frameId, void* context, int worldId); -typedef BOOL(MB_CALL_TYPE *mbNetResponseCallback)(mbWebView webView, void* param, const char* url, void* job); -typedef void(MB_CALL_TYPE *mbNetGetFaviconCallback)(mbWebView webView, void* param, const utf8* url, mbMemBuf* buf); - -enum MbAsynRequestState { - kMbAsynRequestStateOk = 0, - kMbAsynRequestStateFail = 1, -}; - -typedef void(MB_CALL_TYPE* mbCanGoBackForwardCallback)(mbWebView webView, void* param, MbAsynRequestState state, BOOL b); -typedef void(MB_CALL_TYPE* mbGetCookieCallback)(mbWebView webView, void* param, MbAsynRequestState state, const utf8* cookie); - -typedef void* v8ContextPtr; -typedef void* v8Isolate; - -typedef void(MB_CALL_TYPE* mbGetSourceCallback)(mbWebView webView, void* param, const utf8* mhtml); -typedef void(MB_CALL_TYPE* mbGetContentAsMarkupCallback)(mbWebView webView, void* param, const utf8* content, size_t size); - -typedef struct mbWebUrlRequest* mbWebUrlRequestPtr; -typedef struct mbWebUrlResponse* mbWebUrlResponsePtr; - -typedef void(MB_CALL_TYPE* mbOnUrlRequestWillRedirectCallback)(mbWebView webView, void* param, mbWebUrlRequestPtr oldRequest, mbWebUrlRequestPtr request, mbWebUrlResponsePtr redirectResponse); -typedef void(MB_CALL_TYPE* mbOnUrlRequestDidReceiveResponseCallback)(mbWebView webView, void* param, mbWebUrlRequestPtr request, mbWebUrlResponsePtr response); -typedef void(MB_CALL_TYPE* mbOnUrlRequestDidReceiveDataCallback)(mbWebView webView, void* param, mbWebUrlRequestPtr request, const char* data, int dataLength); -typedef void(MB_CALL_TYPE* mbOnUrlRequestDidFailCallback)(mbWebView webView, void* param, mbWebUrlRequestPtr request, const utf8* error); -typedef void(MB_CALL_TYPE* mbOnUrlRequestDidFinishLoadingCallback)(mbWebView webView, void* param, mbWebUrlRequestPtr request, double finishTime); - -typedef struct _mbUrlRequestCallbacks { - mbOnUrlRequestWillRedirectCallback willRedirectCallback; - mbOnUrlRequestDidReceiveResponseCallback didReceiveResponseCallback; - mbOnUrlRequestDidReceiveDataCallback didReceiveDataCallback; - mbOnUrlRequestDidFailCallback didFailCallback; - mbOnUrlRequestDidFinishLoadingCallback didFinishLoadingCallback; -} mbUrlRequestCallbacks; - -typedef enum _mbDownloadOpt { - kMbDownloadOptCancel, - kMbDownloadOptCacheData, -} mbDownloadOpt; - -typedef void(MB_CALL_TYPE*mbNetJobDataRecvCallback)(void* ptr, mbNetJob job, const char* data, int length); -typedef void(MB_CALL_TYPE*mbNetJobDataFinishCallback)(void* ptr, mbNetJob job, mbLoadingResult result); - -typedef struct _mbNetJobDataBind { - void* param; - mbNetJobDataRecvCallback recvCallback; - mbNetJobDataFinishCallback finishCallback; -} mbNetJobDataBind; - -typedef void(MB_CALL_TYPE*mbPopupDialogSaveNameCallback)(void* ptr, const wchar_t* filePath); - -typedef struct _mbDownloadBind { - void* param; - mbNetJobDataRecvCallback recvCallback; - mbNetJobDataFinishCallback finishCallback; - mbPopupDialogSaveNameCallback saveNameCallback; -} mbDownloadBind; - -typedef struct _mbFileFilter { - const utf8* name; // 渚嬪"image"銆"Movies" - const utf8* extensions; // 渚嬪"jpg|png|gif" -} mbFileFilter; - -enum mbDialogProperties { - kMbDialogPropertiesOpenFile = 1 << 1, // 鍏佽閫夋嫨鏂囦欢 - kMbDialogPropertiesOpenDirectory = 1 << 2, // 鍏佽閫夋嫨鏂囦欢澶 - kMbDialogPropertiesMultiSelections = 1 << 3, // 鍏佽澶氶夈 - kMbDialogPropertiesShowHiddenFiles = 1 << 4, // 鏄剧ず瀵硅瘽妗嗕腑鐨勯殣钘忔枃浠躲 - kMbDialogPropertiesCreateDirectory = 1 << 5, // macOS - 鍏佽浣犻氳繃瀵硅瘽妗嗙殑褰㈠紡鍒涘缓鏂扮殑鐩綍銆 - kMbDialogPropertiesPromptToCreate = 1 << 6, // Windows - 濡傛灉杈撳叆鐨勬枃浠惰矾寰勫湪瀵硅瘽妗嗕腑涓嶅瓨鍦, 鍒欐彁绀哄垱寤恒 杩欏苟涓嶆槸鐪熺殑鍦ㄨ矾寰勪笂鍒涘缓涓涓枃浠讹紝鑰屾槸鍏佽杩斿洖涓浜涗笉瀛樺湪鐨勫湴鍧浜ょ敱搴旂敤绋嬪簭鍘诲垱寤恒 - kMbDialogPropertiesNoResolveAliases = 1 << 7, // macOS - 绂佺敤鑷姩鐨勫埆鍚嶈矾寰(绗﹀彿閾炬帴) 瑙f瀽銆 鎵閫夊埆鍚嶇幇鍦ㄥ皢浼氳繑鍥炲埆鍚嶈矾寰勮岄潪鍏剁洰鏍囪矾寰勩 - kMbDialogPropertiesTreatPackageAsDirectory = 1 << 8, // macOS - 灏嗗寘(濡.app 鏂囦欢澶) 瑙嗕负鐩綍鑰屼笉鏄枃浠躲 - kMbDialogPropertiesDontAddToRecent = 1 << 9, // Windows - 涓嶈灏嗘鍦ㄦ墦寮鐨勯」鐩坊鍔犲埌鏈杩戠殑鏂囨。鍒楄〃涓 -}; - -typedef struct _mbDialogOptions { - int magic; // 'mbdo' - const utf8* title; - const utf8* defaultPath; - const utf8* buttonLabel; - mbFileFilter* filters; - int filtersCount; - mbDialogProperties prop; - const utf8* message; - BOOL securityScopedBookmarks; -} mbDialogOptions; - -typedef struct _mbDownloadOptions { - int magic; // 'mbdo' - BOOL saveAsPathAndName; -} mbDownloadOptions; - -typedef mbDownloadOpt(MB_CALL_TYPE* mbDownloadInBlinkThreadCallback)( - mbWebView webView, - void* params, - size_t expectedContentLength, - const char* url, - const char* mime, - const char* disposition, - mbNetJob job, - mbNetJobDataBind* dataBind - ); - -typedef struct _mbPdfDatas { - int count; - size_t* sizes; - const void** datas; -} mbPdfDatas; - -typedef void(MB_CALL_TYPE* mbPrintPdfDataCallback)(mbWebView webview, void* param, const mbPdfDatas* datas); - -typedef struct _mbScreenshotSettings { - int structSize; - int width; - int height; -} mbScreenshotSettings; - -typedef void(MB_CALL_TYPE* mbPrintBitmapCallback)(mbWebView webview, void* param, const char* data, size_t size); -typedef void(MB_CALL_TYPE* mbOnScreenshot)(mbWebView webView, void* param, const char* data, size_t size); - -typedef enum _mbHttBodyElementType { - mbHttBodyElementTypeData, - mbHttBodyElementTypeFile, -} mbHttBodyElementType; - -typedef struct _mbPostBodyElement { - int size; - mbHttBodyElementType type; - mbMemBuf* data; - mbStringPtr filePath; - __int64 fileStart; - __int64 fileLength; // -1 means to the end of the file. -} mbPostBodyElement; - -typedef struct _mbPostBodyElements { - int size; - mbPostBodyElement** element; - size_t elementSize; - bool isDirty; -} mbPostBodyElements; - -typedef struct _mbWillSendRequestInfo { - mbStringPtr url; - mbStringPtr newUrl; - mbResourceType resourceType; - int httpResponseCode; - mbStringPtr method; - mbStringPtr referrer; - void* headers; -} mbWillSendRequestInfo; - -typedef enum _mbViewLoadType { - MB_DID_START_LOADING, - MB_DID_STOP_LOADING, - MB_DID_NAVIGATE, - MB_DID_NAVIGATE_IN_PAGE, - MB_DID_GET_RESPONSE_DETAILS, - MB_DID_GET_REDIRECT_REQUEST, - MB_DID_POST_REQUEST, -} mbViewLoadType; - -typedef struct _mbViewLoadCallbackInfo { - int size; - mbWebFrameHandle frame; - mbWillSendRequestInfo* willSendRequestInfo; - const char* url; - mbPostBodyElements* postBody; - mbNetJob job; -} mbViewLoadCallbackInfo; - -typedef void(MB_CALL_TYPE* mbNetViewLoadInfoCallback)(mbWebView webView, void* param, mbViewLoadType type, mbViewLoadCallbackInfo* info); - -//mbwindow----------------------------------------------------------------------------------- -typedef enum _mbWindowType { - MB_WINDOW_TYPE_POPUP, - MB_WINDOW_TYPE_TRANSPARENT, - MB_WINDOW_TYPE_CONTROL -} mbWindowType; - -typedef enum _mbWindowInfo { - MB_WINDOW_INFO_SHARTD_TEXTURE_ENABLE = 1 << 16, -} mbWindowInfo; - -typedef BOOL(MB_CALL_TYPE *mbWindowClosingCallback)(mbWebView webview, void* param); -typedef void(MB_CALL_TYPE *mbWindowDestroyCallback)(mbWebView webview, void* param); - -typedef struct _mbDraggableRegion { - RECT bounds; - BOOL draggable; -} mbDraggableRegion; -typedef void(MB_CALL_TYPE *mbDraggableRegionsChangedCallback)(mbWebView webview, void* param, const mbDraggableRegion* rects, int rectCount); - -typedef enum _mbPrintintStep { - kPrintintStepStart, - kPrintintStepPreview, - kPrintintStepPrinting, -} mbPrintintStep; - -typedef struct _mbPrintintSettings { - int dpi; - int width; - int height; - float scale; -} mbPrintintSettings; - -typedef struct _mbDefaultPrinterSettings { - int structSize; // 榛樿鏄4 * 10 - BOOL isLandscape; // 鏄惁涓烘í鍚戞墦鍗版牸寮 - BOOL isPrintHeadFooter; // - BOOL isPrintBackgroud; // 鏄惁鎵撳嵃鑳屾櫙 - int edgeDistanceLeft; // 涓婅竟璺濆崟浣嶏細姣背 - int edgeDistanceTop; - int edgeDistanceRight; - int edgeDistanceBottom; - int copies; // 榛樿鎵撳嵃浠芥暟 - int paperType; // DMPAPER_A4绛 -#if defined(__cplusplus) - inline _mbDefaultPrinterSettings(); -#endif -} mbDefaultPrinterSettings; - -#if defined(__cplusplus) -_mbDefaultPrinterSettings::_mbDefaultPrinterSettings() -{ - isLandscape = false; - isPrintHeadFooter = false; - isPrintBackgroud = true; - edgeDistanceLeft = 0; - edgeDistanceTop = 10; - edgeDistanceRight = 0; - edgeDistanceBottom = 10; - copies = 1; - paperType = 9; -} -#endif - -typedef BOOL(MB_CALL_TYPE *mbPrintingCallback)(mbWebView webview, void* param, mbPrintintStep step, HDC hDC, const mbPrintintSettings* settings, int pageCount); - -typedef mbStringPtr(MB_CALL_TYPE *mbImageBufferToDataURLCallback)(mbWebView webView, void* param, const char* data, size_t size); - -//JavaScript Bind----------------------------------------------------------------------------------- - -////////////////////////////////////////////////////////////////////////// - -#define MB_DEFINE_ITERATOR0(returnVal, name, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR1(returnVal, name, p1, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR2(returnVal, name, p1, p2, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR3(returnVal, name, p1, p2, p3, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR7(returnVal, name, p1, p2, p3, p4, p5, p6, p7, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR8(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR9(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8, p9); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR10(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -#define MB_DEFINE_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \ - typedef returnVal(MB_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \ - __declspec(selectany) FN_##name name = ((FN_##name)0); - -// --- - -#define MB_DLLEXPORT __declspec(dllexport) - -#define MB_DECLARE_ITERATOR0(returnVal, name, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(); - -#define MB_DECLARE_ITERATOR1(returnVal, name, p1, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1); - -#define MB_DECLARE_ITERATOR2(returnVal, name, p1, p2, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2); - -#define MB_DECLARE_ITERATOR3(returnVal, name, p1, p2, p3, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3); - -#define MB_DECLARE_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4); - -#define MB_DECLARE_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4, p5); - -#define MB_DECLARE_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4, p5, p6); - -#define MB_DECLARE_ITERATOR7(returnVal, name, p1, p2, p3, p4, p5, p6, p7, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7); - -#define MB_DECLARE_ITERATOR8(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8); - -#define MB_DECLARE_ITERATOR9(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8, p9); - -#define MB_DECLARE_ITERATOR10(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); - -#define MB_DECLARE_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \ - MB_EXTERN_C MB_DLLEXPORT returnVal MB_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); - -// --- - -#define MB_GET_PTR_ITERATOR(name) \ - name = (FN_##name)GetProcAddress(g_hMiniblinkMod, #name); \ - if (!name) \ - MessageBoxA(((HWND)0), "mb api not found", #name, 0); - -#define MB_GET_PTR_ITERATOR0(returnVal, name, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR1(returnVal, name, p1, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR2(returnVal, name, p1, p2, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR3(returnVal, name, p1, p2, p3, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR7(returnVal, name, p1, p2, p3, p4, p5, p6, p7, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR8(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR9(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR10(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, description) \ - MB_GET_PTR_ITERATOR(name); - -#define MB_GET_PTR_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \ - MB_GET_PTR_ITERATOR(name); - -// 浠ヤ笅鏄痬b鐨勫鍑哄嚱鏁般傛牸寮忔寜鐓с愯繑鍥炵被鍨嬨戙愬嚱鏁板悕銆戙愬弬鏁般戞潵鎺掑垪 -#define MB_FOR_EACH_DEFINE_FUNCTION(ITERATOR0, ITERATOR1, ITERATOR2, ITERATOR3, ITERATOR4, ITERATOR5, ITERATOR6, ITERATOR7, ITERATOR8, ITERATOR9, ITERATOR10, ITERATOR11) \ -ITERATOR0(void, mbUninit, "") \ -ITERATOR0(mbSettings*, mbCreateInitSettings, "鏂逛究c#绛夊叾浠栬瑷鍒涘缓setting缁撴瀯浣") \ -ITERATOR3(void, mbSetInitSettings, mbSettings* settings, const char* name, const char* value, "") \ -ITERATOR0(mbWebView, mbCreateWebView, "") \ -ITERATOR1(void, mbDestroyWebView, mbWebView webview, "") \ -ITERATOR6(mbWebView, mbCreateWebWindow, mbWindowType type, HWND parent, int x, int y, int width, int height, "") \ -ITERATOR7(mbWebView, mbCreateWebCustomWindow, HWND parent, DWORD style, DWORD styleEx, int x, int y, int width, int height, "") \ -ITERATOR5(void, mbMoveWindow, mbWebView webview, int x, int y, int w, int h, "") \ -ITERATOR1(void, mbMoveToCenter, mbWebView webview, "") \ -ITERATOR2(void, mbSetAutoDrawToHwnd, mbWebView webview, BOOL b, "绂诲睆妯″紡涓嬫帶鍒舵槸鍚﹁嚜鍔ㄤ笂灞") \ -ITERATOR2(void, mbGetCaretRect, mbWebView webviewHandle, mbRect* r, "") \ -\ -ITERATOR2(void, mbSetAudioMuted, mbWebView webview, BOOL b, "") \ -ITERATOR1(BOOL, mbIsAudioMuted, mbWebView webview, "") \ -\ -ITERATOR2(mbStringPtr, mbCreateString, const utf8* str, size_t length, "") \ -ITERATOR2(mbStringPtr, mbCreateStringWithoutNullTermination, const utf8* str, size_t length, "") \ -ITERATOR1(void, mbDeleteString, mbStringPtr str, "") \ -ITERATOR1(size_t, mbGetStringLen, mbStringPtr str, "") \ -ITERATOR1(const utf8*, mbGetString, mbStringPtr str, "") \ -\ -ITERATOR2(void, mbSetProxy, mbWebView webView, const mbProxy* proxy, "") \ -ITERATOR3(void, mbSetDebugConfig, mbWebView webView, const char* debugString, const char* param, "") \ -\ -ITERATOR3(void, mbNetSetData, mbNetJob jobPtr, void* buf, int len, "璋冪敤姝ゅ嚱鏁板悗,缃戠粶灞傛敹鍒版暟鎹細瀛樺偍鍦ㄤ竴buf鍐,鎺ユ敹鏁版嵁瀹屾垚鍚庡搷搴擮nLoadUrlEnd浜嬩欢.#姝よ皟鐢ㄤ弗閲嶅奖鍝嶆ц兘,鎱庣敤" \ - "姝ゅ嚱鏁板拰mbNetSetData鐨勫尯鍒槸锛宮bNetHookRequest浼氬湪鎺ュ彈鍒扮湡姝g綉缁滄暟鎹悗鍐嶈皟鐢ㄥ洖璋冿紝骞跺厑璁稿洖璋冧慨鏀圭綉缁滄暟鎹"\ - "鑰宮bNetSetData鏄湪缃戠粶鏁版嵁杩樻病鍙戦佺殑鏃跺欎慨鏀") \ -ITERATOR1(void, mbNetHookRequest, mbNetJob jobPtr, "") \ -ITERATOR2(void, mbNetChangeRequestUrl, mbNetJob jobPtr, const char* url, "") \ -ITERATOR1(void, mbNetContinueJob, mbNetJob jobPtr, "") \ -ITERATOR1(const mbSlist*, mbNetGetRawHttpHeadInBlinkThread, mbNetJob jobPtr, "") \ -ITERATOR1(const mbSlist*, mbNetGetRawResponseHeadInBlinkThread, mbNetJob jobPtr, "") \ -ITERATOR1(BOOL, mbNetHoldJobToAsynCommit, mbNetJob jobPtr, "") \ -ITERATOR1(void, mbNetCancelRequest, mbNetJob jobPtr, "")\ -ITERATOR3(void, mbNetOnResponse, mbWebView webviewHandle, mbNetResponseCallback callback, void* param, "娉ㄦ剰姝ゆ帴鍙g殑鍥炶皟鏄湪鍙﹀涓嚎绋")\ -\ -ITERATOR3(void, mbNetSetWebsocketCallback, mbWebView webview, const mbWebsocketHookCallbacks* callbacks, void* param, "")\ -ITERATOR3(void, mbNetSendWsText, mbWebSocketChannel channel, const char* buf, size_t len, "")\ -ITERATOR3(void, mbNetSendWsBlob, mbWebSocketChannel channel, const char* buf, size_t len, "")\ -\ -ITERATOR2(void, mbNetEnableResPacket, mbWebView webviewHandle, const WCHAR* pathName, "")\ -\ -ITERATOR1(mbPostBodyElements*, mbNetGetPostBody, mbNetJob jobPtr, "") \ -ITERATOR2(mbPostBodyElements*, mbNetCreatePostBodyElements, mbWebView webView, size_t length, "") \ -ITERATOR1(void, mbNetFreePostBodyElements, mbPostBodyElements* elements, "") \ -ITERATOR1(mbPostBodyElement*, mbNetCreatePostBodyElement, mbWebView webView, "") \ -ITERATOR1(void, mbNetFreePostBodyElement, mbPostBodyElement* element, "") \ -\ -ITERATOR3(mbWebUrlRequestPtr, mbNetCreateWebUrlRequest, const utf8* url, const utf8* method, const utf8* mime, "")\ -ITERATOR3(void, mbNetAddHTTPHeaderFieldToUrlRequest, mbWebUrlRequestPtr request, const utf8* name, const utf8* value, "")\ -ITERATOR4(int, mbNetStartUrlRequest, mbWebView webView, mbWebUrlRequestPtr request, void* param, const mbUrlRequestCallbacks* callbacks, "")\ -ITERATOR1(int, mbNetGetHttpStatusCode, mbWebUrlResponsePtr response, "")\ -ITERATOR1(mbRequestType, mbNetGetRequestMethod, mbNetJob jobPtr, "")\ -ITERATOR1(__int64, mbNetGetExpectedContentLength, mbWebUrlResponsePtr response, "")\ -ITERATOR1(const utf8*, mbNetGetResponseUrl, mbWebUrlResponsePtr response, "")\ -ITERATOR1(void, mbNetCancelWebUrlRequest, int requestId, "")\ -ITERATOR2(void, mbSetViewProxy, mbWebView webView, const mbProxy* proxy, "")\ -ITERATOR2(void, mbNetSetMIMEType, mbNetJob jobPtr, const char* type, "") \ -ITERATOR1(const char*, mbNetGetMIMEType, mbNetJob jobPtr, "鍙兘鍦╞link绾跨▼璋冪敤锛堥潪涓荤嚎绋嬶級") \ -ITERATOR3(const utf8*, mbNetGetHTTPHeaderField, mbNetJob job, const char* key, BOOL fromRequestOrResponse, "") \ -ITERATOR1(const char*, mbNetGetReferrer, mbNetJob jobPtr, "鑾峰彇request鐨剅eferrer") \ -ITERATOR4(void, mbNetSetHTTPHeaderField, mbNetJob jobPtr, const wchar_t* key, const wchar_t* value, BOOL response, "") \ -\ -ITERATOR2(void, mbSetMouseEnabled, mbWebView webView, BOOL b, "") \ -ITERATOR2(void, mbSetTouchEnabled, mbWebView webView, BOOL b, "") \ -ITERATOR2(void, mbSetSystemTouchEnabled, mbWebView webView, BOOL b, "") \ -ITERATOR2(void, mbSetContextMenuEnabled, mbWebView webView, BOOL b, "") \ -ITERATOR2(void, mbSetNavigationToNewWindowEnable, mbWebView webView, BOOL b, "") \ -ITERATOR2(void, mbSetHeadlessEnabled, mbWebView webView, BOOL b, "鍙互鍏抽棴娓叉煋") \ -ITERATOR2(void, mbSetDragDropEnable, mbWebView webView, BOOL b, "鍙互鍏抽棴鎷栨嫿鏂囦欢銆佹枃瀛") \ -ITERATOR2(void, mbSetDragEnable, mbWebView webView, BOOL b, "鍙叧闂嚜鍔ㄥ搷搴擶M_DROPFILES娑堟伅璁╃綉椤靛姞杞芥湰鍦版枃浠") \ -ITERATOR3(void, mbSetContextMenuItemShow, mbWebView webView, mbMenuItemId item, BOOL isShow, "璁剧疆鏌愰」menu鏄惁鏄剧ず") \ -\ -ITERATOR2(void, mbSetHandle, mbWebView webView, HWND wnd, "") \ -ITERATOR3(void, mbSetHandleOffset, mbWebView webView, int x, int y, "") \ -ITERATOR1(HWND, mbGetHostHWND, mbWebView webView, "") \ -ITERATOR2(void, mbSetTransparent, mbWebView webviewHandle, BOOL transparent, "") \ -ITERATOR2(void, mbSetViewSettings, mbWebView webviewHandle, const mbViewSettings* settings, "") \ -\ -ITERATOR2(void, mbSetCspCheckEnable, mbWebView webView, BOOL b, "") \ -ITERATOR2(void, mbSetNpapiPluginsEnabled, mbWebView webView, BOOL b, "") \ -ITERATOR2(void, mbSetMemoryCacheEnable, mbWebView webView, BOOL b, "") \ -ITERATOR3(void, mbSetCookie, mbWebView webView, const utf8* url, const utf8* cookie, "cookie鏍煎紡蹇呴』鏄:PRODUCTINFO=webxpress; domain=.fidelity.com; path=/; secure") \ -ITERATOR2(void, mbSetCookieEnabled, mbWebView webView, BOOL enable, "") \ -ITERATOR2(void, mbSetCookieJarPath, mbWebView webView, const WCHAR* path, "") \ -ITERATOR2(void, mbSetCookieJarFullPath, mbWebView webView, const WCHAR* path, "") \ -ITERATOR2(void, mbSetLocalStorageFullPath, mbWebView webView, const WCHAR* path, "") \ -ITERATOR1(const utf8*, mbGetTitle, mbWebView webView, "") \ -ITERATOR2(void, mbSetWindowTitle, mbWebView webView, const utf8* title, "") \ -ITERATOR2(void, mbSetWindowTitleW, mbWebView webView, const wchar_t* title, "") \ -ITERATOR1(const utf8*, mbGetUrl, mbWebView webView, "") \ -ITERATOR1(int, mbGetCursorInfoType, mbWebView webView, "") \ -ITERATOR2(void, mbAddPluginDirectory, mbWebView webView, const WCHAR* path, "") \ -ITERATOR2(void, mbSetUserAgent, mbWebView webView, const utf8* userAgent, "") \ -ITERATOR2(void, mbSetZoomFactor, mbWebView webView, float factor, "") \ -ITERATOR1(float, mbGetZoomFactor, mbWebView webView, "") \ -ITERATOR2(void, mbSetDiskCacheEnabled, mbWebView webView, BOOL enable, "") \ -ITERATOR2(void, mbSetDiskCachePath, mbWebView webView, const WCHAR* path, "") \ -ITERATOR2(void, mbSetDiskCacheLimit, mbWebView webView, size_t limit, "") \ -ITERATOR2(void, mbSetDiskCacheLimitDisk, mbWebView webView, size_t limit, "") \ -ITERATOR2(void, mbSetDiskCacheLevel, mbWebView webView, int Level, "") \ -\ -ITERATOR2(void, mbSetResourceGc, mbWebView webView, int intervalSec, "") \ -\ -ITERATOR3(void, mbCanGoForward, mbWebView webView, mbCanGoBackForwardCallback callback, void* param, "") \ -ITERATOR3(void, mbCanGoBack, mbWebView webView, mbCanGoBackForwardCallback callback, void* param, "") \ -ITERATOR3(void, mbGetCookie, mbWebView webView, mbGetCookieCallback callback, void* param, "") \ -ITERATOR1(const utf8*, mbGetCookieOnBlinkThread, mbWebView webView, "") \ -ITERATOR1(void, mbClearCookie, mbWebView webView, "") \ -\ -ITERATOR3(void, mbResize, mbWebView webView, int w, int h, "") \ -\ -ITERATOR3(void, mbOnNavigation, mbWebView webView, mbNavigationCallback callback, void* param, "") \ -ITERATOR3(void, mbOnNavigationSync, mbWebView webView, mbNavigationCallback callback, void* param, "") \ -ITERATOR3(void, mbOnCreateView, mbWebView webView, mbCreateViewCallback callback, void* param, "") \ -ITERATOR3(void, mbOnDocumentReady, mbWebView webView, mbDocumentReadyCallback callback, void* param, "") \ -ITERATOR3(void, mbOnDocumentReadyInBlinkThread, mbWebView webView, mbDocumentReadyCallback callback, void* param, "") \ -ITERATOR3(void, mbOnPaintUpdated, mbWebView webView, mbPaintUpdatedCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnPaintBitUpdated, mbWebView webView, mbPaintBitUpdatedCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnAcceleratedPaint, mbWebView webView, mbAcceleratedPaintCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnLoadUrlBegin, mbWebView webView, mbLoadUrlBeginCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnLoadUrlEnd, mbWebView webView, mbLoadUrlEndCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnLoadUrlFail, mbWebView webView, mbLoadUrlFailCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnLoadUrlHeadersReceived, mbWebView webView, mbLoadUrlHeadersReceivedCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnLoadUrlFinish, mbWebView webView, mbLoadUrlFinishCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnTitleChanged, mbWebView webView, mbTitleChangedCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnURLChanged, mbWebView webView, mbURLChangedCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnLoadingFinish, mbWebView webView, mbLoadingFinishCallback callback, void* param, "") \ -ITERATOR3(void, mbOnDownload, mbWebView webView, mbDownloadCallback callback, void* param, "") \ -ITERATOR3(void, mbOnDownloadInBlinkThread, mbWebView webView, mbDownloadInBlinkThreadCallback callback, void* param, "") \ -ITERATOR3(void, mbOnAlertBox, mbWebView webView, mbAlertBoxCallback callback, void* param, "") \ -ITERATOR3(void, mbOnConfirmBox, mbWebView webView, mbConfirmBoxCallback callback, void* param, "") \ -ITERATOR3(void, mbOnPromptBox, mbWebView webView, mbPromptBoxCallback callback, void* param, "") \ -ITERATOR3(void, mbOnNetGetFavicon, mbWebView webView, mbNetGetFaviconCallback callback, void* param, "") \ -ITERATOR3(void, mbOnConsole, mbWebView webView, mbConsoleCallback callback, void* param, "") \ -ITERATOR3(BOOL, mbOnClose, mbWebView webView, mbCloseCallback callback, void* param, "") \ -ITERATOR3(BOOL, mbOnDestroy, mbWebView webView, mbDestroyCallback callback, void* param, "") \ -ITERATOR3(BOOL, mbOnPrinting, mbWebView webView, mbPrintingCallback callback, void* param, "") \ -ITERATOR3(void, mbOnPluginList, mbWebView webView, mbGetPluginListCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnImageBufferToDataURL, mbWebView webView, mbImageBufferToDataURLCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnDidCreateScriptContext, mbWebView webView, mbDidCreateScriptContextCallback callback, void* callbackParam, "") \ -ITERATOR3(void, mbOnWillReleaseScriptContext, mbWebView webView, mbWillReleaseScriptContextCallback callback, void* callbackParam, "") \ -\ -ITERATOR1(void, mbGoBack, mbWebView webView, "") \ -ITERATOR1(void, mbGoForward, mbWebView webView, "") \ -ITERATOR2(void, mbGoToOffset, mbWebView webView, int offset, "") \ -ITERATOR2(void, mbGoToIndex, mbWebView webView, int index, "") \ -ITERATOR2(void, mbNavigateAtIndex, mbWebView webView, int index, "") \ -ITERATOR1(int, mbGetNavigateIndex, mbWebView webView, "") \ -ITERATOR1(void, mbStopLoading, mbWebView webView, "") \ -ITERATOR1(void, mbReload, mbWebView webView, "") \ -ITERATOR2(void, mbPerformCookieCommand, mbWebView webView, mbCookieCommand command, "") \ -ITERATOR3(void, mbInsertCSSByFrame, mbWebView webView, mbWebFrameHandle frameId, const utf8* cssText, "") \ -\ -ITERATOR1(void, mbEditorSelectAll, mbWebView webView, "") \ -ITERATOR1(void, mbEditorUnSelect, mbWebView webView, "") \ -ITERATOR1(void, mbEditorCopy, mbWebView webView, "") \ -ITERATOR1(void, mbEditorCut, mbWebView webView, "") \ -ITERATOR1(void, mbEditorPaste, mbWebView webView, "") \ -ITERATOR1(void, mbEditorDelete, mbWebView webView, "") \ -ITERATOR1(void, mbEditorUndo, mbWebView webView, "") \ -ITERATOR1(void, mbEditorRedo, mbWebView webView, "") \ -ITERATOR2(void, mbSetEditable, mbWebView webView, bool editable, "") \ -\ -ITERATOR5(BOOL, mbFireMouseEvent, mbWebView webView, unsigned int message, int x, int y, unsigned int flags, "") \ -ITERATOR4(BOOL, mbFireContextMenuEvent, mbWebView webView, int x, int y, unsigned int flags, "") \ -ITERATOR5(BOOL, mbFireMouseWheelEvent, mbWebView webView, int x, int y, int delta, unsigned int flags, "") \ -ITERATOR4(BOOL, mbFireKeyUpEvent, mbWebView webView, unsigned int virtualKeyCode, unsigned int flags, BOOL systemKey, "") \ -ITERATOR4(BOOL, mbFireKeyDownEvent, mbWebView webView, unsigned int virtualKeyCode, unsigned int flags, BOOL systemKey, "") \ -ITERATOR4(BOOL, mbFireKeyPressEvent, mbWebView webView, unsigned int charCode, unsigned int flags, BOOL systemKey, "") \ -ITERATOR6(BOOL, mbFireWindowsMessage, mbWebView webView, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* result, "") \ -\ -ITERATOR1(void, mbSetFocus, mbWebView webView, "") \ -ITERATOR1(void, mbKillFocus, mbWebView webView, "") \ -\ -ITERATOR2(void, mbShowWindow, mbWebView webview, BOOL show, "") \ -\ -ITERATOR2(void, mbLoadURL, mbWebView webView, const utf8* url, "") \ -ITERATOR3(void, mbLoadHtmlWithBaseUrl, mbWebView webView, const utf8* html, const utf8* baseUrl, "") \ -ITERATOR4(void, mbPostURL, mbWebView webView, const utf8* url, const char* postData, int postLen, "") \ -\ -ITERATOR1(HDC, mbGetLockedViewDC, mbWebView webView, "") \ -ITERATOR1(void, mbUnlockViewDC, mbWebView webView, "") \ -\ -ITERATOR1(void, mbWake, mbWebView webView, "") \ -\ -ITERATOR2(void*, mbJsToV8Value, mbJsExecState es, mbJsValue v, "") \ -ITERATOR2(mbJsExecState, mbGetGlobalExecByFrame, mbWebView webView, mbWebFrameHandle frameId, "") \ -ITERATOR2(double, mbJsToDouble, mbJsExecState es, mbJsValue v, "") \ -ITERATOR2(BOOL, mbJsToBoolean, mbJsExecState es, mbJsValue v, "") \ -ITERATOR2(const utf8*, mbJsToString, mbJsExecState es, mbJsValue v, "") \ -ITERATOR2(mbJsType, mbGetJsValueType, mbJsExecState es, mbJsValue v, "") \ -ITERATOR3(void, mbOnJsQuery, mbWebView webView, mbJsQueryCallback callback, void* param, "") \ -ITERATOR4(void, mbResponseQuery, mbWebView webView, int64_t queryId, int customMsg, const utf8* response, "") \ -ITERATOR7(void, mbRunJs, mbWebView webView, mbWebFrameHandle frameId, const utf8* script, BOOL isInClosure, mbRunJsCallback callback, void* param, void* unuse, "") \ -ITERATOR4(mbJsValue, mbRunJsSync, mbWebView webView, mbWebFrameHandle frameId, const utf8* script, BOOL isInClosure, "") \ -ITERATOR1(mbWebFrameHandle, mbWebFrameGetMainFrame, mbWebView webView, "") \ -ITERATOR2(BOOL, mbIsMainFrame, mbWebView webView, mbWebFrameHandle frameId, "") \ -ITERATOR2(void, mbSetNodeJsEnable, mbWebView webView, BOOL b, "") \ -\ -ITERATOR5(void, mbSetDeviceParameter, mbWebView webView, const char* device, const char* paramStr, int paramInt, float paramFloat, "") \ -\ -ITERATOR4(void, mbGetContentAsMarkup, mbWebView webView, mbGetContentAsMarkupCallback calback, void* param, mbWebFrameHandle frameId, "") \ -ITERATOR3(void, mbGetSource, mbWebView webView, mbGetSourceCallback calback, void* param, "") \ -ITERATOR3(void, mbUtilSerializeToMHTML, mbWebView webView, mbGetSourceCallback calback, void* param, "") \ -ITERATOR1(const char*, mbUtilCreateRequestCode, const char* registerInfo, "") \ -ITERATOR1(BOOL, mbUtilIsRegistered, const wchar_t* defaultPath, "") \ -ITERATOR3(BOOL, mbUtilPrint, mbWebView webView, mbWebFrameHandle frameId, const mbPrintSettings* printParams, "") \ -ITERATOR1(const utf8*, mbUtilBase64Encode, const utf8* str, "") \ -ITERATOR1(const utf8*, mbUtilBase64Decode, const utf8* str, "") \ -ITERATOR1(const utf8*, mbUtilDecodeURLEscape, const utf8* url, "") \ -ITERATOR1(const utf8*, mbUtilEncodeURLEscape, const utf8* url, "") \ -ITERATOR1(const mbMemBuf*, mbUtilCreateV8Snapshot, const utf8* str, "") \ -ITERATOR5(void, mbUtilPrintToPdf, mbWebView webView, mbWebFrameHandle frameId, const mbPrintSettings* settings, mbPrintPdfDataCallback callback, void* param, "") \ -ITERATOR5(void, mbUtilPrintToBitmap, mbWebView webView, mbWebFrameHandle frameId, const mbScreenshotSettings* settings, mbPrintBitmapCallback callback, void* param, "") \ -ITERATOR4(void, mbUtilScreenshot, mbWebView webView, const mbScreenshotSettings* settings, mbOnScreenshot callback, void* param, "") \ -ITERATOR2(BOOL, mbUtilsSilentPrint, mbWebView webView, const char* settings, "") \ -ITERATOR2(void, mbUtilSetDefaultPrinterSettings, mbWebView webView, const mbDefaultPrinterSettings* setting, "") \ -\ -ITERATOR3(BOOL, mbPopupDownloadMgr, mbWebView webView, const char* url, void* downloadJob, "") \ -ITERATOR9(mbDownloadOpt, mbPopupDialogAndDownload, mbWebView webView, const mbDialogOptions* dialogOpt, size_t contentLength, const char* url, \ - const char* mime, const char* disposition, mbNetJob job, mbNetJobDataBind* dataBind, mbDownloadBind* callbackBind, "") \ -ITERATOR10(mbDownloadOpt, mbDownloadByPath, mbWebView webView, const mbDownloadOptions* downloadOptions, const WCHAR* path, size_t contentLength, const char* url, \ - const char* mime, const char* disposition, mbNetJob job, mbNetJobDataBind* dataBind, mbDownloadBind* callbackBind, "") \ -\ -ITERATOR3(void, mbGetPdfPageData, mbWebView webView, mbOnGetPdfPageDataCallback callback, void* param, "") \ -\ -ITERATOR3(mbMemBuf*, mbCreateMemBuf, mbWebView webView, void* buf, size_t length, "") \ -ITERATOR1(void, mbFreeMemBuf, mbMemBuf* buf, "") \ -\ -ITERATOR3(void, mbSetUserKeyValue, mbWebView webView, const char* key, void* value, "") \ -ITERATOR2(void*, mbGetUserKeyValue, mbWebView webView, const char* key, "") \ -\ -ITERATOR4(void, mbPluginListBuilderAddPlugin, void* builder, const utf8* name, const utf8* description, const utf8* fileName, "") \ -ITERATOR3(void, mbPluginListBuilderAddMediaTypeToLastPlugin, void* builder, const utf8* name, const utf8* description, "") \ -ITERATOR2(void, mbPluginListBuilderAddFileExtensionToLastMediaType, void* builder, const utf8* fileExtension, "") \ -\ -ITERATOR0(v8Isolate, mbGetBlinkMainThreadIsolate, "") \ -ITERATOR3(void, mbWebFrameGetMainWorldScriptContext, mbWebView webView, mbWebFrameHandle frameId, v8ContextPtr contextOut, "") \ -ITERATOR0(void, mbEnableHighDPISupport, "") \ -ITERATOR0(void, mbRunMessageLoop, "") \ -\ -ITERATOR1(int, mbGetContentWidth, mbWebView webView, "") \ -ITERATOR1(int, mbGetContentHeight, mbWebView webView, "") \ -ITERATOR0(mbWebView, mbGetWebViewForCurrentContext, "") \ -ITERATOR5(BOOL, mbRegisterEmbedderCustomElement, mbWebView webviewHandle, mbWebFrameHandle frameId, const char* name, void* options, void* outResult, "") \ -ITERATOR3(void, mbOnNodeCreateProcess, mbWebView webviewHandle, mbNodeOnCreateProcessCallback callback, void* param, "") \ -ITERATOR3(void, mbOnThreadIdle, mbThreadCallback callback, void* param1, void* param2, "") \ -ITERATOR3(void, mbOnBlinkThreadInit, mbThreadCallback callback, void* param1, void* param2, "") \ -ITERATOR3(void, mbCallBlinkThreadAsync, mbThreadCallback callback, void* param1, void* param2, "") \ -ITERATOR3(void, mbCallBlinkThreadSync, mbThreadCallback callback, void* param1, void* param2, "") \ -ITERATOR3(void, mbCallUiThreadSync, mbThreadCallback callback, void* param1, void* param2, "") \ -ITERATOR3(void, mbCallUiThreadAsync, mbThreadCallback callback, void* param1, void* param2, "") \ -ITERATOR1(void*, mbGetProcAddr, const char* name, "") - -#if ENABLE_MBVIP == 1 - -MB_EXTERN_C MB_DLLEXPORT void MB_CALL_TYPE mbInit(const mbSettings* settings); - -MB_FOR_EACH_DEFINE_FUNCTION(MB_DECLARE_ITERATOR0, MB_DECLARE_ITERATOR1, MB_DECLARE_ITERATOR2, \ - MB_DECLARE_ITERATOR3, MB_DECLARE_ITERATOR4, MB_DECLARE_ITERATOR5, MB_DECLARE_ITERATOR6, MB_DECLARE_ITERATOR7, MB_DECLARE_ITERATOR8, MB_DECLARE_ITERATOR9, MB_DECLARE_ITERATOR10, MB_DECLARE_ITERATOR11) - -#elif DISABLE_MBVIP != 1 - -MB_FOR_EACH_DEFINE_FUNCTION(MB_DEFINE_ITERATOR0, MB_DEFINE_ITERATOR1, MB_DEFINE_ITERATOR2, \ - MB_DEFINE_ITERATOR3, MB_DEFINE_ITERATOR4, MB_DEFINE_ITERATOR5, MB_DEFINE_ITERATOR6, MB_DEFINE_ITERATOR7, MB_DEFINE_ITERATOR8, MB_DEFINE_ITERATOR9, MB_DEFINE_ITERATOR10, MB_DEFINE_ITERATOR11) - -typedef void (MB_CALL_TYPE *FN_mbInit)(const mbSettings* settings); - -#ifdef _WIN64 -__declspec(selectany) const wchar_t* kMbDllPath = L"mb_x64.dll"; -__declspec(selectany) const wchar_t* kMbMainDllPath = L"miniblink_x64.dll"; -#else -__declspec(selectany) const wchar_t* kMbDllPath = L"mb.dll"; -__declspec(selectany) const wchar_t* kMbMainDllPath = L"node.dll"; -#endif - -__declspec(selectany) HMODULE g_hMiniblinkMod = nullptr; - -inline void mbSetMbDllPath(const wchar_t* dllPath) -{ - kMbDllPath = dllPath; -} - -inline void mbSetMbMainDllPath(const wchar_t* dllPath) -{ - kMbMainDllPath = dllPath; -} - -inline void mbFillFuncPtr() -{ - if (!g_hMiniblinkMod) { - LoadLibraryW(kMbMainDllPath); - g_hMiniblinkMod = LoadLibraryW(kMbDllPath); - } - - if (!mbCreateWebView) { - MB_FOR_EACH_DEFINE_FUNCTION(MB_GET_PTR_ITERATOR0, MB_GET_PTR_ITERATOR1, MB_GET_PTR_ITERATOR2, MB_GET_PTR_ITERATOR3, \ - MB_GET_PTR_ITERATOR4, MB_GET_PTR_ITERATOR5, MB_GET_PTR_ITERATOR6, MB_GET_PTR_ITERATOR7, MB_GET_PTR_ITERATOR8, MB_GET_PTR_ITERATOR9, MB_GET_PTR_ITERATOR10, MB_GET_PTR_ITERATOR11); - } -} - -inline void mbInit(const mbSettings* settings) -{ - bool needFill = nullptr == g_hMiniblinkMod; - if (!g_hMiniblinkMod) { - LoadLibraryW(kMbMainDllPath); - g_hMiniblinkMod = LoadLibraryW(kMbDllPath); - } - FN_mbInit mbInitExFunc = (FN_mbInit)GetProcAddress(g_hMiniblinkMod, "mbInit"); - mbInitExFunc(settings); - - if (needFill) - mbFillFuncPtr(); - - return; -} - -#endif - - - -#endif // MB_DEFINE_H - diff --git a/OfficeAssistant_msvc/navbar.cpp b/OfficeAssistant_msvc/navbar.cpp index a67628a..e23eca8 100644 --- a/OfficeAssistant_msvc/navbar.cpp +++ b/OfficeAssistant_msvc/navbar.cpp @@ -26,16 +26,17 @@ NavBar::NavBar(ConfigResponse *configResponse,QWidget *parent) : else { getLogoFromLocal(); } + this->setLayout(nullptr); int n = buttonStructs.length(); int x = (width() - height()*n) / 2; for (auto buttonStruct : buttonStructs) { - MyButton *myButton = new MyButton(buttonStruct, height(), height(), &buttons); + MyButton *myButton = new MyButton(buttonStruct, height(), height(), &buttons,this); myButton->setGeometry(x, 0, height(), height()); + myButton->show(); connect(myButton, &MyButton::clicked1, mainWindowLayout, &MainWindowLayout::clickButton); x += height(); buttons << myButton; } - this->setLayout(nullptr); } NavBar::~NavBar() { @@ -63,7 +64,7 @@ void NavBar::paintEvent(QPaintEvent *event) { } void NavBar::resizeEvent(QResizeEvent *event) { - QWidget::resizeEvent(event); + QWidget::resizeEvent(event); int n = buttonStructs.length(); int x = (width() - height()*n) / 2; for(auto button:buttons){ diff --git a/OfficeAssistant_msvc/qminiblink.cpp b/OfficeAssistant_msvc/qminiblink.cpp new file mode 100644 index 0000000..0455c06 --- /dev/null +++ b/OfficeAssistant_msvc/qminiblink.cpp @@ -0,0 +1,48 @@ +#include "qminiblink.h" +#pragma comment (lib,"Comctl32.lib") + +QMiniBlink::QMiniBlink(QWidget *broswer,QWidget *parent) + : QWidget(parent){ + this->broswer = broswer; + //QSizePolicy sizePolicy(QSizePolicy::Policy::Expanding, QSizePolicy::QSizePolicy::Expanding); + //setSizePolicy(sizePolicy); +} +void QMiniBlink::init() { + ui.setupUi(this); + wkeInit(); + wkeView = wkeCreateWebWindow(WKE_WINDOW_TYPE_CONTROL, (HWND)this->winId(), 0, 0, this->width(), this->height()); + wkeSetNavigationToNewWindowEnable(wkeView, false); + wkeShowWindow(wkeView, TRUE); + SetParent(wkeGetWindowHandle(wkeView), (HWND)this->winId()); + SetWindowSubclass((HWND)this->winId(), subClassProc, 0, (DWORD_PTR)this); + wkeRunMessageLoop(); +} +QMiniBlink::~QMiniBlink(){} +void QMiniBlink::destroy() { + wkeDestroyWebView(wkeView); +} + +void QMiniBlink::switchUrl(QString url) { + wkeLoadURL(wkeView, url.toStdString().c_str()); +} +LRESULT CALLBACK QMiniBlink::subClassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData) +{ + QMiniBlink *obj = (QMiniBlink *)dwRefData; + if (obj == nullptr) + return DefSubclassProc(hWnd, uMsg, wParam, lParam); + switch (uMsg) { + case WM_SIZE: + obj->autojustWebViewSize(); + break; + default: + break; + } + return DefSubclassProc(hWnd, uMsg, wParam, lParam); +} +void QMiniBlink::autojustWebViewSize() +{ + RECT rect; + GetWindowRect((HWND)this->winId(), &rect); + wkeMoveWindow(wkeView, 0, 0, rect.right - rect.left, rect.bottom - rect.top); + +} diff --git a/OfficeAssistant_msvc/qminiblink.h b/OfficeAssistant_msvc/qminiblink.h new file mode 100644 index 0000000..a6bd85b --- /dev/null +++ b/OfficeAssistant_msvc/qminiblink.h @@ -0,0 +1,26 @@ +#pragma once + +#include +#include "ui_qminiblink.h" +#include "wke.h" +#include +#include + +class QMiniBlink : public QWidget +{ + Q_OBJECT + +public: + QMiniBlink(QWidget *broswer,QWidget *parent = Q_NULLPTR); + ~QMiniBlink(); + void init(); + void destroy(); + void autojustWebViewSize(); +public slots: + void switchUrl(QString url); +private: + Ui::QMiniBlink ui; + wkeWebView wkeView; + QWidget *broswer; + static LRESULT CALLBACK subClassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData); +}; diff --git a/OfficeAssistant_msvc/qminiblink.ui b/OfficeAssistant_msvc/qminiblink.ui new file mode 100644 index 0000000..c221d42 --- /dev/null +++ b/OfficeAssistant_msvc/qminiblink.ui @@ -0,0 +1,23 @@ + + QMiniBlink + + + QMiniBlink + + + + 0 + 0 + 400 + 300 + + + + QMiniBlink + + + + + + + diff --git a/OfficeAssistant_msvc/wke.h b/OfficeAssistant_msvc/wke.h new file mode 100644 index 0000000..043dcaf --- /dev/null +++ b/OfficeAssistant_msvc/wke.h @@ -0,0 +1,1548 @@ +锘/* +* +* wolar@qq.com +* http://miniblink.net 鏂囨。鍦板潃 +* https://github.com/weolar/miniblink49 +* licence Apache-2.0 +* +*/ + +#ifndef WKE_DEFINE_H +#define WKE_DEFINE_H + +#include + +////////////////////////////////////////////////////////////////////////// +#define WKE_CALL_TYPE __cdecl + +typedef struct _wkeRect { + int x; + int y; + int w; + int h; +} wkeRect; + +typedef struct _wkePoint { + int x; + int y; +} wkePoint; + +typedef struct _wkeSize { + int w; + int h; +} wkeSize; + +typedef enum _wkeMouseFlags { + WKE_LBUTTON = 0x01, + WKE_RBUTTON = 0x02, + WKE_SHIFT = 0x04, + WKE_CONTROL = 0x08, + WKE_MBUTTON = 0x10, +} wkeMouseFlags; + +typedef enum _wkeKeyFlags { + WKE_EXTENDED = 0x0100, + WKE_REPEAT = 0x4000, +} wkeKeyFlags; + +typedef enum _wkeMouseMsg { + WKE_MSG_MOUSEMOVE = 0x0200, + WKE_MSG_LBUTTONDOWN = 0x0201, + WKE_MSG_LBUTTONUP = 0x0202, + WKE_MSG_LBUTTONDBLCLK = 0x0203, + WKE_MSG_RBUTTONDOWN = 0x0204, + WKE_MSG_RBUTTONUP = 0x0205, + WKE_MSG_RBUTTONDBLCLK = 0x0206, + WKE_MSG_MBUTTONDOWN = 0x0207, + WKE_MSG_MBUTTONUP = 0x0208, + WKE_MSG_MBUTTONDBLCLK = 0x0209, + WKE_MSG_MOUSEWHEEL = 0x020A, +} wkeMouseMsg; + +#if !defined(__cplusplus) +#ifndef HAVE_WCHAR_T +typedef unsigned short wchar_t; +#endif + +#define bool _Bool +#define false 0 +#define true 1 + +#endif + +#if defined(__cplusplus) +#define WKE_EXTERN_C extern "C" +#else +#define WKE_EXTERN_C +#endif + +typedef char utf8; +#if !defined(__cplusplus) +typedef void* jsExecState; +#else +struct JsExecStateInfo; +typedef JsExecStateInfo* jsExecState; +#endif +typedef __int64 jsValue; + +#if defined(__cplusplus) +namespace wke { class CWebView; } +typedef wke::CWebView* wkeWebView; + +namespace wke { class CString; } +typedef wke::CString* wkeString; + +#else +struct _tagWkeWebView; +typedef struct _tagWkeWebView* wkeWebView; + +struct _tagWkeString; +typedef struct _tagWkeString* wkeString; +#endif + +#if defined(__cplusplus) +namespace wke { class WkeMediaPlayer; } +typedef wke::WkeMediaPlayer* wkeMediaPlayer; + +namespace wke { class WkeMediaPlayerClient; } +typedef wke::WkeMediaPlayerClient* wkeMediaPlayerClient; + +namespace blink { class WebURLRequest; } +typedef blink::WebURLRequest* blinkWebURLRequestPtr; + +#else +typedef struct _tagWkeMediaPlayer* wkeMediaPlayer; +typedef struct _tagWkeMediaPlayerClient* wkeMediaPlayerClient; +typedef struct _tabblinkWebURLRequestPtr* blinkWebURLRequestPtr; +#endif + +typedef enum _wkeProxyType { + WKE_PROXY_NONE, + WKE_PROXY_HTTP, + WKE_PROXY_SOCKS4, + WKE_PROXY_SOCKS4A, + WKE_PROXY_SOCKS5, + WKE_PROXY_SOCKS5HOSTNAME +} wkeProxyType; + +typedef struct _wkeProxy { + wkeProxyType type; + char hostname[100]; + unsigned short port; + char username[50]; + char password[50]; +} wkeProxy; + +typedef enum _wkeSettingMask { + WKE_SETTING_PROXY = 1, + WKE_SETTING_EXTENSION = 1 << 2, // 娴嬭瘯鍔熻兘锛岃鍕胯皟鐢 +} wkeSettingMask; + +typedef struct _wkeSettings { + wkeProxy proxy; + unsigned int mask; + const char* extension; +} wkeSettings; + +typedef struct _wkeViewSettings { + int size; + unsigned int bgColor; +} wkeViewSettings; + +typedef void* wkeWebFrameHandle; + +typedef struct _wkeGeolocationPosition{ + double timestamp; + double latitude; + double longitude; + double accuracy; + bool providesAltitude; + double altitude; + bool providesAltitudeAccuracy; + double altitudeAccuracy; + bool providesHeading; + double heading; + bool providesSpeed; + double speed; + +#if defined(__cplusplus) + _wkeGeolocationPosition(const _wkeGeolocationPosition& other); +#endif +} wkeGeolocationPosition; + +#if defined(__cplusplus) + +inline _wkeGeolocationPosition::_wkeGeolocationPosition(const _wkeGeolocationPosition& other) +{ + timestamp = other.timestamp; + latitude = other.latitude; + longitude = other.longitude; + accuracy = other.accuracy; + providesAltitude = other.providesAltitude; + altitude = other.altitude; + providesAltitudeAccuracy = other.providesAltitudeAccuracy; + altitudeAccuracy = other.altitudeAccuracy; + providesHeading = other.providesHeading; + heading = other.heading; + providesSpeed = other.providesSpeed; + speed = other.speed; +} + +#endif + +typedef enum _wkeMenuItemId { + kWkeMenuSelectedAllId = 1 << 1, + kWkeMenuSelectedTextId = 1 << 2, + kWkeMenuUndoId = 1 << 3, + kWkeMenuCopyImageId = 1 << 4, + kWkeMenuInspectElementAtId = 1 << 5, + kWkeMenuCutId = 1 << 6, + kWkeMenuPasteId = 1 << 7, + kWkeMenuPrintId = 1 << 8, + kWkeMenuGoForwardId = 1 << 9, + kWkeMenuGoBackId = 1 << 10, + kWkeMenuReloadId = 1 << 11, + kWkeMenuSaveImageId = 1 << 12, +} wkeMenuItemId; + +typedef void* (WKE_CALL_TYPE *FILE_OPEN_) (const char* path); +typedef void(WKE_CALL_TYPE *FILE_CLOSE_) (void* handle); +typedef size_t(WKE_CALL_TYPE *FILE_SIZE) (void* handle); +typedef int(WKE_CALL_TYPE *FILE_READ) (void* handle, void* buffer, size_t size); +typedef int(WKE_CALL_TYPE *FILE_SEEK) (void* handle, int offset, int origin); + +typedef FILE_OPEN_ WKE_FILE_OPEN; +typedef FILE_CLOSE_ WKE_FILE_CLOSE; +typedef FILE_SIZE WKE_FILE_SIZE; +typedef FILE_READ WKE_FILE_READ; +typedef FILE_SEEK WKE_FILE_SEEK; +typedef bool(WKE_CALL_TYPE *WKE_EXISTS_FILE)(const char * path); + +struct _wkeClientHandler; // declare warning fix +typedef void(WKE_CALL_TYPE *ON_TITLE_CHANGED) (const struct _wkeClientHandler* clientHandler, const wkeString title); +typedef void(WKE_CALL_TYPE *ON_URL_CHANGED) (const struct _wkeClientHandler* clientHandler, const wkeString url); + +typedef struct _wkeClientHandler { + ON_TITLE_CHANGED onTitleChanged; + ON_URL_CHANGED onURLChanged; +} wkeClientHandler; + +typedef bool(WKE_CALL_TYPE * wkeCookieVisitor)( + void* params, + const char* name, + const char* value, + const char* domain, + const char* path, // If |path| is non-empty only URLs at or below the path will get the cookie value. + int secure, // If |secure| is true the cookie will only be sent for HTTPS requests. + int httpOnly, // If |httponly| is true the cookie will only be sent for HTTP requests. + int* expires // The cookie expiration date is only valid if |has_expires| is true. + ); + +typedef enum _wkeCookieCommand { + wkeCookieCommandClearAllCookies, + wkeCookieCommandClearSessionCookies, + wkeCookieCommandFlushCookiesToFile, + wkeCookieCommandReloadCookiesFromFile, +} wkeCookieCommand; + +typedef enum _wkeNavigationType { + WKE_NAVIGATION_TYPE_LINKCLICK, + WKE_NAVIGATION_TYPE_FORMSUBMITTE, + WKE_NAVIGATION_TYPE_BACKFORWARD, + WKE_NAVIGATION_TYPE_RELOAD, + WKE_NAVIGATION_TYPE_FORMRESUBMITT, + WKE_NAVIGATION_TYPE_OTHER +} wkeNavigationType; + +typedef enum _WkeCursorInfoType { + WkeCursorInfoPointer, + WkeCursorInfoCross, + WkeCursorInfoHand, + WkeCursorInfoIBeam, + WkeCursorInfoWait, + WkeCursorInfoHelp, + WkeCursorInfoEastResize, + WkeCursorInfoNorthResize, + WkeCursorInfoNorthEastResize, + WkeCursorInfoNorthWestResize, + WkeCursorInfoSouthResize, + WkeCursorInfoSouthEastResize, + WkeCursorInfoSouthWestResize, + WkeCursorInfoWestResize, + WkeCursorInfoNorthSouthResize, + WkeCursorInfoEastWestResize, + WkeCursorInfoNorthEastSouthWestResize, + WkeCursorInfoNorthWestSouthEastResize, + WkeCursorInfoColumnResize, + WkeCursorInfoRowResize, + WkeCursorInfoMiddlePanning, + WkeCursorInfoEastPanning, + WkeCursorInfoNorthPanning, + WkeCursorInfoNorthEastPanning, + WkeCursorInfoNorthWestPanning, + WkeCursorInfoSouthPanning, + WkeCursorInfoSouthEastPanning, + WkeCursorInfoSouthWestPanning, + WkeCursorInfoWestPanning, + WkeCursorInfoMove, + WkeCursorInfoVerticalText, + WkeCursorInfoCell, + WkeCursorInfoContextMenu, + WkeCursorInfoAlias, + WkeCursorInfoProgress, + WkeCursorInfoNoDrop, + WkeCursorInfoCopy, + WkeCursorInfoNone, + WkeCursorInfoNotAllowed, + WkeCursorInfoZoomIn, + WkeCursorInfoZoomOut, + WkeCursorInfoGrab, + WkeCursorInfoGrabbing, + WkeCursorInfoCustom +} WkeCursorInfoType; + +typedef struct _wkeWindowFeatures { + int x; + int y; + int width; + int height; + + bool menuBarVisible; + bool statusBarVisible; + bool toolBarVisible; + bool locationBarVisible; + bool scrollbarsVisible; + bool resizable; + bool fullscreen; +} wkeWindowFeatures; + +typedef struct _wkeMemBuf { + int unuse; + void* data; + size_t length; +} wkeMemBuf; + +typedef struct _wkeWebDragData { + struct Item { + enum wkeStorageType { + // String data with an associated MIME type. Depending on the MIME type, there may be + // optional metadata attributes as well. + StorageTypeString, + // Stores the name of one file being dragged into the renderer. + StorageTypeFilename, + // An image being dragged out of the renderer. Contains a buffer holding the image data + // as well as the suggested name for saving the image to. + StorageTypeBinaryData, + // Stores the filesystem URL of one file being dragged into the renderer. + StorageTypeFileSystemFile, + } storageType; + + // Only valid when storageType == StorageTypeString. + wkeMemBuf* stringType; + wkeMemBuf* stringData; + + // Only valid when storageType == StorageTypeFilename. + wkeMemBuf* filenameData; + wkeMemBuf* displayNameData; + + // Only valid when storageType == StorageTypeBinaryData. + wkeMemBuf* binaryData; + + // Title associated with a link when stringType == "text/uri-list". + // Filename when storageType == StorageTypeBinaryData. + wkeMemBuf* title; + + // Only valid when storageType == StorageTypeFileSystemFile. + wkeMemBuf* fileSystemURL; + __int64 fileSystemFileSize; + + // Only valid when stringType == "text/html". + wkeMemBuf* baseURL; + }; + + struct Item* m_itemList; + int m_itemListLength; + + int m_modifierKeyState; // State of Shift/Ctrl/Alt/Meta keys. + wkeMemBuf* m_filesystemId; +} wkeWebDragData; + +typedef enum _wkeWebDragOperation { + wkeWebDragOperationNone = 0, + wkeWebDragOperationCopy = 1, + wkeWebDragOperationLink = 2, + wkeWebDragOperationGeneric = 4, + wkeWebDragOperationPrivate = 8, + wkeWebDragOperationMove = 16, + wkeWebDragOperationDelete = 32, + wkeWebDragOperationEvery = 0xffffffff +} wkeWebDragOperation; + +typedef wkeWebDragOperation wkeWebDragOperationsMask; + +typedef enum _wkeResourceType { + WKE_RESOURCE_TYPE_MAIN_FRAME = 0, // top level page + WKE_RESOURCE_TYPE_SUB_FRAME = 1, // frame or iframe + WKE_RESOURCE_TYPE_STYLESHEET = 2, // a CSS stylesheet + WKE_RESOURCE_TYPE_SCRIPT = 3, // an external script + WKE_RESOURCE_TYPE_IMAGE = 4, // an image (jpg/gif/png/etc) + WKE_RESOURCE_TYPE_FONT_RESOURCE = 5, // a font + WKE_RESOURCE_TYPE_SUB_RESOURCE = 6, // an "other" subresource. + WKE_RESOURCE_TYPE_OBJECT = 7, // an object (or embed) tag for a plugin, + // or a resource that a plugin requested. + WKE_RESOURCE_TYPE_MEDIA = 8, // a media resource. + WKE_RESOURCE_TYPE_WORKER = 9, // the main resource of a dedicated + // worker. + WKE_RESOURCE_TYPE_SHARED_WORKER = 10, // the main resource of a shared worker. + WKE_RESOURCE_TYPE_PREFETCH = 11, // an explicitly requested prefetch + WKE_RESOURCE_TYPE_FAVICON = 12, // a favicon + WKE_RESOURCE_TYPE_XHR = 13, // a XMLHttpRequest + WKE_RESOURCE_TYPE_PING = 14, // a ping request for + WKE_RESOURCE_TYPE_SERVICE_WORKER = 15, // the main resource of a service worker. + WKE_RESOURCE_TYPE_LAST_TYPE +} wkeResourceType; + +typedef struct _wkeWillSendRequestInfo { + wkeString url; + wkeString newUrl; + wkeResourceType resourceType; + int httpResponseCode; + wkeString method; + wkeString referrer; + void* headers; +} wkeWillSendRequestInfo; + +typedef enum _wkeHttBodyElementType { + wkeHttBodyElementTypeData, + wkeHttBodyElementTypeFile, +} wkeHttBodyElementType; + +typedef struct _wkePostBodyElement { + int size; + wkeHttBodyElementType type; + wkeMemBuf* data; + wkeString filePath; + __int64 fileStart; + __int64 fileLength; // -1 means to the end of the file. +} wkePostBodyElement; + +typedef struct _wkePostBodyElements { + int size; + wkePostBodyElement** element; + size_t elementSize; + bool isDirty; +} wkePostBodyElements; + +typedef void* wkeNetJob; + +typedef struct _wkeSlist { + char* data; + struct _wkeSlist* next; +} wkeSlist; + +typedef struct _wkeTempCallbackInfo { + int size; + wkeWebFrameHandle frame; + wkeWillSendRequestInfo* willSendRequestInfo; + const char* url; + wkePostBodyElements* postBody; + wkeNetJob job; +} wkeTempCallbackInfo; + +typedef enum _wkeRequestType { + kWkeRequestTypeInvalidation, + kWkeRequestTypeGet, + kWkeRequestTypePost, + kWkeRequestTypePut, +} wkeRequestType; + +typedef struct _wkePdfDatas { + int count; + size_t* sizes; + const void** datas; +} wkePdfDatas; + +typedef struct _wkePrintSettings { + int structSize; + int dpi; + int width; // in px + int height; + int marginTop; + int marginBottom; + int marginLeft; + int marginRight; + BOOL isPrintPageHeadAndFooter; + BOOL isPrintBackgroud; + BOOL isLandscape; + BOOL isPrintToMultiPage; +} wkePrintSettings; + +typedef struct _wkeScreenshotSettings { + int structSize; + int width; + int height; +} wkeScreenshotSettings; + +typedef void(WKE_CALL_TYPE*wkeCaretChangedCallback)(wkeWebView webView, void* param, const wkeRect* r); +typedef void(WKE_CALL_TYPE*wkeTitleChangedCallback)(wkeWebView webView, void* param, const wkeString title); +typedef void(WKE_CALL_TYPE*wkeURLChangedCallback)(wkeWebView webView, void* param, const wkeString url); +typedef void(WKE_CALL_TYPE*wkeURLChangedCallback2)(wkeWebView webView, void* param, wkeWebFrameHandle frameId, const wkeString url); +typedef void(WKE_CALL_TYPE*wkePaintUpdatedCallback)(wkeWebView webView, void* param, const HDC hdc, int x, int y, int cx, int cy); +typedef void(WKE_CALL_TYPE*wkePaintBitUpdatedCallback)(wkeWebView webView, void* param, const void* buffer, const wkeRect* r, int width, int height); +typedef void(WKE_CALL_TYPE*wkeAlertBoxCallback)(wkeWebView webView, void* param, const wkeString msg); +typedef bool(WKE_CALL_TYPE*wkeConfirmBoxCallback)(wkeWebView webView, void* param, const wkeString msg); +typedef bool(WKE_CALL_TYPE*wkePromptBoxCallback)(wkeWebView webView, void* param, const wkeString msg, const wkeString defaultResult, wkeString result); +typedef bool(WKE_CALL_TYPE*wkeNavigationCallback)(wkeWebView webView, void* param, wkeNavigationType navigationType, wkeString url); +typedef wkeWebView(WKE_CALL_TYPE*wkeCreateViewCallback)(wkeWebView webView, void* param, wkeNavigationType navigationType, const wkeString url, const wkeWindowFeatures* windowFeatures); +typedef void(WKE_CALL_TYPE*wkeDocumentReadyCallback)(wkeWebView webView, void* param); +typedef void(WKE_CALL_TYPE*wkeDocumentReady2Callback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId); + +typedef void(WKE_CALL_TYPE*wkeOnShowDevtoolsCallback)(wkeWebView webView, void* param); + +typedef void(__stdcall *wkeNodeOnCreateProcessCallback)(wkeWebView webView, void* param, const WCHAR* applicationPath, const WCHAR* arguments, STARTUPINFOW* startup); +typedef void(WKE_CALL_TYPE*wkeOnPluginFindCallback)(wkeWebView webView, void* param, const utf8* mime, void* initializeFunc, void* getEntryPointsFunc, void* shutdownFunc); + +typedef void(WKE_CALL_TYPE*wkeOnPrintCallback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId, void* printParams); +typedef void(WKE_CALL_TYPE*wkeOnScreenshot)(wkeWebView webView, void* param, const char* data, size_t size); + +typedef wkeString(WKE_CALL_TYPE*wkeImageBufferToDataURL)(wkeWebView webView, void* param, const char* data, size_t size); + +typedef struct _wkeMediaLoadInfo { + int size; + int width; + int height; + double duration; +} wkeMediaLoadInfo; +typedef void(WKE_CALL_TYPE*wkeWillMediaLoadCallback)(wkeWebView webView, void* param, const char* url, wkeMediaLoadInfo* info); + +typedef void(WKE_CALL_TYPE*wkeStartDraggingCallback)( + wkeWebView webView, + void* param, + wkeWebFrameHandle frame, + const wkeWebDragData* data, + wkeWebDragOperationsMask mask, + const void* image, + const wkePoint* dragImageOffset + ); + +typedef void(WKE_CALL_TYPE*wkeUiThreadRunCallback)(HWND hWnd, void* param); +typedef int(WKE_CALL_TYPE*wkeUiThreadPostTaskCallback)(HWND hWnd, wkeUiThreadRunCallback callback, void* param); + +typedef enum _wkeOtherLoadType { + WKE_DID_START_LOADING, + WKE_DID_STOP_LOADING, + WKE_DID_NAVIGATE, + WKE_DID_NAVIGATE_IN_PAGE, + WKE_DID_GET_RESPONSE_DETAILS, + WKE_DID_GET_REDIRECT_REQUEST, + WKE_DID_POST_REQUEST, +} wkeOtherLoadType; +typedef void(WKE_CALL_TYPE*wkeOnOtherLoadCallback)(wkeWebView webView, void* param, wkeOtherLoadType type, wkeTempCallbackInfo* info); + +typedef enum _wkeOnContextMenuItemClickType { + kWkeContextMenuItemClickTypePrint = 0x01, +} wkeOnContextMenuItemClickType; + +typedef enum _wkeOnContextMenuItemClickStep { + kWkeContextMenuItemClickStepShow = 0x01, + kWkeContextMenuItemClickStepClick = 0x02, +} wkeOnContextMenuItemClickStep; + +typedef bool(WKE_CALL_TYPE* wkeOnContextMenuItemClickCallback)( + wkeWebView webView, + void* param, + wkeOnContextMenuItemClickType type, + wkeOnContextMenuItemClickStep step, + wkeWebFrameHandle frameId, + void* info + ); + +typedef enum _wkeLoadingResult { + WKE_LOADING_SUCCEEDED, + WKE_LOADING_FAILED, + WKE_LOADING_CANCELED +} wkeLoadingResult; + +typedef enum _wkeDownloadOpt { + kWkeDownloadOptCancel, + kWkeDownloadOptCacheData, +} wkeDownloadOpt; + +typedef void(WKE_CALL_TYPE*wkeNetJobDataRecvCallback)(void* ptr, wkeNetJob job, const char* data, int length); +typedef void(WKE_CALL_TYPE*wkeNetJobDataFinishCallback)(void* ptr, wkeNetJob job, wkeLoadingResult result); + +typedef struct _wkeNetJobDataBind { + void* param; + wkeNetJobDataRecvCallback recvCallback; + wkeNetJobDataFinishCallback finishCallback; +} wkeNetJobDataBind; + +typedef void(WKE_CALL_TYPE* wkePopupDialogSaveNameCallback)(void* ptr, const wchar_t* filePath); + +typedef struct _wkeDownloadBind { + void* param; + wkeNetJobDataRecvCallback recvCallback; + wkeNetJobDataFinishCallback finishCallback; + wkePopupDialogSaveNameCallback saveNameCallback; +} wkeDownloadBind; + +enum wkeDialogProperties { + kWkeDialogPropertiesOpenFile = 1 << 1, // 鍏佽閫夋嫨鏂囦欢 + kWkeDialogPropertiesOpenDirectory = 1 << 2, // 鍏佽閫夋嫨鏂囦欢澶 + kWkeDialogPropertiesMultiSelections = 1 << 3, // 鍏佽澶氶夈 + kWkeDialogPropertiesShowHiddenFiles = 1 << 4, // 鏄剧ず瀵硅瘽妗嗕腑鐨勯殣钘忔枃浠躲 + kWkeDialogPropertiesCreateDirectory = 1 << 5, // macOS - 鍏佽浣犻氳繃瀵硅瘽妗嗙殑褰㈠紡鍒涘缓鏂扮殑鐩綍銆 + kWkeDialogPropertiesPromptToCreate = 1 << 6, // Windows - 濡傛灉杈撳叆鐨勬枃浠惰矾寰勫湪瀵硅瘽妗嗕腑涓嶅瓨鍦, 鍒欐彁绀哄垱寤恒 杩欏苟涓嶆槸鐪熺殑鍦ㄨ矾寰勪笂鍒涘缓涓涓枃浠讹紝鑰屾槸鍏佽杩斿洖涓浜涗笉瀛樺湪鐨勫湴鍧浜ょ敱搴旂敤绋嬪簭鍘诲垱寤恒 + kWkeDialogPropertiesNoResolveAliases = 1 << 7, // macOS - 绂佺敤鑷姩鐨勫埆鍚嶈矾寰(绗﹀彿閾炬帴) 瑙f瀽銆 鎵閫夊埆鍚嶇幇鍦ㄥ皢浼氳繑鍥炲埆鍚嶈矾寰勮岄潪鍏剁洰鏍囪矾寰勩 + kWkeDialogPropertiesTreatPackageAsDirectory = 1 << 8, // macOS - 灏嗗寘(濡.app 鏂囦欢澶) 瑙嗕负鐩綍鑰屼笉鏄枃浠躲 + kWkeDialogPropertiesDontAddToRecent = 1 << 9, // Windows - 涓嶈灏嗘鍦ㄦ墦寮鐨勯」鐩坊鍔犲埌鏈杩戠殑鏂囨。鍒楄〃涓 +}; + +typedef struct _wkeFileFilter { + const utf8* name; // 渚嬪"image"銆"Movies" + const utf8* extensions; // 渚嬪"jpg|png|gif" +} wkeFileFilter; + +typedef struct _wkeDialogOptions { + int magic; // 'mbdo' + utf8* title; + utf8* defaultPath; + utf8* buttonLabel; + wkeFileFilter* filters; + int filtersCount; + wkeDialogProperties prop; + utf8* message; + BOOL securityScopedBookmarks; +} wkeDialogOptions; + +typedef wkeDownloadOpt(WKE_CALL_TYPE* wkeDownloadInBlinkThreadCallback)( + wkeWebView webView, + void* param, + size_t expectedContentLength, + const char* url, + const char* mime, + const char* disposition, + wkeNetJob job, + wkeNetJobDataBind* dataBind + ); + +typedef void(WKE_CALL_TYPE*wkeLoadingFinishCallback)(wkeWebView webView, void* param, const wkeString url, wkeLoadingResult result, const wkeString failedReason); +typedef bool(WKE_CALL_TYPE*wkeDownloadCallback)(wkeWebView webView, void* param, const char* url); +typedef wkeDownloadOpt(WKE_CALL_TYPE*wkeDownload2Callback)( + wkeWebView webView, + void* param, + size_t expectedContentLength, + const char* url, + const char* mime, + const char* disposition, + wkeNetJob job, + wkeNetJobDataBind* dataBind); + +typedef enum _wkeConsoleLevel { + wkeLevelDebug = 4, + wkeLevelLog = 1, + wkeLevelInfo = 5, + wkeLevelWarning = 2, + wkeLevelError = 3, + wkeLevelRevokedError = 6, + wkeLevelLast = wkeLevelInfo +} wkeConsoleLevel; +typedef void(WKE_CALL_TYPE*wkeConsoleCallback)(wkeWebView webView, void* param, wkeConsoleLevel level, const wkeString message, const wkeString sourceName, unsigned sourceLine, const wkeString stackTrace); + +typedef void(WKE_CALL_TYPE*wkeOnCallUiThread)(wkeWebView webView, void* paramOnInThread); +typedef void(WKE_CALL_TYPE*wkeCallUiThread)(wkeWebView webView, wkeOnCallUiThread func, void* param); + +typedef wkeMediaPlayer(WKE_CALL_TYPE* wkeMediaPlayerFactory)(wkeWebView webView, wkeMediaPlayerClient client, void* npBrowserFuncs, void* npPluginFuncs); +typedef bool(WKE_CALL_TYPE* wkeOnIsMediaPlayerSupportsMIMEType)(const utf8* mime); + +//wkeNet-------------------------------------------------------------------------------------- + +typedef struct wkeWebUrlRequest* wkeWebUrlRequestPtr; +typedef struct wkeWebUrlResponse* wkeWebUrlResponsePtr; + +typedef void(WKE_CALL_TYPE* wkeOnUrlRequestWillRedirectCallback)(wkeWebView webView, void* param, wkeWebUrlRequestPtr oldRequest, wkeWebUrlRequestPtr request, wkeWebUrlResponsePtr redirectResponse); +typedef void(WKE_CALL_TYPE* wkeOnUrlRequestDidReceiveResponseCallback)(wkeWebView webView, void* param, wkeWebUrlRequestPtr request, wkeWebUrlResponsePtr response); +typedef void(WKE_CALL_TYPE* wkeOnUrlRequestDidReceiveDataCallback)(wkeWebView webView, void* param, wkeWebUrlRequestPtr request, const char* data, int dataLength); +typedef void(WKE_CALL_TYPE* wkeOnUrlRequestDidFailCallback)(wkeWebView webView, void* param, wkeWebUrlRequestPtr request, const utf8* error); +typedef void(WKE_CALL_TYPE* wkeOnUrlRequestDidFinishLoadingCallback)(wkeWebView webView, void* param, wkeWebUrlRequestPtr request, double finishTime); + +typedef struct _wkeUrlRequestCallbacks { + wkeOnUrlRequestWillRedirectCallback willRedirectCallback; + wkeOnUrlRequestDidReceiveResponseCallback didReceiveResponseCallback; + wkeOnUrlRequestDidReceiveDataCallback didReceiveDataCallback; + wkeOnUrlRequestDidFailCallback didFailCallback; + wkeOnUrlRequestDidFinishLoadingCallback didFinishLoadingCallback; +} wkeUrlRequestCallbacks; + +typedef bool(WKE_CALL_TYPE*wkeLoadUrlBeginCallback)(wkeWebView webView, void* param, const utf8* url, wkeNetJob job); +typedef void(WKE_CALL_TYPE*wkeLoadUrlEndCallback)(wkeWebView webView, void* param, const utf8* url, wkeNetJob job, void* buf, int len); +typedef void(WKE_CALL_TYPE*wkeLoadUrlFailCallback)(wkeWebView webView, void* param, const utf8* url, wkeNetJob job); +typedef void(WKE_CALL_TYPE*wkeLoadUrlHeadersReceivedCallback)(wkeWebView webView, void* param, const utf8* url, wkeNetJob job); +typedef void(WKE_CALL_TYPE*wkeLoadUrlFinishCallback)(wkeWebView webView, void* param, const utf8* url, wkeNetJob job, int len); + +typedef void(WKE_CALL_TYPE*wkeDidCreateScriptContextCallback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId, void* context, int extensionGroup, int worldId); +typedef void(WKE_CALL_TYPE*wkeWillReleaseScriptContextCallback)(wkeWebView webView, void* param, wkeWebFrameHandle frameId, void* context, int worldId); +typedef bool(WKE_CALL_TYPE*wkeNetResponseCallback)(wkeWebView webView, void* param, const utf8* url, wkeNetJob job); +typedef void(WKE_CALL_TYPE*wkeOnNetGetFaviconCallback)(wkeWebView webView, void* param, const utf8* url, wkeMemBuf* buf); + +typedef void* v8ContextPtr; +typedef void* v8Isolate; + +//wke window----------------------------------------------------------------------------------- +typedef enum _wkeWindowType { + WKE_WINDOW_TYPE_POPUP, + WKE_WINDOW_TYPE_TRANSPARENT, + WKE_WINDOW_TYPE_CONTROL +} wkeWindowType; + +typedef struct _wkeWindowCreateInfo { + int size; + HWND parent; + DWORD style; + DWORD styleEx; + int x; + int y; + int width; + int height; + COLORREF color; +} wkeWindowCreateInfo; + +typedef struct _wkeDefaultPrinterSettings { + int structSize; // 榛樿鏄4 * 10 + BOOL isLandscape; // 鏄惁涓烘í鍚戞墦鍗版牸寮 + BOOL isPrintHeadFooter; // + BOOL isPrintBackgroud; // 鏄惁鎵撳嵃鑳屾櫙 + int edgeDistanceLeft; // 涓婅竟璺濆崟浣嶏細姣背 + int edgeDistanceTop; + int edgeDistanceRight; + int edgeDistanceBottom; + int copies; // 榛樿鎵撳嵃浠芥暟 + int paperType; // DMPAPER_A4绛 +#if defined(__cplusplus) + inline _wkeDefaultPrinterSettings(); +#endif +} wkeDefaultPrinterSettings; + +typedef bool(WKE_CALL_TYPE*wkeWindowClosingCallback)(wkeWebView webWindow, void* param); +typedef void(WKE_CALL_TYPE*wkeWindowDestroyCallback)(wkeWebView webWindow, void* param); + +typedef struct { + RECT bounds; + bool draggable; +} wkeDraggableRegion; +typedef void(WKE_CALL_TYPE*wkeDraggableRegionsChangedCallback)(wkeWebView webView, void* param, const wkeDraggableRegion* rects, int rectCount); + +//JavaScript Bind----------------------------------------------------------------------------------- +#define JS_CALL __fastcall +typedef jsValue(JS_CALL* jsNativeFunction) (jsExecState es); + +typedef jsValue(WKE_CALL_TYPE* wkeJsNativeFunction) (jsExecState es, void* param); + +typedef enum _jsType { + JSTYPE_NUMBER, + JSTYPE_STRING, + JSTYPE_BOOLEAN, + JSTYPE_OBJECT, + JSTYPE_FUNCTION, + JSTYPE_UNDEFINED, + JSTYPE_ARRAY, + JSTYPE_NULL, +} jsType; + +// cexer JS瀵硅薄銆佸嚱鏁扮粦瀹氭敮鎸 +typedef jsValue(WKE_CALL_TYPE*jsGetPropertyCallback)(jsExecState es, jsValue object, const char* propertyName); +typedef bool(WKE_CALL_TYPE*jsSetPropertyCallback)(jsExecState es, jsValue object, const char* propertyName, jsValue value); +typedef jsValue(WKE_CALL_TYPE*jsCallAsFunctionCallback)(jsExecState es, jsValue object, jsValue* args, int argCount); +struct tagjsData; // declare warning fix +typedef void(WKE_CALL_TYPE*jsFinalizeCallback)(struct tagjsData* data); + +typedef struct tagjsData { + char typeName[100]; + jsGetPropertyCallback propertyGet; + jsSetPropertyCallback propertySet; + jsFinalizeCallback finalize; + jsCallAsFunctionCallback callAsFunction; +} jsData; + +typedef struct _jsExceptionInfo { + const utf8* message; // Returns the exception message. + const utf8* sourceLine; // Returns the line of source code that the exception occurred within. + const utf8* scriptResourceName; // Returns the resource name for the script from where the function causing the error originates. + int lineNumber; // Returns the 1-based number of the line where the error occurred or 0 if the line number is unknown. + int startPosition; // Returns the index within the script of the first character where the error occurred. + int endPosition; // Returns the index within the script of the last character where the error occurred. + int startColumn; // Returns the index within the line of the first character where the error occurred. + int endColumn; // Returns the index within the line of the last character where the error occurred. + const utf8* callstackString; +} jsExceptionInfo; + +typedef struct _jsKeys { + unsigned int length; + const char** keys; + +#if defined(__cplusplus) + ~_jsKeys(); +#endif +} jsKeys; + + +#if defined(__cplusplus) +namespace wke { + +class IWebView { +public: + virtual void destroy() = 0; + + virtual const char* name() const = 0; + virtual void setName(const char* name) = 0; + + virtual bool isTransparent() const = 0; + virtual void setTransparent(bool transparent) = 0; + + virtual void loadURL(const utf8* url) = 0; + virtual void loadURL(const wchar_t* url) = 0; + + virtual void loadHTML(const utf8* html) = 0; + virtual void loadHTML(const wchar_t* html) = 0; + + virtual void loadFile(const utf8* filename) = 0; + virtual void loadFile(const wchar_t* filename) = 0; + + virtual const utf8* url() const = 0; + + virtual bool isLoading() const = 0; /*document load sucessed*/ + virtual bool isLoadingFailed() const = 0; /*document load failed*/ + virtual bool isLoadingSucceeded() const = 0; /*document load complete*/ + virtual bool isDocumentReady() const = 0; /*document ready*/ + virtual void stopLoading() = 0; + virtual void reload() = 0; + + virtual const utf8* title() = 0; + virtual const wchar_t* titleW() = 0; + + virtual void resize(int w, int h) = 0; + virtual int width() const = 0; /*viewport width*/ + virtual int height() const = 0; /*viewport height*/ + + virtual int contentsWidth() const = 0; /*contents width*/ + virtual int contentsHeight() const = 0; /*contents height*/ + + virtual void setDirty(bool dirty) = 0; + virtual bool isDirty() const = 0; + virtual void addDirtyArea(int x, int y, int w, int h) = 0; + + virtual void layoutIfNeeded() = 0; + virtual void paint(void* bits, int pitch) = 0; + + virtual bool canGoBack() const = 0; + virtual bool goBack() = 0; + virtual bool canGoForward() const = 0; + virtual bool goForward() = 0; + + virtual void editorSelectAll() = 0; + virtual void editorUnSelect() = 0; + virtual void editorCopy() = 0; + virtual void editorCut() = 0; + virtual void editorPaste() = 0; + virtual void editorDelete() = 0; + virtual void editorUndo() = 0; + virtual void editorRedo() = 0; + + virtual void setCookieEnabled(bool enable) = 0; + virtual bool isCookieEnabled() const = 0; + + virtual void setMediaVolume(float volume) = 0; + virtual float mediaVolume() const = 0; + + virtual bool fireMouseEvent(unsigned int message, int x, int y, unsigned int flags) = 0; + virtual bool fireContextMenuEvent(int x, int y, unsigned int flags) = 0; + virtual bool fireMouseWheelEvent(int x, int y, int delta, unsigned int flags) = 0; + virtual bool fireKeyUpEvent(unsigned int virtualKeyCode, unsigned int flags, bool systemKey) = 0; + virtual bool fireKeyDownEvent(unsigned int virtualKeyCode, unsigned int flags, bool systemKey) = 0; + virtual bool fireKeyPressEvent(unsigned int virtualKeyCode, unsigned int flags, bool systemKey) = 0; + + virtual void setFocus() = 0; + virtual void killFocus() = 0; + + virtual wkeRect getCaret() = 0; + + virtual jsValue runJS(const utf8* script) = 0; + virtual jsValue runJS(const wchar_t* script) = 0; + virtual jsExecState globalExec() = 0; + + virtual void sleep() = 0; //moveOffscreen + virtual void wake() = 0; //moveOnscreen + virtual bool isAwake() const = 0; + + virtual void setZoomFactor(float factor) = 0; + virtual float zoomFactor() const = 0; + + virtual void setEditable(bool editable) = 0; + + virtual void setClientHandler(const wkeClientHandler* handler) = 0; + virtual const wkeClientHandler* getClientHandler() const = 0; +}; + +} +#endif + +////////////////////////////////////////////////////////////////////////// + +#define WKE_DEFINE_ITERATOR0(returnVal, name, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR1(returnVal, name, p1, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR2(returnVal, name, p1, p2, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR3(returnVal, name, p1, p2, p3, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR9(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8, p9); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR10(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +#define WKE_DEFINE_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \ + typedef returnVal(WKE_CALL_TYPE* FN_##name)(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); \ + __declspec(selectany) FN_##name name = ((FN_##name)0); + +// --- + +#define WKE_DECLARE_ITERATOR0(returnVal, name, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(); + +#define WKE_DECLARE_ITERATOR1(returnVal, name, p1, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1); + +#define WKE_DECLARE_ITERATOR2(returnVal, name, p1, p2, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2); + +#define WKE_DECLARE_ITERATOR3(returnVal, name, p1, p2, p3, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3); + +#define WKE_DECLARE_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4); + +#define WKE_DECLARE_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5); + +#define WKE_DECLARE_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5, p6); + +#define WKE_DECLARE_ITERATOR9(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8, p9); + +#define WKE_DECLARE_ITERATOR10(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); + +#define WKE_DECLARE_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \ + WKE_EXTERN_C __declspec(dllexport) returnVal WKE_CALL_TYPE name(p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11); + +// --- + +#define WKE_GET_PTR_ITERATOR(name) \ + name = (FN_##name)GetProcAddress(hMod, #name); \ + if (!name) \ + MessageBoxA(((HWND)0), "wke api not found", #name, 0); + +#define WKE_GET_PTR_ITERATOR0(returnVal, name, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR1(returnVal, name, p1, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR2(returnVal, name, p1, p2, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR3(returnVal, name, p1, p2, p3, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR4(returnVal, name, p1, p2, p3, p4, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR5(returnVal, name, p1, p2, p3, p4, p5, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR6(returnVal, name, p1, p2, p3, p4, p5, p6, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR9(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR10(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, description) \ + WKE_GET_PTR_ITERATOR(name); + +#define WKE_GET_PTR_ITERATOR11(returnVal, name, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, description) \ + WKE_GET_PTR_ITERATOR(name); + +// 浠ヤ笅鏄痺ke鐨勫鍑哄嚱鏁般傛牸寮忔寜鐓с愯繑鍥炵被鍨嬨戙愬嚱鏁板悕銆戙愬弬鏁般戞潵鎺掑垪 + +#define WKE_FOR_EACH_DEFINE_FUNCTION(ITERATOR0, ITERATOR1, ITERATOR2, ITERATOR3, ITERATOR4, ITERATOR5, ITERATOR6, ITERATOR9, ITERATOR10, ITERATOR11) \ + ITERATOR0(void, wkeShutdown, "") \ + ITERATOR0(void, wkeShutdownForDebug, "娴嬭瘯浣跨敤锛屼笉浜嗚В鍗冧竾鍒敤锛") \ + \ + ITERATOR0(unsigned int, wkeVersion, "") \ + ITERATOR0(const utf8*, wkeVersionString, "") \ + ITERATOR2(void, wkeGC, wkeWebView webView, long intervalSec, "") \ + ITERATOR2(void, wkeSetResourceGc, wkeWebView webView, long intervalSec, "") \ + \ + ITERATOR5(void, wkeSetFileSystem, WKE_FILE_OPEN pfnOpen, WKE_FILE_CLOSE pfnClose, WKE_FILE_SIZE pfnSize, WKE_FILE_READ pfnRead, WKE_FILE_SEEK pfnSeek, "") \ + \ + ITERATOR1(const char*, wkeWebViewName, wkeWebView webView, "") \ + ITERATOR2(void, wkeSetWebViewName, wkeWebView webView, const char* name, "") \ + \ + ITERATOR1(BOOL, wkeIsLoaded, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsLoadFailed, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsLoadComplete, wkeWebView webView, "") \ + \ + ITERATOR1(const utf8*, wkeGetSource, wkeWebView webView, "") \ + ITERATOR1(const utf8*, wkeTitle, wkeWebView webView, "") \ + ITERATOR1(const wchar_t*, wkeTitleW, wkeWebView webView, "") \ + ITERATOR1(int, wkeWidth, wkeWebView webView, "") \ + ITERATOR1(int, wkeHeight, wkeWebView webView, "") \ + ITERATOR1(int, wkeContentsWidth, wkeWebView webView, "") \ + ITERATOR1(int, wkeContentsHeight, wkeWebView webView, "") \ + \ + ITERATOR1(void, wkeSelectAll, wkeWebView webView, "") \ + ITERATOR1(void, wkeCopy, wkeWebView webView, "") \ + ITERATOR1(void, wkeCut, wkeWebView webView, "") \ + ITERATOR1(void, wkePaste, wkeWebView webView, "") \ + ITERATOR1(void, wkeDelete, wkeWebView webView, "") \ + \ + ITERATOR1(BOOL, wkeCookieEnabled, wkeWebView webView, "") \ + ITERATOR1(float, wkeMediaVolume, wkeWebView webView, "") \ + \ + ITERATOR5(BOOL, wkeMouseEvent, wkeWebView webView, unsigned int message, int x, int y, unsigned int flags, "") \ + ITERATOR4(BOOL, wkeContextMenuEvent, wkeWebView webView, int x, int y, unsigned int flags, "") \ + ITERATOR5(BOOL, wkeMouseWheel, wkeWebView webView, int x, int y, int delta, unsigned int flags, "") \ + ITERATOR4(BOOL, wkeKeyUp, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \ + ITERATOR4(BOOL, wkeKeyDown, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \ + ITERATOR4(BOOL, wkeKeyPress, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \ + \ + ITERATOR1(void, wkeFocus, wkeWebView webView, "") \ + ITERATOR1(void, wkeUnfocus, wkeWebView webView, "") \ + \ + ITERATOR1(wkeRect, wkeGetCaret, wkeWebView webView, "") \ + \ + ITERATOR1(void, wkeAwaken, wkeWebView webView, "") \ + \ + ITERATOR1(float, wkeZoomFactor, wkeWebView webView, "") \ + \ + ITERATOR2(void, wkeSetClientHandler, wkeWebView webView, const wkeClientHandler* handler, "") \ + ITERATOR1(const wkeClientHandler*, wkeGetClientHandler, wkeWebView webView, "") \ + \ + ITERATOR1(const utf8*, wkeToString, const wkeString string, "") \ + ITERATOR1(const wchar_t*, wkeToStringW, const wkeString string, "") \ + \ + ITERATOR2(const utf8*, jsToString, jsExecState es, jsValue v, "") \ + ITERATOR2(const wchar_t*, jsToStringW, jsExecState es, jsValue v, "") \ + \ + ITERATOR1(void, wkeConfigure, const wkeSettings* settings, "") \ + ITERATOR0(BOOL, wkeIsInitialize, "") \ + \ + ITERATOR2(void, wkeSetViewSettings, wkeWebView webView, const wkeViewSettings* settings, "") \ + ITERATOR3(void, wkeSetDebugConfig, wkeWebView webView, const char* debugString, const char* param, "") \ + ITERATOR2(void *, wkeGetDebugConfig, wkeWebView webView, const char* debugString, "") \ + \ + ITERATOR0(void, wkeFinalize, "") \ + ITERATOR0(void, wkeUpdate, "") \ + ITERATOR0(unsigned int, wkeGetVersion, "") \ + ITERATOR0(const utf8*, wkeGetVersionString, "") \ + \ + ITERATOR0(wkeWebView, wkeCreateWebView, "") \ + ITERATOR1(void, wkeDestroyWebView, wkeWebView webView, "") \ + \ + ITERATOR2(void, wkeSetMemoryCacheEnable, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetMouseEnabled, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetTouchEnabled, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetSystemTouchEnabled, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetContextMenuEnabled, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetNavigationToNewWindowEnable, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetCspCheckEnable, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetNpapiPluginsEnabled, wkeWebView webView, bool b, "") \ + ITERATOR2(void, wkeSetHeadlessEnabled, wkeWebView webView, bool b, "鍙互鍏抽棴娓叉煋") \ + ITERATOR2(void, wkeSetDragEnable, wkeWebView webView, bool b, "鍙叧闂嫋鎷芥枃浠跺姞杞界綉椤") \ + ITERATOR2(void, wkeSetDragDropEnable, wkeWebView webView, bool b, "鍙叧闂嫋鎷藉埌鍏朵粬杩涚▼") \ + ITERATOR3(void, wkeSetContextMenuItemShow, wkeWebView webView, wkeMenuItemId item, bool isShow, "璁剧疆鏌愰」menu鏄惁鏄剧ず") \ + ITERATOR2(void, wkeSetLanguage, wkeWebView webView, const char* language, "") \ + \ + ITERATOR2(void, wkeSetViewNetInterface, wkeWebView webView, const char* netInterface, "") \ + \ + ITERATOR1(void, wkeSetProxy, const wkeProxy* proxy, "") \ + ITERATOR2(void, wkeSetViewProxy, wkeWebView webView, wkeProxy *proxy, "") \ + \ + ITERATOR1(const char*, wkeGetName, wkeWebView webView, "") \ + ITERATOR2(void, wkeSetName, wkeWebView webView, const char* name, "") \ + \ + ITERATOR2(void, wkeSetHandle, wkeWebView webView, HWND wnd, "") \ + ITERATOR3(void, wkeSetHandleOffset, wkeWebView webView, int x, int y, "") \ + \ + ITERATOR1(BOOL, wkeIsTransparent, wkeWebView webView, "") \ + ITERATOR2(void, wkeSetTransparent, wkeWebView webView, bool transparent, "") \ + \ + ITERATOR2(void, wkeSetUserAgent, wkeWebView webView, const utf8* userAgent, "") \ + ITERATOR1(const char*, wkeGetUserAgent, wkeWebView webView, "") \ + ITERATOR2(void, wkeSetUserAgentW, wkeWebView webView, const wchar_t* userAgent, "") \ + \ + ITERATOR4(void, wkeShowDevtools, wkeWebView webView, const wchar_t* path, wkeOnShowDevtoolsCallback callback, void* param, "") \ + \ + ITERATOR2(void, wkeLoadW, wkeWebView webView, const wchar_t* url, "") \ + ITERATOR2(void, wkeLoadURL, wkeWebView webView, const utf8* url, "") \ + ITERATOR2(void, wkeLoadURLW, wkeWebView webView, const wchar_t* url, "") \ + ITERATOR4(void, wkePostURL, wkeWebView wkeView, const utf8* url, const char* postData, int postLen, "") \ + ITERATOR4(void, wkePostURLW, wkeWebView wkeView, const wchar_t* url, const char* postData, int postLen, "") \ + \ + ITERATOR2(void, wkeLoadHTML, wkeWebView webView, const utf8* html, "") \ + ITERATOR3(void, wkeLoadHtmlWithBaseUrl, wkeWebView webView, const utf8* html, const utf8* baseUrl, "") \ + ITERATOR2(void, wkeLoadHTMLW, wkeWebView webView, const wchar_t* html, "") \ + \ + ITERATOR2(void, wkeLoadFile, wkeWebView webView, const utf8* filename, "") \ + ITERATOR2(void, wkeLoadFileW, wkeWebView webView, const wchar_t* filename, "") \ + \ + ITERATOR1(const utf8*, wkeGetURL, wkeWebView webView, "") \ + ITERATOR2(const utf8*, wkeGetFrameUrl, wkeWebView webView, wkeWebFrameHandle frameId, "") \ + \ + ITERATOR1(BOOL, wkeIsLoading, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsLoadingSucceeded, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsLoadingFailed, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsLoadingCompleted, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsDocumentReady, wkeWebView webView, "") \ + ITERATOR1(void, wkeStopLoading, wkeWebView webView, "") \ + ITERATOR1(void, wkeReload, wkeWebView webView, "") \ + ITERATOR2(void, wkeGoToOffset, wkeWebView webView, int offset, "") \ + ITERATOR2(void, wkeGoToIndex, wkeWebView webView, int index, "") \ + \ + ITERATOR1(int, wkeGetWebviewId, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsWebviewAlive, int id, "") \ + ITERATOR1(BOOL, wkeIsWebviewValid, wkeWebView webView, "") \ + \ + ITERATOR3(const utf8*, wkeGetDocumentCompleteURL, wkeWebView webView, wkeWebFrameHandle frameId, const utf8* partialURL, "") \ + \ + ITERATOR3(wkeMemBuf*, wkeCreateMemBuf, wkeWebView webView, void* buf, size_t length, "") \ + ITERATOR1(void, wkeFreeMemBuf, wkeMemBuf* buf, "") \ + \ + ITERATOR1(const utf8*, wkeGetTitle, wkeWebView webView, "") \ + ITERATOR1(const wchar_t*, wkeGetTitleW, wkeWebView webView, "") \ + \ + ITERATOR3(void, wkeResize, wkeWebView webView, int w, int h, "") \ + ITERATOR1(int, wkeGetWidth, wkeWebView webView, "") \ + ITERATOR1(int, wkeGetHeight, wkeWebView webView, "") \ + ITERATOR1(int, wkeGetContentWidth, wkeWebView webView, "") \ + ITERATOR1(int, wkeGetContentHeight, wkeWebView webView, "") \ + \ + ITERATOR2(void, wkeSetDirty, wkeWebView webView, bool dirty, "") \ + ITERATOR1(BOOL, wkeIsDirty, wkeWebView webView, "") \ + ITERATOR5(void, wkeAddDirtyArea, wkeWebView webView, int x, int y, int w, int h, "") \ + ITERATOR1(void, wkeLayoutIfNeeded, wkeWebView webView, "") \ + ITERATOR11(void, wkePaint2, wkeWebView webView, void* bits, int bufWid, int bufHei, int xDst, int yDst, int w, int h, int xSrc, int ySrc, bool bCopyAlpha, "") \ + ITERATOR3(void, wkePaint, wkeWebView webView, void* bits, int pitch, "") \ + ITERATOR1(void, wkeRepaintIfNeeded, wkeWebView webView, "") \ + ITERATOR1(HDC, wkeGetViewDC, wkeWebView webView, "") \ + ITERATOR1(void, wkeUnlockViewDC, wkeWebView webView, "") \ + ITERATOR1(HWND, wkeGetHostHWND, wkeWebView webView, "") \ + \ + ITERATOR1(BOOL, wkeCanGoBack, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeGoBack, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeCanGoForward, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeGoForward, wkeWebView webView, "") \ + ITERATOR2(BOOL, wkeNavigateAtIndex, wkeWebView webView, int index, "") \ + ITERATOR1(int, wkeGetNavigateIndex, wkeWebView webView, "") \ + \ + ITERATOR1(void, wkeEditorSelectAll, wkeWebView webView, "") \ + ITERATOR1(void, wkeEditorUnSelect, wkeWebView webView, "") \ + ITERATOR1(void, wkeEditorCopy, wkeWebView webView, "") \ + ITERATOR1(void, wkeEditorCut, wkeWebView webView, "") \ + ITERATOR1(void, wkeEditorPaste, wkeWebView webView, "") \ + ITERATOR1(void, wkeEditorDelete, wkeWebView webView, "") \ + ITERATOR1(void, wkeEditorUndo, wkeWebView webView, "") \ + ITERATOR1(void, wkeEditorRedo, wkeWebView webView, "") \ + \ + ITERATOR1(const wchar_t*, wkeGetCookieW, wkeWebView webView, "") \ + ITERATOR1(const utf8*, wkeGetCookie, wkeWebView webView, "") \ + ITERATOR3(void, wkeSetCookie, wkeWebView webView, const utf8* url, const utf8* cookie, "cookie鏍煎紡蹇呴』鏄被浼:cna=4UvTFE12fEECAXFKf4SFW5eo; expires=Tue, 23-Jan-2029 13:17:21 GMT; path=/; domain=.youku.com") \ + ITERATOR3(void, wkeVisitAllCookie, wkeWebView webView, void* params, wkeCookieVisitor visitor, "") \ + ITERATOR2(void, wkePerformCookieCommand, wkeWebView webView, wkeCookieCommand command, "") \ + ITERATOR2(void, wkeSetCookieEnabled, wkeWebView webView, bool enable, "") \ + ITERATOR1(BOOL, wkeIsCookieEnabled, wkeWebView webView, "") \ + ITERATOR2(void, wkeSetCookieJarPath, wkeWebView webView, const WCHAR* path, "") \ + ITERATOR2(void, wkeSetCookieJarFullPath, wkeWebView webView, const WCHAR* path, "") \ + ITERATOR1(void, wkeClearCookie, wkeWebView webView, "") \ + ITERATOR2(void, wkeSetLocalStorageFullPath, wkeWebView webView, const WCHAR* path, "") \ + ITERATOR2(void, wkeAddPluginDirectory, wkeWebView webView, const WCHAR* path, "") \ + \ + ITERATOR2(void, wkeSetMediaVolume, wkeWebView webView, float volume, "") \ + ITERATOR1(float, wkeGetMediaVolume, wkeWebView webView, "") \ + \ + ITERATOR5(BOOL, wkeFireMouseEvent, wkeWebView webView, unsigned int message, int x, int y, unsigned int flags, "") \ + ITERATOR4(BOOL, wkeFireContextMenuEvent, wkeWebView webView, int x, int y, unsigned int flags, "") \ + ITERATOR5(BOOL, wkeFireMouseWheelEvent, wkeWebView webView, int x, int y, int delta, unsigned int flags, "") \ + ITERATOR4(BOOL, wkeFireKeyUpEvent, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \ + ITERATOR4(BOOL, wkeFireKeyDownEvent, wkeWebView webView, unsigned int virtualKeyCode, unsigned int flags, bool systemKey, "") \ + ITERATOR4(BOOL, wkeFireKeyPressEvent, wkeWebView webView, unsigned int charCode, unsigned int flags, bool systemKey, "") \ + ITERATOR6(BOOL, wkeFireWindowsMessage, wkeWebView webView, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT* result, "") \ + \ + ITERATOR1(void, wkeSetFocus, wkeWebView webView, "") \ + ITERATOR1(void, wkeKillFocus, wkeWebView webView, "") \ + \ + ITERATOR1(wkeRect, wkeGetCaretRect, wkeWebView webView, "") \ + ITERATOR1(wkeRect*, wkeGetCaretRect2, wkeWebView webView, "缁欎竴浜涗笉鏂逛究鑾峰彇杩斿洖缁撴瀯浣撶殑璇█璋冪敤") \ + \ + ITERATOR2(jsValue, wkeRunJS, wkeWebView webView, const utf8* script, "") \ + ITERATOR2(jsValue, wkeRunJSW, wkeWebView webView, const wchar_t* script, "") \ + \ + ITERATOR1(jsExecState, wkeGlobalExec, wkeWebView webView, "") \ + ITERATOR2(jsExecState, wkeGetGlobalExecByFrame, wkeWebView webView, wkeWebFrameHandle frameId, "") \ + \ + ITERATOR1(void, wkeSleep, wkeWebView webView, "") \ + ITERATOR1(void, wkeWake, wkeWebView webView, "") \ + ITERATOR1(BOOL, wkeIsAwake, wkeWebView webView, "") \ + \ + ITERATOR2(void, wkeSetZoomFactor, wkeWebView webView, float factor, "") \ + ITERATOR1(float, wkeGetZoomFactor, wkeWebView webView, "") \ + ITERATOR0(void, wkeEnableHighDPISupport, "") \ + \ + ITERATOR2(void, wkeSetEditable, wkeWebView webView, bool editable, "") \ + \ + ITERATOR1(const utf8*, wkeGetString, const wkeString string, "") \ + ITERATOR1(const wchar_t*, wkeGetStringW, const wkeString string, "") \ + \ + ITERATOR3(void, wkeSetString, wkeString string, const utf8* str, size_t len, "") \ + ITERATOR3(void, wkeSetStringWithoutNullTermination, wkeString string, const utf8* str, size_t len, "") \ + ITERATOR3(void, wkeSetStringW, wkeString string, const wchar_t* str, size_t len, "") \ + \ + ITERATOR2(wkeString, wkeCreateString, const utf8* str, size_t len, "") \ + ITERATOR2(wkeString, wkeCreateStringW, const wchar_t* str, size_t len, "") \ + ITERATOR2(wkeString, wkeCreateStringWithoutNullTermination, const utf8* str, size_t len, "") \ + ITERATOR1(size_t, wkeGetStringLen, wkeString str, "") \ + ITERATOR1(void, wkeDeleteString, wkeString str, "") \ + \ + ITERATOR0(wkeWebView, wkeGetWebViewForCurrentContext, "") \ + ITERATOR3(void, wkeSetUserKeyValue, wkeWebView webView, const char* key, void* value, "") \ + ITERATOR2(void*, wkeGetUserKeyValue, wkeWebView webView, const char* key, "") \ + \ + ITERATOR1(int, wkeGetCursorInfoType, wkeWebView webView, "") \ + ITERATOR2(void, wkeSetCursorInfoType, wkeWebView webView, int type, "") \ + ITERATOR5(void, wkeSetDragFiles, wkeWebView webView, const POINT* clintPos, const POINT* screenPos, wkeString* files, int filesCount, "") \ + \ + ITERATOR5(void, wkeSetDeviceParameter, wkeWebView webView, const char* device, const char* paramStr, int paramInt, float paramFloat, "") \ + ITERATOR1(wkeTempCallbackInfo*, wkeGetTempCallbackInfo, wkeWebView webView, "") \ + \ + ITERATOR3(void, wkeOnCaretChanged, wkeWebView webView, wkeCaretChangedCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnMouseOverUrlChanged, wkeWebView webView, wkeTitleChangedCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnTitleChanged, wkeWebView webView, wkeTitleChangedCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnURLChanged, wkeWebView webView, wkeURLChangedCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnURLChanged2, wkeWebView webView, wkeURLChangedCallback2 callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnPaintUpdated, wkeWebView webView, wkePaintUpdatedCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnPaintBitUpdated, wkeWebView webView, wkePaintBitUpdatedCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnAlertBox, wkeWebView webView, wkeAlertBoxCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnConfirmBox, wkeWebView webView, wkeConfirmBoxCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnPromptBox, wkeWebView webView, wkePromptBoxCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnNavigation, wkeWebView webView, wkeNavigationCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnCreateView, wkeWebView webView, wkeCreateViewCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnDocumentReady, wkeWebView webView, wkeDocumentReadyCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnDocumentReady2, wkeWebView webView, wkeDocumentReady2Callback callback, void* param, "") \ + ITERATOR3(void, wkeOnLoadingFinish, wkeWebView webView, wkeLoadingFinishCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnDownload, wkeWebView webView, wkeDownloadCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnDownload2, wkeWebView webView, wkeDownload2Callback callback, void* param, "") \ + ITERATOR3(void, wkeOnConsole, wkeWebView webView, wkeConsoleCallback callback, void* param, "") \ + ITERATOR3(void, wkeSetUIThreadCallback, wkeWebView webView, wkeCallUiThread callback, void* param, "") \ + ITERATOR3(void, wkeOnLoadUrlBegin, wkeWebView webView, wkeLoadUrlBeginCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnLoadUrlEnd, wkeWebView webView, wkeLoadUrlEndCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnLoadUrlHeadersReceived, wkeWebView webView, wkeLoadUrlHeadersReceivedCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnLoadUrlFinish, wkeWebView webView, wkeLoadUrlFinishCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnLoadUrlFail, wkeWebView webView, wkeLoadUrlFailCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnDidCreateScriptContext, wkeWebView webView, wkeDidCreateScriptContextCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnWillReleaseScriptContext, wkeWebView webView, wkeWillReleaseScriptContextCallback callback, void* callbackParam, "") \ + ITERATOR3(void, wkeOnWindowClosing, wkeWebView webWindow, wkeWindowClosingCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnWindowDestroy, wkeWebView webWindow, wkeWindowDestroyCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnDraggableRegionsChanged, wkeWebView webView, wkeDraggableRegionsChangedCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnWillMediaLoad, wkeWebView webView, wkeWillMediaLoadCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnStartDragging, wkeWebView webView, wkeStartDraggingCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnPrint, wkeWebView webView, wkeOnPrintCallback callback, void* param, "") \ + ITERATOR4(void, wkeScreenshot, wkeWebView webView, const wkeScreenshotSettings* settings, wkeOnScreenshot callback, void* param, "") \ + \ + ITERATOR3(void, wkeOnOtherLoad, wkeWebView webView, wkeOnOtherLoadCallback callback, void* param, "") \ + ITERATOR3(void, wkeOnContextMenuItemClick, wkeWebView webView, wkeOnContextMenuItemClickCallback callback, void* param, "") \ + \ + ITERATOR1(BOOL, wkeIsProcessingUserGesture, wkeWebView webView, "") \ + \ + ITERATOR2(void, wkeNetSetMIMEType, wkeNetJob jobPtr, const char* type, "璁剧疆response鐨刴ime") \ + ITERATOR2(const char*, wkeNetGetMIMEType, wkeNetJob jobPtr, wkeString mime, "鑾峰彇response鐨刴ime") \ + ITERATOR1(const char*, wkeNetGetReferrer, wkeNetJob jobPtr, "鑾峰彇request鐨剅eferrer") \ + ITERATOR4(void, wkeNetSetHTTPHeaderField, wkeNetJob jobPtr, const wchar_t* key, const wchar_t* value, bool response, "") \ + ITERATOR2(const char*, wkeNetGetHTTPHeaderField, wkeNetJob jobPtr, const char* key, "") \ + ITERATOR2(const char*, wkeNetGetHTTPHeaderFieldFromResponse, wkeNetJob jobPtr, const char* key, "") \ + ITERATOR3(void, wkeNetSetData, wkeNetJob jobPtr, void* buf, int len, "璋冪敤姝ゅ嚱鏁板悗,缃戠粶灞傛敹鍒版暟鎹細瀛樺偍鍦ㄤ竴buf鍐,鎺ユ敹鏁版嵁瀹屾垚鍚庡搷搴擮nLoadUrlEnd浜嬩欢.#姝よ皟鐢ㄤ弗閲嶅奖鍝嶆ц兘,鎱庣敤" \ + "姝ゅ嚱鏁板拰wkeNetSetData鐨勫尯鍒槸锛寃keNetHookRequest浼氬湪鎺ュ彈鍒扮湡姝g綉缁滄暟鎹悗鍐嶈皟鐢ㄥ洖璋冿紝骞跺厑璁稿洖璋冧慨鏀圭綉缁滄暟鎹"\ + "鑰寃keNetSetData鏄湪缃戠粶鏁版嵁杩樻病鍙戦佺殑鏃跺欎慨鏀") \ + ITERATOR1(void, wkeNetHookRequest, wkeNetJob jobPtr, "") \ + ITERATOR3(void, wkeNetOnResponse, wkeWebView webView, wkeNetResponseCallback callback, void* param, "") \ + ITERATOR1(wkeRequestType, wkeNetGetRequestMethod, wkeNetJob jobPtr, "") \ + ITERATOR3(int, wkeNetGetFavicon, wkeWebView webView, wkeOnNetGetFaviconCallback callback, void* param, "") \ + \ + ITERATOR1(void, wkeNetContinueJob, wkeNetJob jobPtr, "")\ + ITERATOR1(const char*, wkeNetGetUrlByJob, wkeNetJob jobPtr, "")\ + ITERATOR1(const wkeSlist*, wkeNetGetRawHttpHead, wkeNetJob jobPtr, "")\ + ITERATOR1(const wkeSlist*, wkeNetGetRawResponseHead, wkeNetJob jobPtr, "")\ + \ + ITERATOR1(void, wkeNetCancelRequest, wkeNetJob jobPtr, "")\ + ITERATOR1(BOOL, wkeNetHoldJobToAsynCommit, wkeNetJob jobPtr, "")\ + ITERATOR2(void, wkeNetChangeRequestUrl, wkeNetJob jobPtr, const char* url, "")\ + \ + ITERATOR3(wkeWebUrlRequestPtr, wkeNetCreateWebUrlRequest, const utf8* url, const utf8* method, const utf8* mime, "")\ + ITERATOR1(wkeWebUrlRequestPtr, wkeNetCreateWebUrlRequest2, const blinkWebURLRequestPtr request, "")\ + ITERATOR2(blinkWebURLRequestPtr, wkeNetCopyWebUrlRequest, wkeNetJob jobPtr, bool needExtraData, "")\ + ITERATOR1(void, wkeNetDeleteBlinkWebURLRequestPtr, blinkWebURLRequestPtr request, "")\ + ITERATOR3(void, wkeNetAddHTTPHeaderFieldToUrlRequest, wkeWebUrlRequestPtr request, const utf8* name, const utf8* value, "")\ + ITERATOR4(int, wkeNetStartUrlRequest, wkeWebView webView, wkeWebUrlRequestPtr request, void* param, const wkeUrlRequestCallbacks* callbacks, "")\ + ITERATOR1(int, wkeNetGetHttpStatusCode, wkeWebUrlResponsePtr response, "")\ + ITERATOR1(__int64, wkeNetGetExpectedContentLength, wkeWebUrlResponsePtr response, "")\ + ITERATOR1(const utf8*, wkeNetGetResponseUrl, wkeWebUrlResponsePtr response, "")\ + ITERATOR1(void, wkeNetCancelWebUrlRequest, int requestId, "")\ + \ + ITERATOR1(wkePostBodyElements*, wkeNetGetPostBody, wkeNetJob jobPtr, "") \ + ITERATOR2(wkePostBodyElements*, wkeNetCreatePostBodyElements, wkeWebView webView, size_t length, "") \ + ITERATOR1(void, wkeNetFreePostBodyElements, wkePostBodyElements* elements, "") \ + ITERATOR1(wkePostBodyElement*, wkeNetCreatePostBodyElement, wkeWebView webView, "") \ + ITERATOR1(void, wkeNetFreePostBodyElement, wkePostBodyElement* element, "") \ + \ + ITERATOR9(wkeDownloadOpt, wkePopupDialogAndDownload, wkeWebView webviewHandle, const wkeDialogOptions* dialogOpt, \ + size_t expectedContentLength, const char* url, const char* mime, const char* disposition, wkeNetJob job,wkeNetJobDataBind* dataBind, wkeDownloadBind* callbackBind, "") \ + ITERATOR10(wkeDownloadOpt, wkeDownloadByPath, wkeWebView webviewHandle, const wkeDialogOptions* dialogOpt, const WCHAR* path, size_t expectedContentLength,const char* url, \ + const char* mime, const char* disposition, wkeNetJob job, wkeNetJobDataBind* dataBind, wkeDownloadBind* callbackBind, "") \ + \ + ITERATOR2(BOOL, wkeIsMainFrame, wkeWebView webView, wkeWebFrameHandle frameId, "") \ + ITERATOR2(BOOL, wkeIsWebRemoteFrame, wkeWebView webView, wkeWebFrameHandle frameId, "") \ + ITERATOR1(wkeWebFrameHandle, wkeWebFrameGetMainFrame, wkeWebView webView, "") \ + ITERATOR4(jsValue, wkeRunJsByFrame, wkeWebView webView, wkeWebFrameHandle frameId, const utf8* script, bool isInClosure, "") \ + ITERATOR3(void, wkeInsertCSSByFrame, wkeWebView webView, wkeWebFrameHandle frameId, const utf8* cssText, "") \ + \ + ITERATOR3(void, wkeWebFrameGetMainWorldScriptContext, wkeWebView webView, wkeWebFrameHandle webFrameId, v8ContextPtr contextOut, "") \ + \ + ITERATOR0(v8Isolate, wkeGetBlinkMainThreadIsolate, "") \ + \ + ITERATOR6(wkeWebView, wkeCreateWebWindow, wkeWindowType type, HWND parent, int x, int y, int width, int height, "") \ + ITERATOR1(wkeWebView, wkeCreateWebCustomWindow, const wkeWindowCreateInfo* info, "") \ + ITERATOR1(void, wkeDestroyWebWindow, wkeWebView webWindow, "") \ + ITERATOR1(HWND, wkeGetWindowHandle, wkeWebView webWindow, "") \ + \ + ITERATOR2(void, wkeShowWindow, wkeWebView webWindow, bool show, "") \ + ITERATOR2(void, wkeEnableWindow, wkeWebView webWindow, bool enable, "") \ + \ + ITERATOR5(void, wkeMoveWindow, wkeWebView webWindow, int x, int y, int width, int height, "") \ + ITERATOR1(void, wkeMoveToCenter, wkeWebView webWindow, "") \ + ITERATOR3(void, wkeResizeWindow, wkeWebView webWindow, int width, int height, "") \ + \ + ITERATOR6(wkeWebDragOperation, wkeDragTargetDragEnter, wkeWebView webView, const wkeWebDragData* webDragData, const POINT* clientPoint, const POINT* screenPoint, wkeWebDragOperationsMask operationsAllowed, int modifiers, "") \ + ITERATOR5(wkeWebDragOperation, wkeDragTargetDragOver, wkeWebView webView, const POINT* clientPoint, const POINT* screenPoint, wkeWebDragOperationsMask operationsAllowed, int modifiers, "") \ + ITERATOR1(void, wkeDragTargetDragLeave, wkeWebView webView, "") \ + ITERATOR4(void, wkeDragTargetDrop, wkeWebView webView, const POINT* clientPoint, const POINT* screenPoint, int modifiers, "") \ + ITERATOR4(void, wkeDragTargetEnd, wkeWebView webView, const POINT* clientPoint, const POINT* screenPoint, wkeWebDragOperation operation, "") \ + \ + ITERATOR1(void, wkeUtilSetUiCallback, wkeUiThreadPostTaskCallback callback, "") \ + ITERATOR1(const utf8*, wkeUtilSerializeToMHTML, wkeWebView webView, "") \ + ITERATOR3(const wkePdfDatas*, wkeUtilPrintToPdf, wkeWebView webView, wkeWebFrameHandle frameId, const wkePrintSettings* settings,"") \ + ITERATOR3(const wkeMemBuf*, wkePrintToBitmap, wkeWebView webView, wkeWebFrameHandle frameId, const wkeScreenshotSettings* settings,"") \ + ITERATOR1(void, wkeUtilRelasePrintPdfDatas, const wkePdfDatas* datas,"") \ + \ + ITERATOR2(void, wkeSetWindowTitle, wkeWebView webWindow, const utf8* title, "") \ + ITERATOR2(void, wkeSetWindowTitleW, wkeWebView webWindow, const wchar_t* title, "") \ + \ + ITERATOR3(void, wkeNodeOnCreateProcess, wkeWebView webView, wkeNodeOnCreateProcessCallback callback, void* param, "") \ + \ + ITERATOR4(void, wkeOnPluginFind, wkeWebView webView, const char* mime, wkeOnPluginFindCallback callback, void* param, "") \ + ITERATOR4(void, wkeAddNpapiPlugin, wkeWebView webView, void* initializeFunc, void* getEntryPointsFunc, void* shutdownFunc, "") \ + \ + ITERATOR4(void, wkePluginListBuilderAddPlugin, void* builder, const utf8* name, const utf8* description, const utf8* fileName, "") \ + ITERATOR3(void, wkePluginListBuilderAddMediaTypeToLastPlugin, void* builder, const utf8* name, const utf8* description, "") \ + ITERATOR2(void, wkePluginListBuilderAddFileExtensionToLastMediaType, void* builder, const utf8* fileExtension, "") \ + \ + ITERATOR1(wkeWebView, wkeGetWebViewByNData, void* ndata, "") \ + \ + ITERATOR5(BOOL, wkeRegisterEmbedderCustomElement, wkeWebView webView, wkeWebFrameHandle frameId, const char* name, void* options, void* outResult, "") \ + \ + ITERATOR3(void, wkeSetMediaPlayerFactory, wkeWebView webView, wkeMediaPlayerFactory factory, wkeOnIsMediaPlayerSupportsMIMEType callback, "") \ + \ + ITERATOR3(const utf8* , wkeGetContentAsMarkup, wkeWebView webView, wkeWebFrameHandle frame, size_t* size, "") \ + \ + ITERATOR1(const utf8*, wkeUtilDecodeURLEscape, const utf8* url, "") \ + ITERATOR1(const utf8*, wkeUtilEncodeURLEscape, const utf8* url, "") \ + ITERATOR1(const utf8*, wkeUtilBase64Encode, const utf8* str, "") \ + ITERATOR1(const utf8*, wkeUtilBase64Decode, const utf8* str, "") \ + ITERATOR1(const wkeMemBuf*, wkeUtilCreateV8Snapshot, const utf8* str, "") \ + \ + ITERATOR0(void, wkeRunMessageLoop, "") \ + \ + ITERATOR1(void, wkeSaveMemoryCache, wkeWebView webView, "") \ + \ + ITERATOR3(void, jsBindFunction, const char* name, jsNativeFunction fn, unsigned int argCount, "") \ + ITERATOR2(void, jsBindGetter, const char* name, jsNativeFunction fn, "") \ + ITERATOR2(void, jsBindSetter, const char* name, jsNativeFunction fn, "") \ + \ + ITERATOR4(void, wkeJsBindFunction, const char* name, wkeJsNativeFunction fn, void* param, unsigned int argCount, "") \ + ITERATOR3(void, wkeJsBindGetter, const char* name, wkeJsNativeFunction fn, void* param, "") \ + ITERATOR3(void, wkeJsBindSetter, const char* name, wkeJsNativeFunction fn, void* param, "") \ + \ + ITERATOR1(int, jsArgCount, jsExecState es, "") \ + ITERATOR2(jsType, jsArgType, jsExecState es, int argIdx, "") \ + ITERATOR2(jsValue, jsArg, jsExecState es, int argIdx, "") \ + \ + ITERATOR1(jsType, jsTypeOf, jsValue v, "") \ + ITERATOR1(BOOL, jsIsNumber, jsValue v, "") \ + ITERATOR1(BOOL, jsIsString, jsValue v, "") \ + ITERATOR1(BOOL, jsIsBoolean, jsValue v, "") \ + ITERATOR1(BOOL, jsIsObject, jsValue v, "") \ + ITERATOR1(BOOL, jsIsFunction, jsValue v, "") \ + ITERATOR1(BOOL, jsIsUndefined, jsValue v, "") \ + ITERATOR1(BOOL, jsIsNull, jsValue v, "") \ + ITERATOR1(BOOL, jsIsArray, jsValue v, "") \ + ITERATOR1(BOOL, jsIsTrue, jsValue v, "") \ + ITERATOR1(BOOL, jsIsFalse, jsValue v, "") \ + \ + ITERATOR2(int, jsToInt, jsExecState es, jsValue v, "") \ + ITERATOR2(float, jsToFloat, jsExecState es, jsValue v, "") \ + ITERATOR2(double, jsToDouble, jsExecState es, jsValue v, "") \ + ITERATOR2(const char*, jsToDoubleString, jsExecState es, jsValue v, "") \ + ITERATOR2(BOOL, jsToBoolean, jsExecState es, jsValue v, "") \ + ITERATOR3(jsValue, jsArrayBuffer, jsExecState es, const char* buffer, size_t size, "") \ + ITERATOR2(wkeMemBuf*, jsGetArrayBuffer, jsExecState es, jsValue value, "") \ + ITERATOR2(const utf8*, jsToTempString, jsExecState es, jsValue v, "") \ + ITERATOR2(const wchar_t*, jsToTempStringW, jsExecState es, jsValue v, "") \ + ITERATOR2(void*, jsToV8Value, jsExecState es, jsValue v, "return v8::Persistent*") \ + \ + ITERATOR1(jsValue, jsInt, int n, "") \ + ITERATOR1(jsValue, jsFloat, float f, "") \ + ITERATOR1(jsValue, jsDouble, double d, "") \ + ITERATOR1(jsValue, jsDoubleString, const char* str, "") \ + ITERATOR1(jsValue, jsBoolean, bool b, "") \ + \ + ITERATOR0(jsValue, jsUndefined, "") \ + ITERATOR0(jsValue, jsNull, "") \ + ITERATOR0(jsValue, jsTrue, "") \ + ITERATOR0(jsValue, jsFalse, "") \ + \ + ITERATOR2(jsValue, jsString, jsExecState es, const utf8* str, "") \ + ITERATOR2(jsValue, jsStringW, jsExecState es, const wchar_t* str, "") \ + ITERATOR1(jsValue, jsEmptyObject, jsExecState es, "") \ + ITERATOR1(jsValue, jsEmptyArray, jsExecState es, "") \ + \ + ITERATOR2(jsValue, jsObject, jsExecState es, jsData* obj, "") \ + ITERATOR2(jsValue, jsFunction, jsExecState es, jsData* obj, "") \ + ITERATOR2(jsData*, jsGetData, jsExecState es, jsValue object, "") \ + \ + ITERATOR3(jsValue, jsGet, jsExecState es, jsValue object, const char* prop, "") \ + ITERATOR4(void, jsSet, jsExecState es, jsValue object, const char* prop, jsValue v, "") \ + \ + ITERATOR3(jsValue, jsGetAt, jsExecState es, jsValue object, int index, "") \ + ITERATOR4(void, jsSetAt, jsExecState es, jsValue object, int index, jsValue v, "") \ + ITERATOR2(jsKeys*, jsGetKeys, jsExecState es, jsValue object, "") \ + ITERATOR2(BOOL, jsIsJsValueValid, jsExecState es, jsValue object, "") \ + ITERATOR1(BOOL, jsIsValidExecState, jsExecState es, "") \ + ITERATOR3(void, jsDeleteObjectProp, jsExecState es, jsValue object, const char* prop, "") \ + \ + ITERATOR2(int, jsGetLength, jsExecState es, jsValue object, "") \ + ITERATOR3(void, jsSetLength, jsExecState es, jsValue object, int length, "") \ + \ + ITERATOR1(jsValue, jsGlobalObject, jsExecState es, "") \ + ITERATOR1(wkeWebView, jsGetWebView, jsExecState es, "") \ + \ + ITERATOR2(jsValue, jsEval, jsExecState es, const utf8* str, "") \ + ITERATOR2(jsValue, jsEvalW, jsExecState es, const wchar_t* str, "") \ + ITERATOR3(jsValue, jsEvalExW, jsExecState es, const wchar_t* str, bool isInClosure, "") \ + \ + ITERATOR5(jsValue, jsCall, jsExecState es, jsValue func, jsValue thisObject, jsValue* args, int argCount, "") \ + ITERATOR4(jsValue, jsCallGlobal, jsExecState es, jsValue func, jsValue* args, int argCount, "") \ + \ + ITERATOR2(jsValue, jsGetGlobal, jsExecState es, const char* prop, "") \ + ITERATOR3(void, jsSetGlobal, jsExecState es, const char* prop, jsValue v, "") \ + \ + ITERATOR0(void, jsGC, "") \ + ITERATOR2(BOOL, jsAddRef, jsExecState es, jsValue val, "") \ + ITERATOR2(BOOL, jsReleaseRef, jsExecState es, jsValue val, "") \ + ITERATOR1(jsExceptionInfo*, jsGetLastErrorIfException, jsExecState es, "") \ + ITERATOR2(jsValue, jsThrowException, jsExecState es, const utf8* exception, "") \ + ITERATOR1(const utf8*, jsGetCallstack, jsExecState es, "") + +#if ENABLE_WKE == 1 + +WKE_EXTERN_C __declspec(dllexport) void WKE_CALL_TYPE wkeInit(); +WKE_EXTERN_C __declspec(dllexport) void WKE_CALL_TYPE wkeInitialize(); +WKE_EXTERN_C __declspec(dllexport) void WKE_CALL_TYPE wkeInitializeEx(const wkeSettings* settings); + +WKE_FOR_EACH_DEFINE_FUNCTION(WKE_DECLARE_ITERATOR0, WKE_DECLARE_ITERATOR1, WKE_DECLARE_ITERATOR2, \ + WKE_DECLARE_ITERATOR3, WKE_DECLARE_ITERATOR4, WKE_DECLARE_ITERATOR5, WKE_DECLARE_ITERATOR6, WKE_DECLARE_ITERATOR9, WKE_DECLARE_ITERATOR10, WKE_DECLARE_ITERATOR11) + +#else + +WKE_FOR_EACH_DEFINE_FUNCTION(WKE_DEFINE_ITERATOR0, WKE_DEFINE_ITERATOR1, WKE_DEFINE_ITERATOR2, \ + WKE_DEFINE_ITERATOR3, WKE_DEFINE_ITERATOR4, WKE_DEFINE_ITERATOR5, WKE_DEFINE_ITERATOR6, WKE_DEFINE_ITERATOR9, WKE_DEFINE_ITERATOR10, WKE_DEFINE_ITERATOR11) + +typedef void (WKE_CALL_TYPE *FN_wkeInitializeEx)(const wkeSettings* settings); + +__declspec(selectany) const wchar_t* s_wkeDllPath = L"node.dll"; +__declspec(selectany) HMODULE s_wkeMainDllHandle = NULL; + +inline void wkeSetWkeDllHandle(const HMODULE mainDllHandle) +{ + s_wkeMainDllHandle = mainDllHandle; +} + +inline void wkeSetWkeDllPath(const wchar_t* dllPath) +{ + s_wkeDllPath = dllPath; +} + +inline int wkeInitializeEx(const wkeSettings* settings) +{ + HMODULE hMod = s_wkeMainDllHandle; + if (!hMod) + hMod = LoadLibraryW(s_wkeDllPath); + if (hMod) { + FN_wkeInitializeEx wkeInitializeExFunc = (FN_wkeInitializeEx)GetProcAddress(hMod, "wkeInitializeEx"); + wkeInitializeExFunc(settings); + + WKE_FOR_EACH_DEFINE_FUNCTION(WKE_GET_PTR_ITERATOR0, WKE_GET_PTR_ITERATOR1, WKE_GET_PTR_ITERATOR2, WKE_GET_PTR_ITERATOR3, \ + WKE_GET_PTR_ITERATOR4, WKE_GET_PTR_ITERATOR5, WKE_GET_PTR_ITERATOR6, WKE_GET_PTR_ITERATOR9, WKE_GET_PTR_ITERATOR10, WKE_GET_PTR_ITERATOR11); + return 1; + } + return 0; +} + +inline int wkeInit() +{ + return wkeInitializeEx(((const wkeSettings*)0)); +} + +inline int wkeInitialize() +{ + return wkeInitializeEx(((const wkeSettings*)0)); +} + +#endif + + + +#endif // WKE_DEFINE_H +