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