~ubuntu-branches/ubuntu/hoary/kdemultimedia/hoary

« back to all changes in this revision

Viewing changes to arts/builder/scomponent.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Schulze
  • Date: 2003-01-22 15:00:51 UTC
  • Revision ID: james.westby@ubuntu.com-20030122150051-uihwkdoxf15mi1tn
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
    /*
 
2
 
 
3
    Copyright (C) 1999 Stefan Westerfeld
 
4
                       stefan@space.twc.de
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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.
 
19
 
 
20
    */
 
21
 
 
22
#ifndef __SCOMPONENT_H__
 
23
#define __SCOMPONENT_H__
 
24
 
 
25
#include <qscrollview.h>
 
26
#include <qpainter.h>
 
27
#include <qpixmap.h>
 
28
#include <list>
 
29
 
 
30
class ModulePort;
 
31
 
 
32
class StructureCanvas {
 
33
public:
 
34
        virtual void redrawRect(int x, int y, int width, int height) = 0;
 
35
};
 
36
 
 
37
class StructureComponent {
 
38
protected:
 
39
        StructureCanvas *canvas;
 
40
 
 
41
public:
 
42
        StructureComponent(StructureCanvas *canvas);
 
43
        virtual ~StructureComponent();
 
44
 
 
45
        // type
 
46
 
 
47
        enum ComponentType { ctModule, ctPort };
 
48
        virtual ComponentType type() = 0;
 
49
        
 
50
        // TODO: connection & autorouter
 
51
 
 
52
        virtual ModulePort *portAt(int segment, int x, int y) = 0;
 
53
        virtual void dumpPorts(std::list<ModulePort *>& ports) = 0;
 
54
 
 
55
        // visibility
 
56
        virtual void hide() = 0;
 
57
        virtual void show() = 0;
 
58
        virtual bool visible() = 0;
 
59
 
 
60
        // drawing
 
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;
 
65
 
 
66
        // space checking & positioning
 
67
        virtual bool move(int x, int y) = 0;
 
68
        virtual int width() = 0;
 
69
        virtual int height() = 0;
 
70
        virtual int x() = 0;
 
71
        virtual int y() = 0;
 
72
 
 
73
        // selection
 
74
        virtual bool selected() = 0;
 
75
        virtual void setSelected(bool newselection) = 0;
 
76
 
 
77
        // creation and destruction are handled via standard
 
78
        // constructors/destructors
 
79
};
 
80
 
 
81
#endif