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 updateLink(); // update parPos and childPos
68 // redraw link with given style
69 LinkableMapObj* getChildObj(); // returns pointer to fromObj
70 LinkableMapObj* getParObj(); // returns pointer to toObj
71 virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
72 virtual void setDockPos(); // sets childPos and parPos
73 QPoint getChildPos(); // returns pos where childs dock
74 QPoint getParPos(); // returns pos where parents dock
75 LinkOrient getOrientation(); // get orientation
76 virtual int getDepth(); // return depth
77 virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag)
78 virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent);
79 virtual QPoint getRandPos(); // make randomised position
81 virtual void alignRelativeTo(const QPoint );
82 virtual void reposition();
83 virtual void requestReposition(); // do reposition after next user event
84 virtual void forceReposition(); // to force a reposition now (outside
85 // of mapeditor e.g. in noteeditor
86 virtual bool repositionRequested();
88 virtual QRect getTotalBBox()=0; // return BBox including childs
89 virtual QRect getBBoxSizeWithChilds()=0;// return size of BBox including childs
90 virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly
92 virtual void setSelBox();
93 virtual void select();
94 virtual void unselect();
95 virtual QString getSelectString()=0;
96 virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
99 void parabel(Q3PointArray &,double,double,double,double); // Create Parabel connecting two points
100 QString getLinkAttr();
104 bool link2ParPos; // While moving around, sometimes link to parent
105 MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll()
106 LinkOrient orientation;
107 int linkwidth; // width of a link
108 int depth; // depth: undef=-1 mapCenter=0 branch=1..n
109 QRect bboxTotal; // bounding box including childs
111 LinkableMapObj* childObj;
112 LinkableMapObj* parObj;
113 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
114 int bottomlineY; // vertical offset of dockpos to pos
116 int thickness_start; // for StylePoly*
117 LinkStyle style; // Current style
118 LinkPos linkpos; // Link at bottom of object or middle of height
119 QColor linkcolor; // Link color
120 Q3CanvasLine* l; // line style
121 Q3CanvasPolygon* p; // poly styles
122 int arcsegs; // arc: number of segments
123 Q3PtrList <Q3CanvasLine> segment; // a part of e.g. the parabel
124 Q3PointArray pa0; // For drawing of PolyParabel and PolyLine
125 Q3PointArray pa1; // For drawing of PolyParabel
126 Q3PointArray pa2; // For drawing of PolyParabel
127 Q3CanvasLine* bottomline; // on bottom of BBox
128 bool repositionRequest; //
130 bool selected; // Used for marking the selection
131 bool hideLinkUnselected; // to hide links if unselected
132 Q3CanvasRectangle* selbox;
133 FrameObj *frame; // frame around object
135 leftPad, rightPad; // padding within bbox
137 QPoint relPos; // position relative to childPos of parent