/***
* Inferno Engine v4 2015-2017
* Written by Tomasz "Rex Dex" Jonarski
*
* [# filter: graph #]
*
***/

#pragma once

#include "ui/toolkit/include/uiButton.h"

#include "base/graph/include/graphBlockLayoutBuilder.h"

namespace ui
{
    namespace graph
    {

        /// socket int the graph
        class UI_GRAPH_API GraphEditorSocket : public IElement
        {
            RTTI_DECLARE_VIRTUAL_CLASS(GraphEditorSocket, IElement);

        public:
            GraphEditorSocket(GraphEditor* editor, const base::edit::DocumentObjectID& node, const base::StringID& socketName);
            virtual ~GraphEditorSocket();

            // get the bind point for this socket so a connection can be drawn
            GraphBindPointPtr getBindPoint() const;

            // get the bind point positon
            const InvariantPosition getBindPointPosition(const GraphEditor& editor) const;

            //-

            // get the graph editor we are in
            FORCEINLINE GraphEditor* getEditor() const { return m_editor; }

            // get captured socket informations
            FORCEINLINE const base::graph::BlockLayoutSocketInfo& getSetup() const { return m_setup; }

            // get the socket name
            FORCEINLINE const base::StringID& getSocketName() const { return m_socketName; }

            // get the block document object
            FORCEINLINE const base::edit::DocumentObjectID& getNode() const { return m_node; }

        private:
            base::SharedPtr<StaticContent> m_button;
            base::SharedPtr<StaticContent> m_caption;

            base::edit::DocumentObjectID m_node;
            base::StringID m_socketName;

            base::graph::BlockLayoutSocketInfo m_setup;
            base::graph::GraphDocumentHandler* m_graph;

            GraphEditor* m_editor;
        };

    } // graph
} // ui
