diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-06-28 21:41:52 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:19:02 +0300 |
commit | 81ae6f0d1f9f5d9a487aa6b8596fcc0d522936a8 (patch) | |
tree | ed2a121b9733bf044136608832abffc01c42593b /map/pin_click_manager.cpp | |
parent | da54d1b28f11d9aaa7f6bef72ff8391de486fdc3 (diff) |
[core] move logic about second tap into core.
Send activation callback when active mark already exist on "long click" or when it's click into "user mark/my position".
Don't send OnDissmis when active mark not exist
rename ballon_manager files into pin_click_manager as class
Diffstat (limited to 'map/pin_click_manager.cpp')
-rw-r--r-- | map/pin_click_manager.cpp | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/map/pin_click_manager.cpp b/map/pin_click_manager.cpp new file mode 100644 index 0000000000..50402459e4 --- /dev/null +++ b/map/pin_click_manager.cpp @@ -0,0 +1,77 @@ +#include "pin_click_manager.hpp" +#include "framework.hpp" + +#include "../search/result.hpp" + +#include "../anim/task.hpp" +#include "../anim/controller.hpp" + +#include "../graphics/depth_constants.hpp" +#include "../graphics/opengl/base_texture.hpp" +#include "../graphics/display_list.hpp" +#include "../graphics/icon.hpp" + +#include "../geometry/transformations.hpp" + +#include "../gui/controller.hpp" + + +PinClickManager::PinClickManager(Framework & f) + : m_f(f) +{} + +void PinClickManager::Hide() +{ + m_f.Invalidate(); +} + +void PinClickManager::OnShowMark(UserMark const * mark) +{ + if (mark != NULL) + OnActivateUserMark(mark->Copy()); + SetBalloonVisible(mark != NULL); +} + +void PinClickManager::OnBookmarkClick(BookmarkAndCategory const & bnc) +{ + Bookmark * mark = m_f.GetBmCategory(bnc.first)->GetBookmark(bnc.second); + m_f.ActivateUserMark(mark); + SetBalloonVisible(true); +} + +void PinClickManager::SetBalloonVisible(bool isVisible) +{ + if (!isVisible && m_f.HasActiveUserMark()) + OnDismiss(); + + m_f.Invalidate(); +} + +void PinClickManager::RemovePin() +{ + m_f.ActivateUserMark(NULL); + m_f.Invalidate(); +} + +void PinClickManager::Dismiss() +{ + OnDismiss(); +} + +void PinClickManager::ClearListeners() +{ + m_userMarkListener.clear(); + m_dismissListener.clear(); +} + +void PinClickManager::OnActivateUserMark(UserMarkCopy * mark) +{ + m_userMarkListener(mark); +} + +void PinClickManager::OnDismiss() +{ + // Can be called before the listeners will be attached (clearing on activity start). + if (m_dismissListener) + m_dismissListener(); +} |