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 LinkStyle getDefLinkStyle();
37 void setLinkStyle(LinkStyle);
38 LinkStyle getLinkStyle();
39 void setLinkPos (LinkPos);
40 LinkPos getLinkPos ();
42 virtual void setLinkColor(); // sets color according to colorhint, overloaded
43 virtual void setLinkColor(QColor);
44 QColor getLinkColor();
45 virtual FrameType getFrameType ();
46 virtual void setFrameType (const FrameType &);
47 virtual void setFrameType (const QString &);
48 virtual void setVisibility (bool);
49 virtual void updateLink(); // update parPos and childPos
51 // redraw link with given style
52 LinkableMapObj* getChildObj(); // returns pointer to fromObj
53 LinkableMapObj* getParObj(); // returns pointer to toObj
54 QPoint getChildPos(); // returns pos where childs dock
55 QPoint getParPos(); // returns pos where parents dock
56 QPoint getRelPos(); // get position relative to parent (or (0,0))
57 LinkOrient getOrientation(); // get orientation
58 virtual int getDepth(); // return depth
59 virtual void setMapEditor(MapEditor*); // set MapEditor (needed in LMO::updateNoteFlag)
60 virtual MapEditor* getMapEditor(); // get MapEditor (usually from parent);
61 virtual QPoint getRandPos(); // make randomised position
63 virtual void alignRelativeTo(const QPoint );
64 virtual void reposition();
65 virtual void requestReposition(); // do reposition after next user event
66 virtual void forceReposition(); // to force a reposition now (outside
67 // of mapeditor e.g. in noteeditor
68 virtual bool repositionRequested();
70 virtual QRect getTotalBBox()=0; // return BBox including childs
71 virtual QRect getBBoxSizeWithChilds()=0;// return size of BBox including childs
72 virtual void calcBBoxSizeWithChilds()=0;// calc size of BBox including childs recursivly
74 virtual void setSelBox();
75 virtual void select();
76 virtual void unselect();
77 virtual QString getSelectString()=0;
80 void parabel(QPointArray &,double,double,double,double); // Create Parabel connecting two points
83 bool link2ParPos; // While moving around, sometimes link to parent
84 MapEditor* mapEditor; // for updateNoteFlag() and toggleScroll()
85 LinkOrient orientation;
86 int linkwidth; // width of a link
87 int depth; // depth: undef=-1 mapCenter=0 branch=1..n
88 QRect bboxTotal; // bounding box including childs
90 LinkableMapObj* childObj;
91 LinkableMapObj* parObj;
92 LinkableMapObj* parObjTmpBuf; // temporary buffer the original parent
93 int offset; // vertical offset of dockpos to pos
95 int thickness_start; // for StylePoly*
98 QColor linkcolor; // Link color
99 QCanvasLine* l; // line style
100 QCanvasPolygon* p; // poly styles
101 int arcsegs; // arc: number of segments
102 QPtrList <QCanvasLine> segment; // a part of e.g. the parabel
103 QPointArray pa0; // For drawing of PolyParabel and PolyLine
104 QPointArray pa1; // For drawing of PolyParabel
105 QPointArray pa2; // For drawing of PolyParabel
106 QCanvasLine* bottomline; // on bottom of BBox
107 bool repositionRequest; //
109 bool selected; // Used for marking the selection
110 QCanvasRectangle* selbox;
111 FrameObj *frame; // frame around object