1 #ifndef LINKABLEMAPOBJ_H
2 #define LINKABLEMAPOBJ_H
6 #include "headingobj.h"
7 #include "flagrowobj.h"
9 #include <Q3PointArray>
14 enum LinkOrient {OrientUndef,OrientLeftOfCenter, OrientRightOfCenter};
22 enum LinkPos {LinkMiddle,LinkBottom};
23 enum LinkColorHint {DefaultColor,HeadingColor};
25 class LinkableMapObj:public QObject, public MapObj {
29 LinkableMapObj (Q3Canvas*);
30 LinkableMapObj (LinkableMapObj*);
32 virtual void delLink();
34 virtual void copy (LinkableMapObj*);
35 void setChildObj (LinkableMapObj*);
36 virtual void setParObj (LinkableMapObj*);
37 virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around
38 virtual void unsetParObjTmp(); // reuse original ParObj
39 virtual bool hasParObjTmp();
41 virtual void setUseRelPos (const bool&);
42 virtual void setRelPos(); // set relPos to current parentPos
43 virtual void setRelPos(const QPoint&);
44 virtual QPoint getRelPos();
45 virtual void setUseOrientation (const bool &);
48 virtual int getTopPad();
49 virtual int getLeftPad();
50 virtual int getRightPad();
51 LinkStyle getDefLinkStyle();
52 void setLinkStyle(LinkStyle);
53 LinkStyle getLinkStyle();
54 void setHideLinkUnselected(bool);
55 bool getHideLinkUnselected();
56 void setLinkPos (LinkPos);
57 LinkPos getLinkPos ();
59 virtual void setLinkColor(); // sets color according to colorhint, overloaded
60 virtual void setLinkColor(QColor);
61 QColor getLinkColor();
62 virtual FrameType getFrameType ();
63 virtual void setFrameType (const FrameType &);
64 virtual void setFrameType (const QString &);
65 virtual void setVisibility (bool);
66 virtual void setOrientation();
67 virtual void updateLink(); // update parPos and childPos
69 // redraw link with given style
70 LinkableMapObj* getChildObj(); // returns pointer to fromObj
71 LinkableMapObj* getParObj(); // returns pointer to toObj
72 virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
73 virtual void setDockPos()=0; // sets childPos and parPos
74 QPoint getChildPos(); // returns pos where childs dock
75 QPoint getParPos(); // returns pos where parents dock
76 LinkOrient getOrientation(); // get orientation
77 virtual int getDepth(); // return depth
78 virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag)
79 virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent);
80 virtual QPoint getRandPos(); // make randomised position
82 //virtual void alignRelativeTo(const QPoint );
83 virtual void reposition();
84 virtual void requestReposition(); // do reposition after next user event
85 virtual void forceReposition(); // to force a reposition now (outside
86 // of mapeditor e.g. in noteeditor
87 virtual bool repositionRequested();
89 //virtual QRect getTotalBBox(); // return BBox including childs
90 //virtual QRect getBBoxSizeWithChilds();// return size of BBox including childs
91 virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly
93 virtual void setSelBox();
94 virtual void select();
95 virtual void unselect();
96 virtual QString getSelectString()=0;
97 //virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data to XML
100 void parabel(Q3PointArray &,double,double,double,double); // Create Parabel connecting two points
101 QString getLinkAttr();
105 bool link2ParPos; // While moving around, sometimes link to parent
106 MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll()
107 LinkOrient orientation;
108 int linkwidth; // width of a link
109 int depth; // depth: undef=-1 mapCenter=0 branch=1..n
110 QRect bboxTotal; // bounding box including childs
112 LinkableMapObj* childObj;
113 LinkableMapObj* parObj;
114 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
115 int bottomlineY; // vertical offset of dockpos to pos
117 int thickness_start; // for StylePoly*
118 LinkStyle style; // Current style
119 LinkPos linkpos; // Link at bottom of object or middle of height
120 QColor linkcolor; // Link color
121 Q3CanvasLine* l; // line style
122 Q3CanvasPolygon* p; // poly styles
123 int arcsegs; // arc: number of segments
124 Q3PtrList <Q3CanvasLine> segment; // a part of e.g. the parabel
125 Q3PointArray pa0; // For drawing of PolyParabel and PolyLine
126 Q3PointArray pa1; // For drawing of PolyParabel
127 Q3PointArray pa2; // For drawing of PolyParabel
128 Q3CanvasLine* bottomline; // on bottom of BBox
129 bool repositionRequest; //
131 bool selected; // Used for marking the selection
132 bool hideLinkUnselected; // to hide links if unselected
133 Q3CanvasRectangle* selbox;
134 FrameObj *frame; // frame around object
136 leftPad, rightPad; // padding within bbox
138 QPoint relPos; // position relative to childPos of parent