forked from organicmaps/organicmaps
simplified writing new guy::Elements by providing default implementation for some methods.
This commit is contained in:
parent
8c35666e0f
commit
3ce3645210
2 changed files with 36 additions and 6 deletions
|
@ -93,6 +93,11 @@ namespace gui
|
|||
}
|
||||
}
|
||||
|
||||
yg::OverlayElement * Element::clone(math::Matrix<double, 3, 3> const & m) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Element::draw(yg::gl::OverlayRenderer *r, math::Matrix<double, 3, 3> const & m) const
|
||||
{
|
||||
for (unsigned i = 0; i < boundRects().size(); ++i)
|
||||
|
@ -103,4 +108,30 @@ namespace gui
|
|||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool Element::onTapStarted(m2::PointD const & pt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Element::onTapMoved(m2::PointD const & pt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Element::onTapEnded(m2::PointD const & pt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Element::onTapCancelled(m2::PointD const & pt)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void Element::setController(Controller * controller)
|
||||
{
|
||||
m_controller = controller;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -59,18 +59,17 @@ namespace gui
|
|||
yg::Color const & color(EState state) const;
|
||||
|
||||
/// Implement this method to handle single tap on the GUI element.
|
||||
virtual bool onTapStarted(m2::PointD const & pt) = 0;
|
||||
virtual bool onTapMoved(m2::PointD const & pt) = 0;
|
||||
virtual bool onTapEnded(m2::PointD const & pt) = 0;
|
||||
virtual bool onTapCancelled(m2::PointD const & pt) = 0;
|
||||
virtual bool onTapStarted(m2::PointD const & pt);
|
||||
virtual bool onTapMoved(m2::PointD const & pt);
|
||||
virtual bool onTapEnded(m2::PointD const & pt);
|
||||
virtual bool onTapCancelled(m2::PointD const & pt);
|
||||
|
||||
void invalidate();
|
||||
double visualScale() const;
|
||||
|
||||
void setPivot(m2::PointD const & pv);
|
||||
|
||||
yg::OverlayElement * clone(math::Matrix<double, 3, 3> const & m) const;
|
||||
void draw(yg::gl::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
|
||||
|
||||
int visualRank() const;
|
||||
|
||||
virtual void cache();
|
||||
|
|
Loading…
Add table
Reference in a new issue