website example
This commit is contained in:
parent
c6c62e5852
commit
c4f764e4ce
6 changed files with 198 additions and 182 deletions
|
|
@ -30,6 +30,7 @@ export namespace Crafter::CppDOMBindings {
|
|||
}
|
||||
__attribute__((import_module("env"), import_name("setInnerHTML"))) void SetInnerHTML(void* ptr, const char* html, std::int32_t htmlLenght);
|
||||
void SetInnerHTML(void* ptr, const std::string_view html) {
|
||||
std::cout << "bind" << std::endl;
|
||||
SetInnerHTML(ptr, html.data(), html.size());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import :EventTypes;
|
|||
namespace Crafter {
|
||||
export class HtmlElementView {
|
||||
public:
|
||||
void* const ptr;
|
||||
void* ptr;
|
||||
std::vector<std::int32_t> clickHandlers;
|
||||
std::vector<std::int32_t> mouseOverHandlers;
|
||||
std::vector<std::int32_t> mouseOutHandlers;
|
||||
|
|
@ -55,6 +55,10 @@ namespace Crafter {
|
|||
|
||||
HtmlElementView(const std::string_view id);
|
||||
HtmlElementView(const std::string_view id, const std::string_view html);
|
||||
HtmlElementView(HtmlElementView&&);
|
||||
HtmlElementView(const HtmlElementView&) = delete;
|
||||
HtmlElementView& operator=(const HtmlElementView&) = delete;
|
||||
~HtmlElementView();
|
||||
void SetInnerHTML(const std::string_view html);
|
||||
void SetStyle(const std::string_view style);
|
||||
void SetProperty(const std::string_view property, const std::string_view value);
|
||||
|
|
@ -138,14 +142,15 @@ namespace Crafter {
|
|||
|
||||
std::int32_t AddWheelListener(std::function<void(WheelEvent)> callback);
|
||||
void RemoveWheelListener(std::int32_t id);
|
||||
|
||||
~HtmlElementView();
|
||||
};
|
||||
|
||||
export class HtmlElement : public HtmlElementView {
|
||||
public:
|
||||
HtmlElement(const std::string_view id);
|
||||
HtmlElement(const std::string_view id, const std::string_view html);
|
||||
HtmlElement(HtmlElement&&);
|
||||
HtmlElement(const HtmlElement&) = delete;
|
||||
HtmlElement& operator=(const HtmlElement&) = delete;
|
||||
~HtmlElement();
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue