diff options
author | vng <viktor.govako@gmail.com> | 2014-09-06 13:54:20 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:26:10 +0300 |
commit | d9ca6e56ef92b248221b66ab0f79437c573c469b (patch) | |
tree | 830f5d1ce26c3a0289fc2d8e7cfa04071d816c1c /map/country_status_display.hpp | |
parent | 573e647de3a22282d0e993c30ffa05f4075c1e93 (diff) |
Minor refactoring of InformationDisplay:
- remove useless class data
- do not recalculate layout on every frame draw; do it when size changed only
- use unique_ptr instead of shared_ptr
- remove useless includes
Diffstat (limited to 'map/country_status_display.hpp')
-rw-r--r-- | map/country_status_display.hpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/map/country_status_display.hpp b/map/country_status_display.hpp index 9278bc1c30..b868fb87d3 100644 --- a/map/country_status_display.hpp +++ b/map/country_status_display.hpp @@ -4,11 +4,15 @@ #include "../gui/element.hpp" #include "../gui/button.hpp" -#include "../gui/text_view.hpp" -#include "../std/shared_ptr.hpp" +#include "../std/unique_ptr.hpp" +namespace gui +{ + class TextView; +} + /// This class is a composite GUI element to display /// an on-screen GUI for the country, which is not downloaded yet. class CountryStatusDisplay : public gui::Element @@ -29,9 +33,9 @@ private: void UpdateStatusAndProgress(); /// download button - shared_ptr<gui::Button> m_downloadButton; + unique_ptr<gui::Button> m_downloadButton; /// country status message - shared_ptr<gui::TextView> m_statusMsg; + unique_ptr<gui::TextView> m_statusMsg; /// current map name, "Province" part of the fullName string m_mapName; /// current map group name, "Country" part of the fullName @@ -45,14 +49,8 @@ private: bool m_notEnoughSpace; - /// bounding rects mutable vector<m2::AnyRectD> m_boundRects; - /// caching resources for fast rendering. - void cache(); - void purge(); - void layout(); - string const displayName() const; template <class T1, class T2> @@ -75,20 +73,22 @@ public: void setDownloadListener(gui::Button::TOnClickListener const & l); /// set current country name void setCountryIndex(storage::TIndex const & idx); - /// reposition element + + /// @name Override from graphics::OverlayElement and gui::Element. + //@{ void setPivot(m2::PointD const & pv); - /// attach element to controller. - void setController(gui::Controller *controller); - /// render element void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; - /// get bounding rects vector<m2::AnyRectD> const & boundRects() const; - /// react on touch events - /// @{ + void cache(); + void purge(); + void layout(); + + void setController(gui::Controller * controller); + bool onTapStarted(m2::PointD const & pt); bool onTapMoved(m2::PointD const & pt); bool onTapEnded(m2::PointD const & pt); bool onTapCancelled(m2::PointD const & pt); - /// @} + //@} }; |