MostlyHarmless 0.0.1
Loading...
Searching...
No Matches
mostlyharmless_WebviewEditor.h
Go to the documentation of this file.
1//
2// Created by Syl Morrison on 11/08/2024.
3//
4
5#ifndef MOSTLYHARMLESS_MOSTLYHARMLESS_WEBVIEWEDITOR_H
6#define MOSTLYHARMLESS_MOSTLYHARMLESS_WEBVIEWEDITOR_H
9#include <marvin/library/marvin_Concepts.h>
10#include <choc/gui/choc_WebView.h>
11#include <nlohmann/json.hpp>
12#include <optional>
13#include <string>
14#include <memory>
15namespace mostly_harmless::gui {
16
105 class WebviewEditor : public WebviewBase {
106 public:
112 WebviewEditor(core::ISharedState* sharedState, std::uint32_t initialWidth, std::uint32_t initialHeight, Colour backgroundColour);
113
117 ~WebviewEditor() noexcept override = default;
118
119 void initialise() override;
120
124 [[nodiscard]] bool allowResize() const noexcept override;
125
129 void onResizeRequested(std::uint32_t* newWidth, std::uint32_t* newHeight) override;
130
138 void onParamEvent(events::ProcToGuiParamEvent event) override;
139
145 virtual void sendEvent(events::WebEvent&& event) noexcept;
146
147
148 protected:
155 virtual choc::value::Value beginParamChangeGestureCallback(const choc::value::ValueView& args);
156
163 virtual choc::value::Value paramChangeGestureCallback(const choc::value::ValueView& args);
164
171 virtual choc::value::Value endParamChangeGestureCallback(const choc::value::ValueView& args);
172
173 core::ISharedState* m_sharedState{ nullptr };
174
175 struct {
176 std::optional<std::pair<std::uint32_t, std::uint32_t>> lastMouseDownLocation{};
177 std::optional<std::pair<std::uint32_t, std::uint32_t>> lastMousePosition{};
179 };
180} // namespace mostly_harmless::gui
181#endif // MOSTLYHARMLESS_MOSTLYHARMLESS_WEBVIEWEDITOR_H
Base class for the plugin's shared state.
Definition mostlyharmless_ISharedState.h:26
WebviewBase(std::uint32_t initialWidth, std::uint32_t initialHeight, Colour backgroundColour)
struct mostly_harmless::gui::WebviewEditor::@071165062164147117155162242151017320357037170145 m_cursorState
virtual choc::value::Value endParamChangeGestureCallback(const choc::value::ValueView &args)
~WebviewEditor() noexcept override=default
virtual choc::value::Value beginParamChangeGestureCallback(const choc::value::ValueView &args)
virtual void sendEvent(events::WebEvent &&event) noexcept
std::optional< std::pair< std::uint32_t, std::uint32_t > > lastMouseDownLocation
Definition mostlyharmless_WebviewEditor.h:176
bool allowResize() const noexcept override
core::ISharedState * m_sharedState
Definition mostlyharmless_WebviewEditor.h:173
virtual choc::value::Value paramChangeGestureCallback(const choc::value::ValueView &args)
void onParamEvent(events::ProcToGuiParamEvent event) override
void onResizeRequested(std::uint32_t *newWidth, std::uint32_t *newHeight) override
WebviewEditor(core::ISharedState *sharedState, std::uint32_t initialWidth, std::uint32_t initialHeight, Colour backgroundColour)
std::optional< std::pair< std::uint32_t, std::uint32_t > > lastMousePosition
Definition mostlyharmless_WebviewEditor.h:177
Contains core functionality of the framework.
Definition mostlyharmless_PluginBase.h:16
Contains classes and functions related to events.
Definition mostlyharmless_InputEventContext.h:4
Contains GUI related classes & functions.
Definition mostlyharmless_WebviewBase.h:10
Convenience struct representing a colour.
Definition mostlyharmless_Colour.h:12