3 /////////////////////////////////////////////////////////////////
5 /////////////////////////////////////////////////////////////////
8 // cout << "Const FlagObj ()\n";
12 FlagObj::FlagObj(QCanvas* c):MapObj(c)
14 // cout << "Const FlagObj canvas="<<c<<endl;
18 FlagObj::FlagObj (FlagObj* io)
25 // cout << "Destr FlagObj " << name << "\n";
26 if (icon) delete (icon);
35 icon=new ImageObj (canvas);
36 icon->move (absPos.x(), absPos.y() );
41 void FlagObj::copy (FlagObj* other)
46 tooltip=other->tooltip;
48 icon->copy(other->icon);
49 setVisibility (other->isVisibleObj() );
50 // button is not copied, because
51 // we won't copy to a parentRow and
52 // all others don't need a button
55 void FlagObj::move(double x, double y)
62 void FlagObj::moveBy(double x, double y)
64 move (x+absPos.x(),y+absPos.y() );
67 void FlagObj::setVisibility (bool v)
69 MapObj::setVisibility(v);
71 icon->setVisibility(true);
73 icon->setVisibility(false);
76 void FlagObj::load (const QString &fn)
83 void FlagObj::load (const QPixmap &pm)
90 void FlagObj::setName(const QString &n)
95 const QString FlagObj::getName()
100 void FlagObj::setGroup (const QString &n)
105 const QString FlagObj::getGroup()
110 void FlagObj::setToolTip(const QString &n)
115 const QString FlagObj::getToolTip()
120 void FlagObj::setButton(QAction* b)
125 void FlagObj::updateButton()
128 button->setOn(state);
130 qWarning ("FlagObj::updateButton no button defined");
133 QPixmap FlagObj::getPixmap()
135 return icon->getPixmap();
138 bool FlagObj::isActive()
143 void FlagObj::toggle()
151 void FlagObj::activate()
154 // only show icon, if flag itself is visible
157 icon->setVisibility (true);
162 void FlagObj::deactivate()
165 // if flag itself is invisible we don't need to call
168 icon->setVisibility (false);
173 void FlagObj::setEnabled(bool b)
175 button->setEnabled (b);
179 void FlagObj::setUsed (bool b)
184 bool FlagObj::isUsed()
189 void FlagObj::saveToDir (const QString &tmpdir, const QString &prefix)
191 QString fn=tmpdir + prefix + name + ".png";
192 icon->save (fn,"PNG");
195 void FlagObj::positionBBox()
197 bbox.setX (absPos.x() );
198 bbox.setY (absPos.y() );
201 void FlagObj::calcBBoxSize()
203 if (visible && state)
205 bbox.setSize ( QSize(
206 icon->boundingRect().width(),
207 icon->boundingRect().height() ) );
210 bbox.setSize (QSize(0,0));