SILICON
Loading...
Searching...
No Matches
graphicalRegister.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <core/register.hpp>
22
23
24namespace SILICON::ui {
25using namespace SILICON::core;
26
28 Q_OBJECT
29private:
30 void setupCallbacks();
31 void updateLayout();
32 void updateLayout(const std::string& inputType, const std::string& outputType);
33 int applySize(int size);
34 std::string applyInputType(const std::string& inputType);
35 std::string applyOutputType(const std::string& outputType);
36
37 [[nodiscard]] Register* getComponentAsRegister() const;
38
39public:
40 explicit GraphicalRegister(QGraphicsItem* parent = nullptr);
41
42 int type() const override { return SiliconTypes::REGISTER; }
43
44 void setComponent(const Component_ptr& component) override;
45};
46
47} // namespace SILICON::ui
GraphicalLogicComponent(ItemCategory category, const Component_ptr &component, QGraphicsItem *shape, QGraphicsItem *parent, bool scanShape=false)
GraphicalRegister(QGraphicsItem *parent=nullptr)
std::string applyOutputType(const std::string &outputType)
std::string applyInputType(const std::string &inputType)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
Register * getComponentAsRegister() const
std::shared_ptr< Component > Component_ptr