created htmlelement view

This commit is contained in:
Jorijn van der Graaf 2025-11-10 22:27:02 +01:00
commit 5517a271c7
2 changed files with 84 additions and 64 deletions

View file

@ -18,14 +18,14 @@ License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
export module Crafter.CppDOM:HtmlElement;
export module Crafter.CppDOM:HtmlElementView;
import std;
import :BindingsExport;
import :BindingsImport;
import :EventTypes;
namespace Crafter {
export class HtmlElement {
export class HtmlElementView {
public:
void* const ptr;
std::vector<std::int32_t> clickHandlers;
@ -53,8 +53,8 @@ namespace Crafter {
std::vector<std::int32_t> dragLeaveHandlers;
std::vector<std::int32_t> wheelHandlers;
HtmlElement(const std::string_view id);
HtmlElement(const std::string_view id, const std::string_view html);
HtmlElementView(const std::string_view id);
HtmlElementView(const std::string_view id, const std::string_view html);
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);
@ -135,6 +135,12 @@ namespace Crafter {
std::int32_t AddWheelListener(std::function<void(WheelEvent)> callback);
void RemoveWheelListener(std::int32_t id);
~HtmlElement();
~HtmlElementView();
};
export class HtmlElement : public HtmlElementView {
HtmlElementView(const std::string_view id);
HtmlElementView(const std::string_view id, const std::string_view html);
~HtmlElementView();
}
}