This commit is contained in:
2026-03-03 16:10:38 +01:00
parent 35aae3b707
commit 5f0b7d3dc8
16 changed files with 766 additions and 334 deletions

View File

@@ -3,6 +3,7 @@
#include "rktwebview_qt_global.h"
#include "rktwebview_internal.h"
#include "rktutils.h"
#include <QApplication>
#include <QWebEngineView>
@@ -24,18 +25,23 @@ private:
QApplication *_app;
rktwebview_t _current_handle;
QHash<int, WebviewWindow *> _views;
QHash<int, void(*)(const char *msg)> _view_js_callbacks;
QHash<int, event_cb_t> _view_js_callbacks;
QQueue<Command *> _command_queue;
QTimer _process_commands;
QTimer _process_events;
Rktwebview_qt **_handler;
int _argc;
char *_argv[1];
private:
void runJs(rktwebview_t wv, const char *js);
public slots:
void processCommands();
void processJsEventQueues();
public:
void removeView(int id);
@@ -43,23 +49,26 @@ public:
public:
int nextHandle();
public:
int rktWebViewCreate(int parent, void(*js_evt_cb)(const char *msg));
int rktWebViewCreate(int parent, event_cb_t js_evt_cb);
void rktWebViewClose(int wv);
void rktQuit();
void runJs(rktwebview_t wv, const char *js);
item_t callJs(rktwebview_t wv, const char *js);
void setHtml(rktwebview_t wv, const char *html);
void navigate(rktwebview_t wv, const char *url);
result_t rktOpenDevtools(rktwebview_t wv);
result_t rktSetUrl(rktwebview_t wv, const char *url);
result_t rktSetHtml(rktwebview_t wv, const char *html);
result_t rktRunJs(rktwebview_t wv, const char *js);
result_t rktMove(rktwebview_t wv, int x, int y);
result_t rktResize(rktwebview_t wv, int w, int h);
bool rktValid(rktwebview_t wv);
public:
// Events for the backend
void pageLoaded(rktwebview_t w, bool ok);
void onPageLoad(rktwebview_t w);
public:
void triggerEvent(rktwebview_t wv, const QString &msg);
void triggerEvent(rktwebview_t wv, const EventContainer &e);
public:
void doEvents();