add panels docking
This commit is contained in:
20
src/node.h
20
src/node.h
@@ -126,7 +126,9 @@ public:
|
||||
glm::vec2 m_pos_offset{ 0, 0 }; // artificial position offset for scrolling
|
||||
glm::vec2 m_pos_offset_childred{ 0, 0 }; // artificial position offset for scrolling
|
||||
glm::vec2 m_size{ 0, 0 };
|
||||
// rect: {origin}{size}
|
||||
glm::vec4 m_clip{ 0, 0, 0, 0 };
|
||||
// rect: {origin}{size}
|
||||
glm::vec4 m_clip_uncut{ 0, 0, 0, 0 };
|
||||
std::string m_name;
|
||||
bool m_display = true;
|
||||
@@ -148,6 +150,10 @@ public:
|
||||
void SetMaxWidthP(float value);
|
||||
void SetMaxHeight(float value);
|
||||
void SetMaxHeightP(float value);
|
||||
void SetMinWidth(float value);
|
||||
void SetMinWidthP(float value);
|
||||
void SetMinHeight(float value);
|
||||
void SetMinHeightP(float value);
|
||||
|
||||
void SetPadding(float t, float r, float b, float l);
|
||||
glm::vec4 GetPadding() const;
|
||||
@@ -229,11 +235,23 @@ public:
|
||||
add_child(n);
|
||||
return n;
|
||||
}
|
||||
template<class T> std::shared_ptr<T> add_child_ref()
|
||||
{
|
||||
auto n = std::make_shared<T>();
|
||||
n->m_manager = m_manager;
|
||||
n->m_parent = m_parent;
|
||||
n->init();
|
||||
n->create();
|
||||
n->loaded();
|
||||
add_child(n);
|
||||
return n;
|
||||
}
|
||||
|
||||
virtual void on_tick(float dt) { };
|
||||
virtual kEventResult on_event(Event* e);
|
||||
virtual kEventResult handle_event(Event* e);
|
||||
virtual void handle_resize(glm::vec2 old_size, glm::vec2 new_size);
|
||||
virtual void handle_parent_resize(glm::vec2 old_size, glm::vec2 new_size);
|
||||
virtual void create();
|
||||
virtual void init();
|
||||
virtual void loaded();
|
||||
@@ -254,11 +272,13 @@ public:
|
||||
void remove_child(Node* n);
|
||||
void remove_all_children();
|
||||
void move_child(Node* n, int index);
|
||||
void move_child_front(Node* n);
|
||||
void move_child_offset(Node* n, int offset);
|
||||
int get_child_index(Node* n);
|
||||
Node* get_child_at(int index);
|
||||
// returns {origin, size} form
|
||||
glm::vec4 get_children_rect() const;
|
||||
std::vector<std::shared_ptr<Node>> get_children_at_point(glm::vec2 point) const;
|
||||
bool is_child_recursive(Node* o) const;
|
||||
bool is_child(Node* o) const;
|
||||
void mouse_capture();
|
||||
|
||||
Reference in New Issue
Block a user