mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
60d329a186
This implements a dialog that can be used to evaluate a JS expression in the HackStudio's Debugger context. It also implements simple C++ Variable <-> JS Value conversion, allowing for JS expressions to read/write variables in the debugger scope. Currently, C++ structs are mapped to JS objects by way of a JS proxy, however this leads to issues when printing, so this will be changed in a later commit.
33 lines
812 B
C++
33 lines
812 B
C++
/*
|
|
* Copyright (c) 2021, Hunter Salyer <thefalsehonesty@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibGUI/Dialog.h>
|
|
#include <LibWeb/InProcessWebView.h>
|
|
|
|
namespace HackStudio {
|
|
|
|
class EvaluateExpressionDialog : public GUI::Dialog {
|
|
C_OBJECT(EvaluateExpressionDialog);
|
|
|
|
public:
|
|
explicit EvaluateExpressionDialog(Window* parent_window);
|
|
|
|
private:
|
|
void build(Window* parent_window);
|
|
void handle_evaluation(const String& expression);
|
|
void set_output(const StringView& html);
|
|
|
|
NonnullOwnPtr<JS::Interpreter> m_interpreter;
|
|
RefPtr<GUI::TextBox> m_text_editor;
|
|
RefPtr<Web::InProcessWebView> m_output_view;
|
|
RefPtr<Web::DOM::Element> m_output_container;
|
|
RefPtr<GUI::Button> m_evaluate_button;
|
|
RefPtr<GUI::Button> m_close_button;
|
|
};
|
|
|
|
}
|