bobport.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Gav Wood                                        *
00003  *   gav@cs.york.ac.uk                                                     *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef BOBPORT_H
00021 #define BOBPORT_H
00022 
00023 #define __GEDDEI_BUILD
00024 
00025 #include "processor.h"
00026 using namespace Geddei;
00027 
00028 #include <qcanvas.h>
00029 #include <qptrlist.h>
00030 #include <qpoint.h>
00031 #include <qobject.h>
00032 
00033 #include "refresher.h"
00034 
00035 class QPainter;
00036 class QDomElement;
00037 class QDomDocument;
00038 
00039 class GeddeiNite;
00040 class Bob;
00041 class BobLink;
00042 
00046 class BobPort: public QObject, public QCanvasEllipse, public Refresher
00047 {
00048  Q_OBJECT
00049 
00050  QPoint thePos;
00051  int theIndex;
00052  Bob *theBob;
00053  bool theIsInput;
00054  QPtrList<BobLink> theLinks;
00055 /* class Info: public QCanvasRectangle
00056  {
00057   friend class BobPort;
00058   float theFill;
00059   virtual void drawShape(QPainter &p);
00060  public:
00061   void setFill(float f) { theFill = f; update(); }
00062   Info(int x, int y, int w, int h, QCanvas *c) : QCanvasEllipse(x, y, w + 2, h + 2, c) { setZ(1000); theFill = 1; }
00063  } *theInfo;
00064 */
00065  float theFill;
00066  void updateLinks();
00067  virtual void drawShape(QPainter &p);
00068 
00069  Processor *processor();
00070 
00071 public slots:
00072  void updateProfile();
00073 
00074 public:
00075  static int RTTI;
00076  virtual int rtti() const { return 1001; }
00077 
00078  int numLinks() { return theLinks.count(); }
00079 
00080  bool connectYourself();
00081  void disconnectYourself();
00082  void saveYourself(QDomElement &element, QDomDocument &doc);
00083  void loadYourself(QDomElement &element);
00084 
00085  void refresh();
00086  bool isInput() { return theIsInput; }
00087  void setPos(QPoint p);
00088  GeddeiNite *geddeiNite();
00089 
00090  bool isSiblingOf(BobPort *p) { return p->theBob == theBob; }
00091 
00092  void addLink(BobLink *link) { theLinks.append(link); }
00093  void removeLink(BobLink *link) { theLinks.remove(link); }
00094 
00095  BobPort(Bob *bob, bool isInput, int index, int x = 0, int y = 0);
00096  ~BobPort();
00097 };
00098 
00099 #endif

Generated on Thu Jul 13 06:56:33 2006 for Exscalibar by  doxygen 1.4.7