forked from organicmaps/organicmaps
Review fixes
This commit is contained in:
parent
2f8f23e903
commit
ba09d1e7c2
8 changed files with 22 additions and 24 deletions
|
@ -26,7 +26,7 @@ namespace
|
|||
class CompassHandle : public TappableHandle
|
||||
{
|
||||
public:
|
||||
CompassHandle(m2::PointF const & pivot, m2::PointF const & size, Compass::TTapHandler const & tapHandler)
|
||||
CompassHandle(m2::PointF const & pivot, m2::PointF const & size, Shape::TTapHandler const & tapHandler)
|
||||
: TappableHandle(dp::Center, pivot, size)
|
||||
, m_tapHandler(tapHandler)
|
||||
{}
|
||||
|
@ -53,7 +53,7 @@ namespace
|
|||
}
|
||||
|
||||
private:
|
||||
Compass::TTapHandler m_tapHandler;
|
||||
Shape::TTapHandler m_tapHandler;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ public:
|
|||
: Shape(position)
|
||||
{}
|
||||
|
||||
using TTapHandler = function<void()>;
|
||||
drape_ptr<ShapeRenderer> Draw(ref_ptr<dp::TextureManager> tex, TTapHandler const & tapHandler) const;
|
||||
};
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ class CountryStatusButtonHandle : public ButtonHandle
|
|||
|
||||
public:
|
||||
CountryStatusButtonHandle(CountryStatusHelper::ECountryState const state,
|
||||
CountryStatus::TTapHandler const & tapHandler,
|
||||
Shape::TTapHandler const & tapHandler,
|
||||
dp::Anchor anchor, m2::PointF const & size)
|
||||
: TBase(anchor, size)
|
||||
, m_state(state)
|
||||
|
@ -41,7 +41,7 @@ public:
|
|||
|
||||
private:
|
||||
CountryStatusHelper::ECountryState m_state;
|
||||
CountryStatus::TTapHandler m_tapHandler;
|
||||
Shape::TTapHandler m_tapHandler;
|
||||
};
|
||||
|
||||
class CountryStatusLabelHandle : public Handle
|
||||
|
@ -89,7 +89,7 @@ private:
|
|||
};
|
||||
|
||||
drape_ptr<dp::OverlayHandle> CreateButtonHandle(CountryStatusHelper::ECountryState const state,
|
||||
CountryStatus::TTapHandler const & tapHandler,
|
||||
Shape::TTapHandler const & tapHandler,
|
||||
dp::Anchor anchor, m2::PointF const & size)
|
||||
{
|
||||
return make_unique_dp<CountryStatusButtonHandle>(state, tapHandler, anchor, size);
|
||||
|
@ -165,7 +165,7 @@ drape_ptr<ShapeRenderer> CountryStatus::Draw(ref_ptr<dp::TextureManager> tex,
|
|||
case CountryStatusHelper::CONTROL_TYPE_BUTTON:
|
||||
{
|
||||
TButtonHandlers::const_iterator buttonHandlerIt = buttonHandlers.find(control.m_buttonType);
|
||||
CountryStatus::TTapHandler buttonHandler = (buttonHandlerIt != buttonHandlers.end() ? buttonHandlerIt->second : nullptr);
|
||||
Shape::TTapHandler buttonHandler = (buttonHandlerIt != buttonHandlers.end() ? buttonHandlerIt->second : nullptr);
|
||||
Button::THandleCreator buttonHandleCreator = bind(&CreateButtonHandle, state, buttonHandler, _1, _2);
|
||||
Button::THandleCreator labelHandleCreator = bind(&CreateLabelHandle, state, _1, _2);
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ public:
|
|||
: Shape(position)
|
||||
{}
|
||||
|
||||
using TTapHandler = function<void()>;
|
||||
using TButtonHandlers = map<CountryStatusHelper::EButtonType, TTapHandler>;
|
||||
|
||||
drape_ptr<ShapeRenderer> Draw(ref_ptr<dp::TextureManager> tex,
|
||||
|
|
|
@ -132,13 +132,13 @@ CountryStatusHelper & DrapeGui::GetCountryStatusHelperImpl()
|
|||
return m_impl->m_countryHelper;
|
||||
}
|
||||
|
||||
void DrapeGui::ConnectOnCompassTappedHandler(Compass::TTapHandler const & handler)
|
||||
void DrapeGui::ConnectOnCompassTappedHandler(Shape::TTapHandler const & handler)
|
||||
{
|
||||
m_onCompassTappedHandler = handler;
|
||||
}
|
||||
|
||||
void DrapeGui::ConnectOnButtonPressedHandler(CountryStatusHelper::EButtonType buttonType,
|
||||
CountryStatus::TTapHandler const & handler)
|
||||
Shape::TTapHandler const & handler)
|
||||
{
|
||||
m_buttonHandlers[buttonType] = handler;
|
||||
}
|
||||
|
|
|
@ -73,9 +73,9 @@ public:
|
|||
bool IsCopyrightActive() const { return m_isCopyrightActive; }
|
||||
void DeactivateCopyright() { m_isCopyrightActive = false; }
|
||||
|
||||
void ConnectOnCompassTappedHandler(Compass::TTapHandler const & handler);
|
||||
void ConnectOnCompassTappedHandler(Shape::TTapHandler const & handler);
|
||||
void ConnectOnButtonPressedHandler(CountryStatusHelper::EButtonType buttonType,
|
||||
CountryStatus::TTapHandler const & handler);
|
||||
Shape::TTapHandler const & handler);
|
||||
void CallOnCompassTappedHandler();
|
||||
void CallOnButtonPressedHandler(CountryStatusHelper::EButtonType buttonType);
|
||||
|
||||
|
@ -88,7 +88,7 @@ private:
|
|||
unique_ptr<Impl> m_impl;
|
||||
bool m_isCopyrightActive = true;
|
||||
|
||||
Compass::TTapHandler m_onCompassTappedHandler;
|
||||
Shape::TTapHandler m_onCompassTappedHandler;
|
||||
CountryStatus::TButtonHandlers m_buttonHandlers;
|
||||
};
|
||||
|
||||
|
|
|
@ -51,6 +51,13 @@ private:
|
|||
int m_scale;
|
||||
};
|
||||
|
||||
void RegisterButtonHandler(CountryStatus::TButtonHandlers & handlers,
|
||||
CountryStatusHelper::EButtonType buttonType)
|
||||
{
|
||||
handlers[buttonType] = bind(&DrapeGui::CallOnButtonPressedHandler,
|
||||
&DrapeGui::Instance(), buttonType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LayerCacher::LayerCacher(string const & deviceType)
|
||||
|
@ -86,17 +93,9 @@ drape_ptr<LayerRenderer> LayerCacher::Recache(Skin::ElementName names,
|
|||
CountryStatus countryStatus = CountryStatus(GetPos(Skin::CountryStatus));
|
||||
|
||||
CountryStatus::TButtonHandlers handlers;
|
||||
handlers[CountryStatusHelper::BUTTON_TYPE_MAP] = bind(&DrapeGui::CallOnButtonPressedHandler,
|
||||
&DrapeGui::Instance(),
|
||||
CountryStatusHelper::BUTTON_TYPE_MAP);
|
||||
|
||||
handlers[CountryStatusHelper::BUTTON_TYPE_MAP_ROUTING] = bind(&DrapeGui::CallOnButtonPressedHandler,
|
||||
&DrapeGui::Instance(),
|
||||
CountryStatusHelper::BUTTON_TYPE_MAP_ROUTING);
|
||||
|
||||
handlers[CountryStatusHelper::BUTTON_TRY_AGAIN] = bind(&DrapeGui::CallOnButtonPressedHandler,
|
||||
&DrapeGui::Instance(),
|
||||
CountryStatusHelper::BUTTON_TRY_AGAIN);
|
||||
RegisterButtonHandler(handlers, CountryStatusHelper::BUTTON_TYPE_MAP);
|
||||
RegisterButtonHandler(handlers, CountryStatusHelper::BUTTON_TYPE_MAP_ROUTING);
|
||||
RegisterButtonHandler(handlers, CountryStatusHelper::BUTTON_TRY_AGAIN);
|
||||
|
||||
renderer->AddShapeRenderer(Skin::CountryStatus, countryStatus.Draw(textures, handlers));
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ class Shape
|
|||
{
|
||||
public:
|
||||
Shape(gui::Position const & position) : m_position(position) {}
|
||||
using TTapHandler = function<void()>;
|
||||
|
||||
protected:
|
||||
gui::Position m_position;
|
||||
|
|
Loading…
Add table
Reference in a new issue