[core] Minor methods added to GuidesManager.

This commit is contained in:
Daria Volvenkova 2020-04-21 15:46:08 +03:00 committed by Arsentiy Milchakov
parent 6cd2d79c5b
commit 2aec2a588f
2 changed files with 25 additions and 0 deletions

View file

@ -20,6 +20,25 @@ void GuidesManager::Invalidate()
// TODO: Implement.
}
void GuidesManager::SetEnabled(bool enabled)
{
ChangeState(enabled ? GuidesState::Enabled : GuidesState::Disabled);
}
bool GuidesManager::IsEnabled() const
{
return m_state != GuidesState::Disabled;
}
void GuidesManager::ChangeState(GuidesState newState)
{
if (m_state == newState)
return;
m_state = newState;
if (m_onStateChangedFn != nullptr)
m_onStateChangedFn(newState);
}
GuidesManager::GuidesGallery GuidesManager::GetGallery() const
{
// TODO: Implement.

View file

@ -28,6 +28,9 @@ public:
void UpdateViewport(ScreenBase const & screen);
void Invalidate();
void SetEnabled(bool enabled);
bool IsEnabled() const;
struct GuidesGallery
{
struct Item
@ -60,6 +63,7 @@ public:
std::string m_title;
std::string m_subTitle;
Type m_type = Type::City;
bool m_downloaded = false;
boost::optional<CityParams> m_cityParams;
boost::optional<OutdoorParams> m_outdoorsParams;
};
@ -75,6 +79,8 @@ public:
void SetGalleryListener(GuidesGalleryChangedFn const & onGalleryChangedFn);
private:
void ChangeState(GuidesState newState);
GuidesState m_state = GuidesState::Disabled;
GuidesStateChangedFn m_onStateChangedFn;
GuidesGalleryChangedFn m_onGalleryChangedFn;