SILICON
Toggle main menu visibility
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
25
#include <
extraComponents/utils.hpp
>
26
#include <
ui/circuit/components/graphicalLogicComponent.hpp
>
27
28
29
namespace
SILICON::ui
{
30
using namespace
SILICON::core;
31
using namespace
SILICON::extra;
32
33
class
GraphicalWireSplitter
:
public
GraphicalLogicComponent
{
34
public
:
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
41
private
:
42
void
installSizeCallback
();
43
44
unsigned
int
size
= 1;
45
};
46
47
class
GraphicalWireMerger
:
public
GraphicalLogicComponent
{
48
public
:
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
55
private
:
56
void
installSizeCallback
();
57
58
unsigned
int
size
= 1;
59
};
60
61
}
// namespace SILICON::ui
SILICON::ui::GraphicalLogicComponent::GraphicalLogicComponent
GraphicalLogicComponent(ItemCategory category, const Component_ptr &component, QGraphicsItem *shape, QGraphicsItem *parent, bool scanShape=false)
Definition
graphicalLogicComponent.cpp:26
SILICON::ui::GraphicalWireMerger::installSizeCallback
void installSizeCallback()
Definition
graphicalUtils.cpp:99
SILICON::ui::GraphicalWireMerger::type
int type() const override
Definition
graphicalUtils.hpp:50
SILICON::ui::GraphicalWireMerger::setSize
int setSize(int newSize)
Definition
graphicalUtils.cpp:122
SILICON::ui::GraphicalWireMerger::GraphicalWireMerger
GraphicalWireMerger(QGraphicsItem *parent=nullptr)
Definition
graphicalUtils.cpp:91
SILICON::ui::GraphicalWireMerger::setComponent
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
Definition
graphicalUtils.cpp:115
SILICON::ui::GraphicalWireMerger::size
unsigned int size
Definition
graphicalUtils.hpp:58
SILICON::ui::GraphicalWireSplitter::installSizeCallback
void installSizeCallback()
Definition
graphicalUtils.cpp:32
SILICON::ui::GraphicalWireSplitter::type
int type() const override
Definition
graphicalUtils.hpp:36
SILICON::ui::GraphicalWireSplitter::setSize
int setSize(int newSize)
Definition
graphicalUtils.cpp:55
SILICON::ui::GraphicalWireSplitter::GraphicalWireSplitter
GraphicalWireSplitter(QGraphicsItem *parent=nullptr)
Definition
graphicalUtils.cpp:24
SILICON::ui::GraphicalWireSplitter::setComponent
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
Definition
graphicalUtils.cpp:48
SILICON::ui::GraphicalWireSplitter::size
unsigned int size
Definition
graphicalUtils.hpp:44
utils.hpp
graphicalLogicComponent.hpp
SILICON::core::Component_ptr
std::shared_ptr< Component > Component_ptr
Definition
component_registry.hpp:33
SILICON::ui
Definition
actionGroups.hpp:14
SILICON::ui::WIRE_MERGER
@ WIRE_MERGER
Definition
enums.hpp:88
SILICON::ui::WIRE_SPLITTER
@ WIRE_SPLITTER
Definition
enums.hpp:87
src
ui
circuit
components
graphicalUtils.hpp
Generated by
1.17.0