split app.cpp into multiple files, add NodeScroll and use it to scroll the side panels, some fixes to the events system

This commit is contained in:
2017-05-14 21:48:25 +01:00
parent 366f233aa0
commit 577a4e4db7
16 changed files with 1028 additions and 838 deletions

View File

@@ -67,6 +67,7 @@ enum class kWidget : uint16_t
ColorQuad = const_hash("color-quad"),
StrokePreview = const_hash("stroke-preview"),
Canvas = const_hash("canvas"),
Scroll = const_hash("scroll"),
};
class Node
@@ -88,12 +89,16 @@ public:
glm::mat4 m_mvp;
bool m_mouse_inside = false;
bool m_flood_events = false;
bool m_capture_children = true; // wether to capture children events when xx_capture() is used
bool m_destroyed = false;
bool m_mouse_ignore = true;
float m_zoom = 1.f;
glm::vec2 m_scale{ 1.f };
glm::vec2 m_pos;
glm::vec2 m_pos_origin; // original layout position without offset
glm::vec2 m_pos_offset; // artificial position offset for scrolling
glm::vec2 m_pos_offset_childred; // artificial position offset for scrolling
glm::vec2 m_size;
glm::vec4 m_clip;
glm::vec4 m_clip_uncut;
@@ -114,6 +119,7 @@ public:
void SetSize(float w, float h);
void SetPadding(float t, float r, float b, float l);
glm::vec4 GetPadding() const;
void SetPosition(float l, float t, float r, float b);
void SetPosition(float l, float t);
void SetPosition(const glm::vec2 pos);
@@ -132,7 +138,8 @@ public:
float GetHeight();
glm::vec2 GetSize();
glm::vec4 rect_intersection(glm::vec4 a, glm::vec4 b);
glm::vec4 rect_intersection(glm::vec4 a, glm::vec4 b) const;
glm::vec4 rect_union(glm::vec4 a, glm::vec4 b) const;
virtual void restore_context();;
virtual void clear_context();
@@ -177,6 +184,7 @@ public:
void move_child(Node* n, int index);
void move_child_offset(Node* n, int offset);
int get_child_index(Node* n);
glm::vec4 get_children_rect() const;
void mouse_capture();
void mouse_release();
void key_capture();