mapobj.h
author insilmaril
Sat, 23 Jul 2005 10:26:30 +0000
changeset 134 6c199971ddb5
parent 129 9b9c7e8b9147
child 175 728f51b71e71
permissions -rw-r--r--
updated api.*
     1 #ifndef MAPOBJ_H
     2 #define MAPOBJ_H
     3 
     4 #include <qcanvas.h>
     5 #include <iostream>
     6 
     7 #include "misc.h"
     8 
     9 using namespace std;
    10 
    11 #define Z_BBOX     0
    12 #define Z_XLINK   10
    13 #define Z_LINK    20
    14 #define Z_FRAME   50
    15 #define Z_SELBOX  60
    16 #define Z_ICON    80
    17 #define Z_TEXT   100
    18 
    19 class MapObj:public xmlObj {
    20 public:
    21     MapObj ();
    22     MapObj (QCanvas*);
    23     MapObj (MapObj*);
    24     virtual ~MapObj ();
    25     virtual void init ();
    26     virtual void copy (MapObj*);
    27 	virtual QCanvas* getCanvas();
    28     virtual int x();
    29     virtual int y();
    30 	virtual int width();
    31 	virtual int height();
    32 	virtual QString getPos();					// Return position as string (x,y)
    33     virtual void move (double x,double y);      // move to absolute Position
    34     virtual void moveBy (double x,double y);    // move to relative Position
    35     virtual bool inBBox(QPoint);				// Check if Point is in bbox
    36     virtual QRect getBBox();					// returns bounding box
    37     virtual QRect addBBox(QRect,QRect);			// returns bbox which includes both boxes
    38     virtual QSize getSize();					// returns size of bounding box
    39     virtual bool isVisibleObj();
    40     virtual void setVisibility(bool);
    41 protected:  
    42     QCanvas* canvas;
    43     QRect bbox;									// bounding box of MO itself
    44     virtual void positionBBox()=0;       
    45 	virtual void calcBBoxSize()=0;
    46     QPoint absPos;							    // Position on canvas
    47     bool visible;
    48 };
    49 
    50 #endif