1#ifndef BUSINESS_LOGIC_LOGIC_BLOCKS_MANAGER_H
2#define BUSINESS_LOGIC_LOGIC_BLOCKS_MANAGER_H
6#include <magic_enum/magic_enum.hpp>
9#include <unordered_set>
128 const
business_logic::elements::structures::BlocksConnectionSide& source,
129 const
business_logic::elements::structures::BlocksConnectionSide& dest) override;
135 const
business_logic::elements::structures::BlocksConnectionSide& source,
136 const
business_logic::elements::structures::BlocksConnectionSide& dest) const override;
142 const
business_logic::elements::structures::BlocksConnectionSide& side) const override;
166 const
std::unordered_map<
Manages the blocks in the GUI, both their rendering and interaction.
bool hasActiveChoicesInput() const
Checks if the input callback is active.
std::unordered_map< business_logic::elements::structures::BlocksConnectionSide, std::unordered_set< business_logic::elements::structures::BlocksConnectionSide > > connectionsRegistry
~BlocksManager() noexcept override=default
void handleMouseUp()
Handles the mouse up event.
bool hasConnectionBetween(const business_logic::elements::structures::BlocksConnectionSide &source, const business_logic::elements::structures::BlocksConnectionSide &dest) const override
Checks if there is a connection between two entities.
void clearActiveChoicesInput()
Clears the active input choices and the corresponding generated UI texts rows.
void handleNumericKeyPress(int number)
Handles the numeric key press event.
void setActiveChoicesInput(business_logic::input::InputChoiceInteraction< business_logic::elements::blocks::BlockType > &&inputChoiceInteraction)
Sets the input callback; this will override rendering other entities.
void onNewBlockChoice(const business_logic::elements::blocks::BlockType &blockType) override
Called when a new block is chosen to be added to the canvas.
business_logic::geometry::Size2D dragOffset
std::optional< std::unordered_set< business_logic::elements::structures::BlocksConnectionSide > > maybeGraphCycle
std::chrono::steady_clock::time_point doubleClickCtLastMouseClickTime
void onPortsConnected(const business_logic::elements::structures::BlocksConnectionSide &source, const business_logic::elements::structures::BlocksConnectionSide &dest) override
Invoked when a connection is made between two ports + blocks (sides)
std::optional< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > getBlockAtMousePos()
Gets the block at the mouse position.
void handleRightClickOnBlock(const std::shared_ptr< business_logic::elements::blocks::BaseBlock > &block)
Handles right click event on a block.
business_logic::delegate::IWindowDelegate * windowDelegate
void handleEscapeKeyPress()
Handles the ESC key press event.
const std::vector< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > & getBlocks() const override
Gets the blocks.
const std::unordered_map< business_logic::elements::structures::BlocksConnectionSide, std::unordered_set< business_logic::elements::structures::BlocksConnectionSide > > & getConnectionsRegistry() const override
Gets the connections registry.
business_logic::input::ConnectPortsInteraction connectPortsInteraction
bool isInputConnected(const business_logic::elements::structures::BlocksConnectionSide &side) const override
Checks if the input port is connected to anything.
void handleMouseDown()
Handles the mouse down event.
std::optional< business_logic::input::InputChoiceInteraction< business_logic::elements::blocks::BlockType > > inputChoiceInteraction
void handleMouseMove(int x, int y)
Handles the mouse move event.
business_logic::elements::blocks::BaseBlock * draggedBlock
void onBlockDeleted(const business_logic::elements::blocks::BaseBlock *block) override
Called when a block is deleted.
std::vector< components::UITextsRow > inputChoicesUiTextsRows
std::vector< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > blocks
std::optional< std::shared_ptr< business_logic::elements::blocks::BaseBlock > > getBlockAt(int x, int y)
Gets the block at the given coordinates.
Class that provides a logger for the given class; automatically deduces the logger.
std::shared_ptr< spdlog::logger > logger
The blocks calculator logic, computes the flowing values.
The delegate for the blocks registry, allowing to get connections and blocks.
Delegate that manages the lifecycles of blocks.
Delegate that is notified when a new block is chosen to be added to the canvas.
The delegate for the window.
UI primitives and components to be rendered as part of the UI.
The business logic module.