diff -r 000000000000 -r 7a96bd401351 linkablemapobj.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linkablemapobj.h Sun Jan 30 12:58:47 2005 +0000 @@ -0,0 +1,113 @@ +#ifndef LINKABLEMAPOBJ_H +#define LINKABLEMAPOBJ_H + +#include "frameobj.h" +#include "noteobj.h" +#include "headingobj.h" +#include "flagrowobj.h" + +#define MAX_DEPTH 999 + +enum LinkOrient {OrientUndef,OrientLeftOfCenter, OrientRightOfCenter}; +enum LinkStyle { + StyleUndef, + StyleLine, + StyleParabel, + StylePolyLine, + StylePolyParabel +}; +enum LinkPos {LinkMiddle,LinkBottom}; +enum LinkColorHint {DefaultColor,HeadingColor}; + +class LinkableMapObj:public QObject, public MapObj { + Q_OBJECT +public: + LinkableMapObj (); + LinkableMapObj (QCanvas*); + LinkableMapObj (LinkableMapObj*); + ~LinkableMapObj (); + virtual void delLink(); + virtual void init (); + virtual void copy (LinkableMapObj*); + void setChildObj (LinkableMapObj*); + virtual void setParObj (LinkableMapObj*); + virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around + virtual void unsetParObjTmp(); // reuse original ParObj + LinkStyle getDefLinkStyle(); + void setLinkStyle(LinkStyle); + LinkStyle getLinkStyle(); + void setLinkPos (LinkPos); + LinkPos getLinkPos (); + + virtual void setLinkColor(); // sets color according to colorhint, overloaded + virtual void setLinkColor(QColor); + QColor getLinkColor(); + virtual FrameType getFrameType (); + virtual void setFrameType (const FrameType &); + virtual void setFrameType (const QString &); + virtual void setVisibility (bool); + virtual void updateLink(); // update parPos and childPos + // depending on pos + // redraw link with given style + LinkableMapObj* getChildObj(); // returns pointer to fromObj + LinkableMapObj* getParObj(); // returns pointer to toObj + QPoint getChildPos(); // returns pos where childs dock + QPoint getParPos(); // returns pos where parents dock + QPoint getRelPos(); // get position relative to parent (or (0,0)) + LinkOrient getOrientation(); // get orientation + virtual int getDepth(); // return depth + virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag) + virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent); + virtual QPoint getRandPos(); // make randomised position + + virtual void alignRelativeTo(const QPoint ); + virtual void reposition(); + virtual void requestReposition(); // do reposition after next user event + virtual void forceReposition(); // to force a reposition now (outside + // of mapeditor e.g. in noteeditor + virtual bool repositionRequested(); + + virtual QRect getTotalBBox()=0; // return BBox including childs + virtual QRect getBBoxSizeWithChilds()=0;// return size of BBox including childs + virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly + + virtual void setSelBox(); + virtual void select(); + virtual void unselect(); + virtual QString getSelectString()=0; + +protected: + void parabel(QPointArray &,double,double,double,double); // Create Parabel connecting two points + QPoint childPos; + QPoint parPos; + bool link2ParPos; // While moving around, sometimes link to parent + MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll() + LinkOrient orientation; + int linkwidth; // width of a link + int depth; // depth: undef=-1 mapCenter=0 branch=1..n + QRect bboxTotal; // bounding box including childs + + LinkableMapObj* childObj; + LinkableMapObj* parObj; + LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent + int offset; // vertical offset of dockpos to pos + + int thickness_start; // for StylePoly* + LinkStyle style; + LinkPos linkpos; + QColor linkcolor; // Link color + QCanvasLine* l; // line style + QCanvasPolygon* p; // poly styles + int arcsegs; // arc: number of segments + QPtrList segment; // a part of e.g. the parabel + QPointArray pa0; // For drawing of PolyParabel and PolyLine + QPointArray pa1; // For drawing of PolyParabel + QPointArray pa2; // For drawing of PolyParabel + QCanvasLine* bottomline; // on bottom of BBox + bool repositionRequest; // + + bool selected; // Used for marking the selection + QCanvasRectangle* selbox; + FrameObj *frame; // frame around object +}; +#endif