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

class NodePanelFloating : public NodeBorder
{
    enum class kDragAction : uint8_t { Move, Resize, Reheight } m_action;
    bool m_dragging = false;
    glm::vec2 m_extended_size;
    glm::vec2 m_drag_start_pos;
    glm::vec2 m_drag_start_cur;
    NodeButton* m_button_minimize;
    NodeButton* m_button_close;
    NodeBorder* m_outline;
    std::shared_ptr<NodeBorder> m_drop_placeholder;
public:
    using this_class = NodePanelFloating;
    using parent = NodeBorder;
    enum class kClass : uint8_t { Presets, Color, ColorAdv, Layers, Brush, Grids, Animation, Generic } m_class = kClass::Generic;

    Node* m_container;
    NodeText* m_title;
    std::weak_ptr<Node> m_dock;
    bool m_droppable = true;

    virtual Node* clone_instantiate() const override;
    virtual void clone_finalize(Node* dest) const override;
    virtual kEventResult handle_event(Event* e) override;
    virtual void handle_parent_resize(glm::vec2 old_size, glm::vec2 new_size) override;
    virtual void init() override;
    void init_controls();
};
