#pragma once
#include "node.h"
#include "node_border.h"
#include "node_text.h"

class NodeButton : public Node
{
    bool m_active = false;
public:
    NodeBorder* m_border;
    NodeText* m_text;
    glm::vec4 color_normal{ .1, .1, .1, 1 };
    glm::vec4 color_hover{ .2, .2, .2, 1 };
    glm::vec4 color_down{ .3, .3, .3, 1 };
    glm::vec4 color_active{ 1, 0, 0, 1 };
    std::function<void(Node* target)> on_click;
    virtual Node* clone_instantiate() const override;
    virtual void clone_children(Node* dest) const override;
    virtual void clone_copy(Node* dest) const override;
    virtual void init() override;
    virtual void create() override;
    virtual void loaded() override;
    virtual void parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr) override;
    void set_active(bool active);
    void set_color(const glm::vec4& c);
    virtual kEventResult handle_event(Event* e) override;
};
