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

class NodeCheckBox : public Node
{
public:
    std::function<void(Node* target, bool checked)> on_value_changed;
    NodeBorder* m_outer;
    NodeBorder* m_inner;
    NodeImage* m_icon;
    std::string m_icon_path = "data/ui/check-v.png";
    bool checked = false;
    virtual Node* clone_instantiate() const override;
    virtual void clone_children(Node* dest) const override;
    virtual void init() override;
    virtual void create() override;
    virtual kEventResult handle_event(Event* e) override;
    virtual void draw() override;
    virtual void parse_attributes(kAttribute ka, const tinyxml2::XMLAttribute* attr) override;
    void set_icon(const std::string& icon_path);
    void set_value(bool checked, bool trigger_event = false);
    void update_icon();
};
