#include "pch.h"
#include "log.h"
#include "node_progress_bar.h"
#include "layout.h"

Node* NodeProgressBar::clone_instantiate() const
{
    return new NodeProgressBar();
}

void NodeProgressBar::init()
{
    auto tpl = static_cast<const NodeBorder*>(init_template("progress-bar"));
    m_color = tpl->m_color;
    m_border_color = tpl->m_border_color;
    m_thinkness = tpl->m_thinkness;

    m_title = find<NodeText>("title");
    btn_cancel = find<NodeButton>("btn-cancel");
    btn_cancel->on_click = [&](Node*) { destroy(); };
    m_progress = find<NodeBorder>("progress");
    
    m_progress->SetWidthP(10);
}
