1 #ifndef LINKABLEMAPOBJ_H
2 #define LINKABLEMAPOBJ_H
6 #include "headingobj.h"
7 #include "flagrowobj.h"
11 enum LinkOrient {OrientUndef,OrientLeftOfCenter, OrientRightOfCenter};
19 enum LinkPos {LinkMiddle,LinkBottom};
20 enum LinkColorHint {DefaultColor,HeadingColor};
22 class LinkableMapObj:public QObject, public MapObj {
26 LinkableMapObj (QCanvas*);
27 LinkableMapObj (LinkableMapObj*);
29 virtual void delLink();
31 virtual void copy (LinkableMapObj*);
32 void setChildObj (LinkableMapObj*);
33 virtual void setParObj (LinkableMapObj*);
34 virtual void setParObjTmp (LinkableMapObj*,QPoint,int); // Only for moving Obj around
35 virtual void unsetParObjTmp(); // reuse original ParObj
36 virtual bool hasParObjTmp();
37 LinkStyle getDefLinkStyle();
38 void setLinkStyle(LinkStyle);
39 LinkStyle getLinkStyle();
40 void setHideLinkUnselected(bool);
41 bool getHideLinkUnselected();
42 void setLinkPos (LinkPos);
43 LinkPos getLinkPos ();
45 virtual void setLinkColor(); // sets color according to colorhint, overloaded
46 virtual void setLinkColor(QColor);
47 QColor getLinkColor();
48 virtual FrameType getFrameType ();
49 virtual void setFrameType (const FrameType &);
50 virtual void setFrameType (const QString &);
51 virtual void setVisibility (bool);
52 virtual void updateLink(); // update parPos and childPos
54 // redraw link with given style
55 LinkableMapObj* getChildObj(); // returns pointer to fromObj
56 LinkableMapObj* getParObj(); // returns pointer to toObj
57 virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
58 QPoint getChildPos(); // returns pos where childs dock
59 QPoint getParPos(); // returns pos where parents dock
60 QPoint getRelPos(); // get position relative to parent (or (0,0))
61 LinkOrient getOrientation(); // get orientation
62 virtual int getDepth(); // return depth
63 virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag)
64 virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent);
65 virtual QPoint getRandPos(); // make randomised position
67 virtual void alignRelativeTo(const QPoint );
68 virtual void reposition();
69 virtual void requestReposition(); // do reposition after next user event
70 virtual void forceReposition(); // to force a reposition now (outside
71 // of mapeditor e.g. in noteeditor
72 virtual bool repositionRequested();
74 virtual QRect getTotalBBox()=0; // return BBox including childs
75 virtual QRect getBBoxSizeWithChilds()=0;// return size of BBox including childs
76 virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly
78 virtual void setSelBox();
79 virtual void select();
80 virtual void unselect();
81 virtual QString getSelectString()=0;
82 virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
85 void parabel(QPointArray &,double,double,double,double); // Create Parabel connecting two points
86 QString getLinkAttr();
90 bool link2ParPos; // While moving around, sometimes link to parent
91 MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll()
92 LinkOrient orientation;
93 int linkwidth; // width of a link
94 int depth; // depth: undef=-1 mapCenter=0 branch=1..n
95 QRect bboxTotal; // bounding box including childs
97 LinkableMapObj* childObj;
98 LinkableMapObj* parObj;
99 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
100 int offset; // vertical offset of dockpos to pos
102 int thickness_start; // for StylePoly*
103 LinkStyle style; // Current style
105 QColor linkcolor; // Link color
106 QCanvasLine* l; // line style
107 QCanvasPolygon* p; // poly styles
108 int arcsegs; // arc: number of segments
109 QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
110 QPointArray pa0; // For drawing of PolyParabel and PolyLine
111 QPointArray pa1; // For drawing of PolyParabel
112 QPointArray pa2; // For drawing of PolyParabel
113 QCanvasLine* bottomline; // on bottom of BBox
114 bool repositionRequest; //
116 bool selected; // Used for marking the selection
117 bool hideLinkUnselected; // to hide links if unselected
118 QCanvasRectangle* selbox;
119 FrameObj *frame; // frame around object