You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

40 lines
1.3 KiB

#ifndef DOCUMENTCOMPONENT_H
#define DOCUMENTCOMPONENT_H
#include <GL/glew.h>
#include "Component.h"
#include "MultiComponent.h"
#include "ComponentBuilder.h"
#include "../../html/Node.h"
#include "../../URL.h"
#include "../../networking/HTTPResponse.h"
// document is scrollable until multicomponent
class DocumentComponent : public MultiComponent {
public:
DocumentComponent(const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight);
void render();
void createComponentTree(const std::shared_ptr<Node> node, const std::shared_ptr<Component> &parentComponent);
std::shared_ptr<Component> searchComponentTree(const std::shared_ptr<Component> &component, const int x, const int y);
void navTo(const std::string url);
void setDOM(const std::shared_ptr<Node> rootNode);
std::shared_ptr<Node> domRootNode = nullptr;
ComponentBuilder componentBuilder;
URL currentURL;
bool domDirty = false;
//
int scrollY = 0;
int scrollHeight = 0;
float transformMatrix[16] = {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1
};
bool transformMatrixDirty = true;
std::function<void(std::string url)> onBeforeLoad = nullptr;
};
#endif