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 virtual int getTopPad();
38 virtual int getLeftPad();
39 virtual int getRightPad();
40 LinkStyle getDefLinkStyle();
41 void setLinkStyle(LinkStyle);
42 LinkStyle getLinkStyle();
43 void setHideLinkUnselected(bool);
44 bool getHideLinkUnselected();
45 void setLinkPos (LinkPos);
46 LinkPos getLinkPos ();
48 virtual void setLinkColor(); // sets color according to colorhint, overloaded
49 virtual void setLinkColor(QColor);
50 QColor getLinkColor();
51 virtual FrameType getFrameType ();
52 virtual void setFrameType (const FrameType &);
53 virtual void setFrameType (const QString &);
54 virtual void setVisibility (bool);
55 virtual void updateLink(); // update parPos and childPos
57 // redraw link with given style
58 LinkableMapObj* getChildObj(); // returns pointer to fromObj
59 LinkableMapObj* getParObj(); // returns pointer to toObj
60 virtual LinkableMapObj* findObjBySelect(QString s); // find obj by selectstring
61 QPoint getChildPos(); // returns pos where childs dock
62 QPoint getParPos(); // returns pos where parents dock
63 QPoint getRelPos(); // get position relative to parent (or (0,0))
64 LinkOrient getOrientation(); // get orientation
65 virtual int getDepth(); // return depth
66 virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag)
67 virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent);
68 virtual QPoint getRandPos(); // make randomised position
70 virtual void alignRelativeTo(const QPoint );
71 virtual void reposition();
72 virtual void requestReposition(); // do reposition after next user event
73 virtual void forceReposition(); // to force a reposition now (outside
74 // of mapeditor e.g. in noteeditor
75 virtual bool repositionRequested();
77 virtual QRect getTotalBBox()=0; // return BBox including childs
78 virtual QRect getBBoxSizeWithChilds()=0;// return size of BBox including childs
79 virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly
81 virtual void setSelBox();
82 virtual void select();
83 virtual void unselect();
84 virtual QString getSelectString()=0;
85 virtual QString saveToDir (const QString&,const QString&, const QPoint&)=0;// Save data to tempdir
88 void parabel(QPointArray &,double,double,double,double); // Create Parabel connecting two points
89 QString getLinkAttr();
93 bool link2ParPos; // While moving around, sometimes link to parent
94 MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll()
95 LinkOrient orientation;
96 int linkwidth; // width of a link
97 int depth; // depth: undef=-1 mapCenter=0 branch=1..n
98 QRect bboxTotal; // bounding box including childs
100 LinkableMapObj* childObj;
101 LinkableMapObj* parObj;
102 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
103 int bottomlineY; // vertical offset of dockpos to pos
105 int thickness_start; // for StylePoly*
106 LinkStyle style; // Current style
108 QColor linkcolor; // Link color
109 QCanvasLine* l; // line style
110 QCanvasPolygon* p; // poly styles
111 int arcsegs; // arc: number of segments
112 QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
113 QPointArray pa0; // For drawing of PolyParabel and PolyLine
114 QPointArray pa1; // For drawing of PolyParabel
115 QPointArray pa2; // For drawing of PolyParabel
116 QCanvasLine* bottomline; // on bottom of BBox
117 bool repositionRequest; //
119 bool selected; // Used for marking the selection
120 bool hideLinkUnselected; // to hide links if unselected
121 QCanvasRectangle* selbox;
122 FrameObj *frame; // frame around object
124 leftPad, rightPad; // padding within bbox