Skip to content
Snippets Groups Projects
DocumentComponent.h 1.12 KiB
Newer Older
Odilitime's avatar
Odilitime committed
#ifndef DOCUMENTCOMPONENT_H
#define DOCUMENTCOMPONENT_H

#include <GL/glew.h>
#include "Component.h"
#include "ComponentBuilder.h"
#include "../opengl/Window.h"
#include "../../html/Node.h"
#include "../../URL.h"
#include "../../networking/HTTPResponse.h"

#include "MultiComponent.h"

class DocumentComponent : public MultiComponent {
Odilitime's avatar
Odilitime committed
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);
Odilitime's avatar
Odilitime committed
    std::shared_ptr<Node> domRootNode = nullptr;
    ComponentBuilder componentBuilder;
    URL currentURL;
    bool domDirty = false;
    int scrollY = 0;
    int scrollHeight = 0;
};

Odilitime's avatar
Odilitime committed
//bool setWindowContent(URL const& url);
//void handleRequest(const HTTPResponse &response);
Odilitime's avatar
Odilitime committed


#endif