|
|
|
#ifndef ELEMENT_H
|
|
|
|
#define ELEMENT_H
|
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <memory>
|
|
|
|
#include "../components/Component.h"
|
|
|
|
#include "../opengl/Window.h"
|
|
|
|
#include "../../html/Node.h"
|
|
|
|
|
|
|
|
class ElementRenderRequest {
|
|
|
|
public:
|
|
|
|
// we read the attributes from node (color, size, positioning, font info)
|
|
|
|
// and pass them to a newly made component
|
|
|
|
// and then we set up behaviors for that new component
|
|
|
|
std::shared_ptr<Node> node;
|
|
|
|
|
|
|
|
// has really no purpose except to pass win
|
|
|
|
// it was supposed to be for positions, but ComponentBuilder handles all that now
|
|
|
|
// as an element we shouldn't really care too much about position
|
|
|
|
// if we set up the component right, it'll handle all that
|
|
|
|
std::shared_ptr<Component> parentComponent;
|
|
|
|
// can get this from parentComponent
|
|
|
|
//std::shared_ptr<Window> win;
|
|
|
|
DocumentComponent *docComponent = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
// we define tokens in a language
|
|
|
|
// and convert them into a component (UI element)
|
|
|
|
class Element {
|
|
|
|
public:
|
|
|
|
bool isInline = false;
|
|
|
|
virtual ~Element();
|
|
|
|
virtual std::unique_ptr<Component> renderer(const ElementRenderRequest &request);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|