SILICON
Loading...
Searching...
No Matches
graphicalUtils.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2025. 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 <QGraphicsItem>
21#include <QGraphicsPathItem>
22#include <QPainterPath>
23#include <QPen>
24
27
28
29namespace SILICON::ui {
30using namespace SILICON::core;
31using namespace SILICON::extra;
32
34public:
35 explicit GraphicalWireSplitter(QGraphicsItem* parent = nullptr);
36 int type() const override { return SiliconTypes::WIRE_SPLITTER; }
37
38 int setSize(int newSize);
39 void setComponent(const Component_ptr& component) override;
40
41private:
43
44 unsigned int size = 1;
45};
46
48public:
49 explicit GraphicalWireMerger(QGraphicsItem* parent = nullptr);
50 int type() const override { return SiliconTypes::WIRE_MERGER; }
51
52 int setSize(int newSize);
53 void setComponent(const Component_ptr& component) override;
54
55private:
57
58 unsigned int size = 1;
59};
60
61} // namespace SILICON::ui
GraphicalLogicComponent(ItemCategory category, const Component_ptr &component, QGraphicsItem *shape, QGraphicsItem *parent, bool scanShape=false)
GraphicalWireMerger(QGraphicsItem *parent=nullptr)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
GraphicalWireSplitter(QGraphicsItem *parent=nullptr)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
std::shared_ptr< Component > Component_ptr
@ WIRE_MERGER
Definition enums.hpp:88
@ WIRE_SPLITTER
Definition enums.hpp:87