aboutsummaryrefslogtreecommitdiff
path: root/src/events/UrlChangedEvent.hpp
blob: 1685c89603ff0c80fac62dad4504c4f64f69dc9f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once

#include <QtCore>
#include <lua.hpp>

#include "events/Event.hpp"
#include "widgets/BrowserWindow.hpp"
#include "widgets/WebViewStack.hpp"

class UrlChangedEvent : public Event {
public:
  const QString &url;
  const WebViewId webview_id;
  const WindowId win_id;

  UrlChangedEvent(const QString &url, WebViewId webview_id, WindowId win_id)
      : url(url), webview_id(webview_id), win_id(win_id) {
    kind = "UrlChanged";
  }

  void lua_push(lua_State *state) const override {
    lua_newtable(state);
    SET_FIELD("type", string, kind.toStdString().c_str())
    SET_FIELD("view_id", integer, webview_id)
    SET_FIELD("win_id", integer, win_id)
    SET_FIELD("url", string, url.toStdString().c_str())
  }
};