#pragma once
#include "node_border.h"

class NodeRemotePage : public NodeBorder
{
    class NodeScroll* m_content;
    class NodeText* m_title;
    bool m_loading;
    std::string m_url;
public:
    bool m_loaded;
    int m_page_id;
    virtual Node* clone_instantiate() const override;
    virtual void clone_copy(Node* dest) const override;
    virtual void init() override;
    void init_controls();
    std::future<bool> load_url(const std::string& url, 
        std::function<void(bool success)> on_complete = nullptr) noexcept;
    void reload() noexcept;
    void set_title(const std::string& title);
    void add_button(const std::string& label, int width,
        std::function<void(Node* target)> onclic = nullptr) noexcept;
};
