aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/BrowserWindow.hpp
diff options
context:
space:
mode:
authorAkshay Nair <phenax5@gmail.com>2025-07-25 23:17:02 +0530
committerAkshay Nair <phenax5@gmail.com>2025-07-25 23:17:02 +0530
commit031b22e0bb0f1d132731aea3776917731a8ab4ce (patch)
tree1c3775d5aba426669a0ea0b8821a7b4b0808aab0 /src/widgets/BrowserWindow.hpp
parent81dcf7de91c1866d565f7aa9eb38f7fbd1cd7ad7 (diff)
downloadnull-browser-031b22e0bb0f1d132731aea3776917731a8ab4ce.tar.gz
null-browser-031b22e0bb0f1d132731aea3776917731a8ab4ce.zip
Add decorations.*.view lua api + support decoration views for open url
Diffstat (limited to '')
-rw-r--r--src/widgets/BrowserWindow.hpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/widgets/BrowserWindow.hpp b/src/widgets/BrowserWindow.hpp
index 2927683..207524a 100644
--- a/src/widgets/BrowserWindow.hpp
+++ b/src/widgets/BrowserWindow.hpp
@@ -18,12 +18,12 @@ public:
DEFINE_GETTER(get_id, win_id)
DEFINE_SETTER(set_id, win_id)
- DELEGATE(webview_stack, has_webview, has_webview)
+ // DELEGATE(webview_stack, has_webview, has_webview)
DELEGATE(webview_stack, current_webview_id, current_webview_id)
DELEGATE(webview_stack, get_webview_list, get_webview_list)
DELEGATE(webview_stack, set_search_text, set_search_text)
DELEGATE(webview_stack, open_devtools, open_devtools)
- DELEGATE(webview_stack, open_url, open_url)
+ // DELEGATE(webview_stack, open_url, open_url)
DELEGATE(webview_stack, webview_history_back, history_back)
DELEGATE(webview_stack, webview_history_forward, history_forward)
DELEGATE(webview_stack, close, close_webview)
@@ -33,6 +33,18 @@ public:
DELEGATE(webview_stack, scroll_to_bottom, scroll_to_bottom)
DELEGATE(decorations, set_enabled, set_decoration_enabled)
DELEGATE(decorations, get_enabled, get_decoration_enabled)
+ DELEGATE(decorations, get_view_id, get_decoration_view_id)
+
+ bool has_webview(WebViewId webview_id) {
+ return webview_stack->has_webview(webview_id) || decorations->has_webview(webview_id);
+ }
+
+ void open_url(const QUrl &url, OpenType open_type, WebViewId webview_id) {
+ if (decorations->has_webview(webview_id))
+ decorations->open_url(url, webview_id);
+ else
+ webview_stack->open_url(url, open_type, webview_id);
+ }
bool on_window_key_event(QKeyEvent *event);