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.
 
 
 
 

50 lines
1.7 KiB

#ifndef MULTICOMPONENT_H
#define MULTICOMPONENT_H
#include "Component.h"
#include "../opengl/Window.h"
// we're a control with our own componentTree
// we can relay events down to these components
// can be used for documents, tabs and menus
//
// this component is not scrollable
class MultiComponent : public Component {
public:
//
// Methods
//
MultiComponent(const float rawX, const float rawY, const float rawWidth, const float rawHeight, const int passedWindowWidth, const int passedWindowHeight);
void updateMouse();
void render();
void renderComponents(std::shared_ptr<Component> component);
void renderDocumentComponents(std::shared_ptr<Component> component);
void renderBoxComponents(std::shared_ptr<Component> component);
void renderComponentType(std::string str, std::shared_ptr<Component> component);
void resize(const int passedWindowWidth, const int passedWindowHeight);
std::shared_ptr<Component> searchComponentTree(const std::shared_ptr<Component> &component, const int passedX, const int passedY);
//
// Properties
//
// layers will replace rootComponent
std::vector<std::shared_ptr<Component>> layers; // each layer's root component
std::shared_ptr<Component> rootComponent = std::make_shared<Component>();
// tabbed coordinate system?
bool tabbed = false;
// we'll need a way to pass events down and up
// also how do we handle scroll?
// we'll need searchComponentTree for picking
std::shared_ptr<Component> hoverComponent = nullptr;
std::shared_ptr<Component> focusedComponent = nullptr;
// if the component tree changes, we'll need these to recalculate hoverComponent
double cursorX = 0;
double cursorY = 0;
};
#endif