3
Copyright (C) 1999 Stefan Westerfeld
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
#ifndef __SCOMPONENT_H__
23
#define __SCOMPONENT_H__
25
#include <qscrollview.h>
32
class StructureCanvas {
34
virtual void redrawRect(int x, int y, int width, int height) = 0;
37
class StructureComponent {
39
StructureCanvas *canvas;
42
StructureComponent(StructureCanvas *canvas);
43
virtual ~StructureComponent();
47
enum ComponentType { ctModule, ctPort };
48
virtual ComponentType type() = 0;
50
// TODO: connection & autorouter
52
virtual ModulePort *portAt(int segment, int x, int y) = 0;
53
virtual void dumpPorts(std::list<ModulePort *>& ports) = 0;
56
virtual void hide() = 0;
57
virtual void show() = 0;
58
virtual bool visible() = 0;
61
virtual bool drawNeedsBackground(int segment) = 0;
62
virtual void drawSegment(QPainter *dest, int cellsize, int segment) = 0;
63
virtual QPixmap *pixmap() = 0;
64
virtual const char *name() = 0;
66
// space checking & positioning
67
virtual bool move(int x, int y) = 0;
68
virtual int width() = 0;
69
virtual int height() = 0;
74
virtual bool selected() = 0;
75
virtual void setSelected(bool newselection) = 0;
77
// creation and destruction are handled via standard
78
// constructors/destructors