Initial import.
3 /////////////////////////////////////////////////////////////////
5 /////////////////////////////////////////////////////////////////
8 // cout << "Const FlagObj ()\n";
12 FlagObj::FlagObj(QCanvas* c):MapObj(c)
14 // cout << "Const FlagObj\n";
18 FlagObj::FlagObj (FlagObj* io)
25 // cout << "Destr FlagObj " << name << "\n";
34 icon=new ImageObj (canvas);
35 icon->move (absPos.x(), absPos.y() );
40 void FlagObj::copy (FlagObj* other)
44 tooltip=other->tooltip;
46 icon->copy(other->icon);
47 setVisibility (other->isVisibleObj() );
48 // button is not copied, because
49 // we won't copy to a parentRow and
50 // all others don't need a button
53 void FlagObj::move(double x, double y)
60 void FlagObj::moveBy(double x, double y)
62 move (x+absPos.x(),y+absPos.y() );
65 void FlagObj::setVisibility (bool v)
67 MapObj::setVisibility(v);
69 icon->setVisibility(true);
71 icon->setVisibility(false);
74 void FlagObj::load (const QString &fn)
81 void FlagObj::load (const QPixmap &pm)
88 void FlagObj::setName(const QString &n)
93 const QString FlagObj::getName()
98 void FlagObj::setToolTip(const QString &n)
103 const QString FlagObj::getToolTip()
108 void FlagObj::setButton(QAction* b)
113 void FlagObj::updateButton()
116 button->setOn(state);
118 qWarning ("FlagObj::updateButton no button defined");
121 QPixmap FlagObj::getPixmap()
123 return icon->getPixmap();
126 bool FlagObj::isActive()
131 void FlagObj::toggle()
139 void FlagObj::activate()
142 // only show icon, if flag itself is visible
145 icon->setVisibility (true);
150 void FlagObj::deactivate()
153 // if flag itself is invisible we don't need to call
156 icon->setVisibility (false);
161 void FlagObj::setEnabled(bool b)
163 button->setEnabled (b);
167 void FlagObj::setUsed (bool b)
172 bool FlagObj::isUsed()
177 void FlagObj::saveToDir (const QString &tmpdir, const QString &prefix)
179 QString fn=tmpdir + prefix + name + ".png";
180 icon->save (fn,"PNG");
183 void FlagObj::positionBBox()
185 bbox.setX (absPos.x() );
186 bbox.setY (absPos.y() );
189 void FlagObj::calcBBoxSize()
191 if (visible && state)
193 bbox.setSize ( QSize(
194 icon->boundingRect().width(),
195 icon->boundingRect().height() ) );
198 bbox.setSize (QSize(0,0));