diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2015-08-08 15:34:51 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2015-11-30 16:09:58 +0300 |
commit | 6bb2c1849339f609b6851f062c41c9f623b595f4 (patch) | |
tree | c9ebfeef74dd7448ee738326dfec04c9ba92d831 /gui | |
parent | 5a2338b96ee9919ceff49a042d517558f56d3d70 (diff) |
[drape] rebase fixes
Diffstat (limited to 'gui')
-rw-r--r-- | gui/button.cpp | 215 | ||||
-rw-r--r-- | gui/button.hpp | 84 | ||||
-rw-r--r-- | gui/cached_text_view.cpp | 155 | ||||
-rw-r--r-- | gui/cached_text_view.hpp | 63 | ||||
-rw-r--r-- | gui/controller.cpp | 254 | ||||
-rw-r--r-- | gui/controller.hpp | 137 | ||||
-rw-r--r-- | gui/display_list_cache.cpp | 97 | ||||
-rw-r--r-- | gui/display_list_cache.hpp | 53 | ||||
-rw-r--r-- | gui/element.cpp | 124 | ||||
-rw-r--r-- | gui/element.hpp | 96 | ||||
-rw-r--r-- | gui/gui.pro | 27 | ||||
-rw-r--r-- | gui/gui_tests/gui_tests.cpp | 165 | ||||
-rw-r--r-- | gui/gui_tests/gui_tests.pro | 20 | ||||
-rw-r--r-- | gui/image_view.cpp | 81 | ||||
-rw-r--r-- | gui/image_view.hpp | 47 | ||||
-rw-r--r-- | gui/text_view.cpp | 145 | ||||
-rw-r--r-- | gui/text_view.hpp | 57 |
17 files changed, 0 insertions, 1820 deletions
diff --git a/gui/button.cpp b/gui/button.cpp deleted file mode 100644 index f67b2e29b5..0000000000 --- a/gui/button.cpp +++ /dev/null @@ -1,215 +0,0 @@ -#include "gui/button.hpp" -#include "gui/controller.hpp" - -#include "graphics/screen.hpp" -#include "graphics/display_list.hpp" - -#include "geometry/transformations.hpp" - - -namespace gui -{ - Button::Params::Params() - : m_minWidth(10), - m_minHeight(10) - {} - - Button::Button(Params const & p) : Element(p) - { - TextView::Params tp; - - tp.m_depth = p.m_depth + 1; - tp.m_pivot = p.m_pivot; - tp.m_position = graphics::EPosCenter; - tp.m_text = p.m_text; - - m_textView.reset(new TextView(tp)); - - setMinWidth(p.m_minWidth); - setMinHeight(p.m_minHeight); - setText(p.m_text); - - setFont(EActive, graphics::FontDesc(12, graphics::Color(0, 0, 0, 255))); - setFont(EPressed, graphics::FontDesc(12, graphics::Color(0, 0, 0, 255))); - - setColor(EActive, graphics::Color(graphics::Color(192, 192, 192, 255))); - setColor(EPressed, graphics::Color(graphics::Color(64, 64, 64, 255))); - } - - void Button::setOnClickListener(TOnClickListener const & l) - { - m_OnClickListener = l; - } - - bool Button::onTapStarted(m2::PointD const & pt) - { - setState(EPressed); - invalidate(); - return false; - } - - bool Button::onTapCancelled(m2::PointD const & pt) - { - setState(EActive); - invalidate(); - return false; - } - - bool Button::onTapEnded(m2::PointD const & pt) - { - setState(EActive); - if (m_OnClickListener) - m_OnClickListener(this); - invalidate(); - return false; - } - - bool Button::onTapMoved(m2::PointD const & pt) - { - invalidate(); - return false; - } - - void Button::setText(string const & text) - { - m_textView->setText(text); - } - - string const & Button::text() const - { - return m_textView->text(); - } - - void Button::setMinWidth(unsigned minWidth) - { - m_minWidth = minWidth; - invalidate(); - } - - unsigned Button::minWidth() const - { - return m_minWidth; - } - - void Button::setMinHeight(unsigned minHeight) - { - m_minHeight = minHeight; - invalidate(); - } - - unsigned Button::minHeight() const - { - return m_minHeight; - } - - void Button::setController(Controller *controller) - { - m_textView->setController(controller); - Element::setController(controller); - } - - void Button::cacheButtonBody(EState state) - { - double const k = visualScale(); - m2::RectD const rr = GetBoundRect(); - - graphics::Screen * cs = m_controller->GetCacheScreen(); - - cs->beginFrame(); - - unique_ptr<graphics::DisplayList> & dl = m_dls[state]; - - dl.reset(); - dl.reset(cs->createDisplayList()); - - cs->setDisplayList(dl.get()); - - cs->drawRoundedRectangle(m2::RectD(-rr.SizeX() / 2, - -rr.SizeY() / 2, - rr.SizeX() / 2, - rr.SizeY() / 2), - 10 * k, color(state), depth()); - - cs->setDisplayList(0); - - cs->endFrame(); - } - - void Button::cache() - { - cacheButtonBody(EActive); - cacheButtonBody(EPressed); - } - - void Button::purge() - { - m_dls.clear(); - m_textView->purge(); - } - - void Button::layout() - { - m_textView->setIsDirtyLayout(true); - } - - m2::RectD Button::GetBoundRect() const - { - double const k = visualScale(); - - m2::RectD tr(m_textView->GetBoundRect()); - m2::RectD rc(0, 0, tr.SizeX(), tr.SizeY()); - - rc.Inflate(15 * k, 5 * k); - - double dx = 0; - double dy = 0; - - if (rc.SizeX() < m_minWidth * k) - dx = (m_minWidth * k - rc.SizeX()) / 2; - if (rc.SizeY() < m_minHeight * k) - dy = (m_minHeight * k - rc.SizeY()) / 2; - - rc.Inflate(dx, dy); - rc.Offset(-rc.minX(), -rc.minY()); - - m2::PointD pt = computeTopLeft(m2::PointD(rc.SizeX(), rc.SizeY()), - pivot(), - position()); - - rc.Offset(pt); - - return rc; - } - - void Button::draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const - { - if (isVisible()) - { - checkDirtyLayout(); - - math::Matrix<double, 3, 3> const drawM = math::Shift(math::Identity<double, 3>(), pivot()); - - r->drawDisplayList(m_dls.at(state()).get(), drawM * m); - - m_textView->draw(r, m); - } - } - - void Button::setPivot(m2::PointD const & pv, bool dirtyFlag) - { - m_textView->setPivot(pv, dirtyFlag); - Element::setPivot(pv, dirtyFlag); - } - - void Button::setFont(EState state, graphics::FontDesc const & font) - { - m_textView->setFont(state, font); - Element::setFont(state, font); - } - - void Button::setColor(EState state, graphics::Color const & c) - { - m_textView->setColor(state, c); - Element::setColor(state, c); - } -} diff --git a/gui/button.hpp b/gui/button.hpp deleted file mode 100644 index c9f44082b3..0000000000 --- a/gui/button.hpp +++ /dev/null @@ -1,84 +0,0 @@ -#pragma once - -#include "gui/element.hpp" -#include "gui/text_view.hpp" - -#include "std/function.hpp" -#include "std/string.hpp" -#include "std/unique_ptr.hpp" - - -namespace graphics -{ - class OverlayElement; - class DisplayList; - - namespace gl - { - class OverlayRenderer; - } -} - -namespace gui -{ - class Button : public Element - { - public: - typedef function<void (Element const *)> TOnClickListener; - - private: - TOnClickListener m_OnClickListener; - - unsigned m_minWidth; - unsigned m_minHeight; - - unique_ptr<TextView> m_textView; - map<EState, unique_ptr<graphics::DisplayList> > m_dls; - - void cacheButtonBody(EState state); - - public: - struct Params : Element::Params - { - unsigned m_minWidth; - unsigned m_minHeight; - string m_text; - Params(); - }; - - Button(Params const & p); - - void setOnClickListener(TOnClickListener const & l); - - void setFont(EState state, graphics::FontDesc const & font); - void setColor(EState state, graphics::Color const & c); - - void setText(string const & text); - string const & text() const; - - void setMinWidth(unsigned minWidthInDIP); - unsigned minWidth() const; - - void setMinHeight(unsigned minHeightInDIP); - unsigned minHeight() const; - - /// @name Override from graphics::OverlayElement and gui::Element. - //@{ - virtual m2::RectD GetBoundRect() const; - - void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; - void setPivot(m2::PointD const & pv, bool dirtyFlag = true); - - void purge(); - void layout(); - void cache(); - - void setController(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); - //@} - }; -} diff --git a/gui/cached_text_view.cpp b/gui/cached_text_view.cpp deleted file mode 100644 index 419a4a06c7..0000000000 --- a/gui/cached_text_view.cpp +++ /dev/null @@ -1,155 +0,0 @@ -#include "gui/cached_text_view.hpp" -#include "gui/controller.hpp" - -#include "geometry/transformations.hpp" - -#include "graphics/glyph.hpp" -#include "graphics/screen.hpp" -#include "graphics/display_list.hpp" -#include "graphics/glyph_layout.hpp" - - -using namespace graphics; - -namespace gui -{ - CachedTextView::CachedTextView(Params const & p) - : Element(p) - , m_isAnimated(false) - { - setText(p.m_text); - - setFont(EActive, FontDesc(12, Color(0, 0, 0, 255))); - setFont(EPressed, FontDesc(12, Color(0, 0, 0, 255))); - - setColor(EActive, Color(Color(192, 192, 192, 255))); - setColor(EPressed, Color(Color(64, 64, 64, 255))); - } - - void CachedTextView::setText(string const & text) - { - strings::UniString const uText = strings::MakeUniString(text); - if (uText != m_uniText) - { - m_uniText = uText; - setIsDirtyLayout(true); - } - } - - void CachedTextView::setAnimated(TAlfaGetterFn const & fn) - { - m_isAnimated = true; - m_alfaGetter = fn; - } - - void CachedTextView::setFont(EState state, FontDesc const & desc) - { - setIsDirtyLayout(true); - Element::setFont(state, desc); - } - - void CachedTextView::GetMiniBoundRects(RectsT & rects) const - { - rects.resize(m_layout->boundRects().size()); - copy(m_layout->boundRects().begin(), - m_layout->boundRects().end(), - back_inserter(rects)); - } - - void CachedTextView::draw(OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const - { - if (isVisible()) - { - checkDirtyLayout(); - - math::Matrix<double, 3, 3> id = math::Identity<double, 3>(); - UniformsHolder holder; - UniformsHolder * drawHolder = NULL; - - if (m_isAnimated) - { - r->applyVarAlfaStates(); - drawHolder = &holder; - ASSERT(m_alfaGetter, ()); - drawHolder->insertValue(graphics::ETransparency, m_alfaGetter()); - } - - if (m_maskedLayout) - for (size_t i = 0; i < m_uniText.size(); ++i) - r->drawDisplayList(m_maskedDls[i].get(), - math::Shift(id, m_maskedLayout->entries()[i].m_pt + m_maskedLayout->pivot()), - drawHolder); - - for (size_t i = 0; i < m_uniText.size(); ++i) - r->drawDisplayList(m_dls[i].get(), - math::Shift(id, m_layout->entries()[i].m_pt + m_layout->pivot()), - drawHolder); - } - } - - void CachedTextView::cache() - { - DisplayListCache * dlc = m_controller->GetDisplayListCache(); - FontDesc fontDesc = font(EActive); - - if (fontDesc.m_isMasked) - { - m_maskedDls.resize(m_uniText.size()); - for (size_t i = 0; i < m_uniText.size(); ++i) - m_maskedDls[i] = dlc->FindGlyph(GlyphKey(m_uniText[i], - fontDesc.m_size, - fontDesc.m_isMasked, - fontDesc.m_isMasked ? fontDesc.m_maskColor : fontDesc.m_color)); - - fontDesc.m_isMasked = false; - } - - m_dls.resize(m_uniText.size()); - - for (size_t i = 0; i < m_uniText.size(); ++i) - m_dls[i] = dlc->FindGlyph(GlyphKey(m_uniText[i], - fontDesc.m_size, - fontDesc.m_isMasked, - fontDesc.m_color)); - } - - void CachedTextView::purge() - { - m_maskedDls.clear(); - m_dls.clear(); - } - - void CachedTextView::layout() - { - if (m_uniText.empty()) - return; - - FontDesc fontDesc = font(EActive); - - if (fontDesc.m_isMasked) - { - m_maskedLayout.reset(new GlyphLayout(m_controller->GetGlyphCache(), - fontDesc, - pivot(), - m_uniText, - position())); - fontDesc.m_isMasked = false; - } - - m_layout.reset(new GlyphLayout(m_controller->GetGlyphCache(), - fontDesc, - pivot(), - m_uniText, - position())); - } - - void CachedTextView::setPivot(m2::PointD const & pv, bool dirtyFlag) - { - Element::setPivot(pv, dirtyFlag); - - if (m_maskedLayout) - m_maskedLayout->setPivot(pivot()); - if (m_layout) - m_layout->setPivot(pivot()); - } -} diff --git a/gui/cached_text_view.hpp b/gui/cached_text_view.hpp deleted file mode 100644 index 2fe1b6410d..0000000000 --- a/gui/cached_text_view.hpp +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include "gui/element.hpp" - -#include "base/string_utils.hpp" -#include "base/matrix.hpp" - -#include "std/vector.hpp" -#include "std/shared_ptr.hpp" -#include "std/unique_ptr.hpp" -#include "std/function.hpp" - - -namespace graphics -{ - class DisplayList; - class GlyphLayout; -} - -namespace gui -{ - class CachedTextView : public Element - { - strings::UniString m_uniText; - - vector<shared_ptr<graphics::DisplayList> > m_dls; - vector<shared_ptr<graphics::DisplayList> > m_maskedDls; - - unique_ptr<graphics::GlyphLayout> m_layout; - unique_ptr<graphics::GlyphLayout> m_maskedLayout; - - public: - struct Params : public Element::Params - { - string m_text; - }; - - CachedTextView(Params const & p); - - void setText(string const & text); - - typedef function<float ()> TAlfaGetterFn; - void setAnimated(TAlfaGetterFn const & fn); - - /// @name Overrider from graphics::OverlayElement and gui::Element. - //@{ - virtual void GetMiniBoundRects(RectsT & rects) const; - void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; - - void cache(); - void purge(); - void layout(); - - void setFont(EState state, graphics::FontDesc const & desc); - - void setPivot(m2::PointD const & pv, bool dirtyFlag = true); - //@} - - private: - bool m_isAnimated; - TAlfaGetterFn m_alfaGetter; - }; -} diff --git a/gui/controller.cpp b/gui/controller.cpp deleted file mode 100644 index de505984cc..0000000000 --- a/gui/controller.cpp +++ /dev/null @@ -1,254 +0,0 @@ -#include "gui/controller.hpp" -#include "gui/element.hpp" - -#include "graphics/screen.hpp" - -#include "std/bind.hpp" - - -namespace gui -{ - Controller::RenderParams::RenderParams() - : m_Density(graphics::EDensityMDPI), m_exactDensityDPI(0), m_GlyphCache(0) - {} - - Controller::Controller() - : m_Density(graphics::EDensityMDPI), m_GlyphCache(0) - {} - - Controller::RenderParams::RenderParams(graphics::EDensity density, - int exactDensityDPI, - TInvalidateFn invalidateFn, - graphics::GlyphCache * glyphCache, - graphics::Screen * cacheScreen) - : m_Density(density), - m_exactDensityDPI(exactDensityDPI), - m_InvalidateFn(invalidateFn), - m_GlyphCache(glyphCache), - m_CacheScreen(cacheScreen) - {} - - Controller::~Controller() - {} - - shared_ptr<Element> Controller::SelectTopElement(m2::PointD const & pt, bool onlyVisible) const - { - shared_ptr<Element> res; - - for (ElemsT::const_iterator it = m_Elements.begin(); it != m_Elements.end(); ++it) - { - shared_ptr<gui::Element> const & e = *it; - if ((!onlyVisible || e->isVisible()) && e->hitTest(pt)) - { - if (!res || e->depth() > res->depth()) - res = e; - } - } - - return res; - } - - bool Controller::OnTapStarted(m2::PointD const & pt) - { - if (GetCacheScreen() == nullptr) - return false; - - shared_ptr<Element> e = SelectTopElement(pt, true); - if (e) - { - m_focusedElement = e; - m_focusedElement->onTapStarted(pt); - m_LastTapCancelled = false; - return true; - } - - return false; - } - - bool Controller::OnTapMoved(m2::PointD const & pt) - { - if (GetCacheScreen() == nullptr) - return false; - - if (m_focusedElement) - { - if (!m_LastTapCancelled) - { - if (!m_focusedElement->hitTest(pt)) - { - m_focusedElement->onTapCancelled(pt); - m_LastTapCancelled = true; - } - else - m_focusedElement->onTapMoved(pt); - } - - // event handled - return true; - } - - return false; - } - - bool Controller::OnTapEnded(m2::PointD const & pt) - { - if (GetCacheScreen() == nullptr) - return false; - - if (m_focusedElement) - { - // re-checking, whether we are above the gui element. - if (!m_LastTapCancelled) - { - if (!m_focusedElement->hitTest(pt)) - { - m_focusedElement->onTapCancelled(pt); - m_LastTapCancelled = true; - } - else - m_focusedElement->onTapEnded(pt); - } - - m_focusedElement.reset(); - m_LastTapCancelled = false; - - return true; - } - - return false; - } - - bool Controller::OnTapCancelled(m2::PointD const & pt) - { - if (GetCacheScreen() == nullptr) - return false; - - if (m_focusedElement) - { - m_focusedElement->onTapCancelled(pt); - m_focusedElement.reset(); - return true; - } - - return false; - } - - void Controller::RemoveElement(shared_ptr<Element> const & e) - { - ElemsT::iterator it = find(m_Elements.begin(), m_Elements.end(), e); - - if (it != m_Elements.end()) - m_Elements.erase(it); - - e->setController(0); - } - - void Controller::AddElement(shared_ptr<Element> const & e) - { - e->setController(this); - m_Elements.push_back(e); - } - - double Controller::GetVisualScale() const - { - return m_VisualScale; - } - - graphics::EDensity Controller::GetDensity() const - { - return m_Density; - } - - void Controller::SetRenderParams(RenderParams const & p) - { - m_GlyphCache = p.m_GlyphCache; - m_InvalidateFn = p.m_InvalidateFn; - m_Density = p.m_Density; - m_VisualScale = graphics::visualScaleExact(p.m_exactDensityDPI); - m_CacheScreen = p.m_CacheScreen; - - m_DisplayListCache.reset(new DisplayListCache(m_CacheScreen, m_GlyphCache)); - - LayoutElements(); - } - - void Controller::ResetRenderParams() - { - m_GlyphCache = 0; - m_Density = graphics::EDensityLDPI; - m_InvalidateFn = TInvalidateFn(); - m_CacheScreen = nullptr; - - PurgeElements(); - - m_DisplayListCache.reset(); - } - - void Controller::DrawFrame(graphics::Screen * screen) - { - if (m_CacheScreen == nullptr) - return; - - screen->beginFrame(); - - math::Matrix<double, 3, 3> const m = math::Identity<double, 3>(); - for (auto const & element : m_Elements) - element->draw(screen, m); - - screen->endFrame(); - } - - void Controller::Invalidate() - { - if (m_InvalidateFn) - m_InvalidateFn(); - } - - graphics::GlyphCache * Controller::GetGlyphCache() const - { - return m_GlyphCache; - } - - void Controller::SetStringsBundle(StringsBundle const * bundle) - { - m_bundle = bundle; - for (auto const & element : m_Elements) - element->setIsDirtyLayout(true); - } - - StringsBundle const * Controller::GetStringsBundle() const - { - return m_bundle; - } - - graphics::Screen * Controller::GetCacheScreen() const - { - return m_CacheScreen; - } - - DisplayListCache * Controller::GetDisplayListCache() const - { - return m_DisplayListCache.get(); - } - - void Controller::UpdateElements() - { - for (auto const & element : m_Elements) - element->update(); - } - - void Controller::PurgeElements() - { - for (auto const & element : m_Elements) - { - element->purge(); - element->setIsDirtyLayout(true); - } - } - - void Controller::LayoutElements() - { - for (auto const & element : m_Elements) - element->checkDirtyLayout(); - } -} diff --git a/gui/controller.hpp b/gui/controller.hpp deleted file mode 100644 index 8c51189d8f..0000000000 --- a/gui/controller.hpp +++ /dev/null @@ -1,137 +0,0 @@ -#pragma once - -#include "gui/display_list_cache.hpp" - -#include "graphics/defines.hpp" - -#include "geometry/point2d.hpp" - -#include "base/strings_bundle.hpp" - -#include "std/shared_ptr.hpp" -#include "std/unique_ptr.hpp" -#include "std/function.hpp" -#include "std/list.hpp" - - -namespace graphics -{ - class GlyphCache; - class Screen; -} - -namespace gui -{ - class Element; - - /// Controller for GUI elements, which tracks mouse, keyboard and - /// touch user interactions into interactions with GUI elements. - class Controller - { - public: - - /// Invalidate functor type - typedef function<void()> TInvalidateFn; - - struct RenderParams - { - graphics::EDensity m_Density; - int m_exactDensityDPI; - TInvalidateFn m_InvalidateFn; - graphics::GlyphCache * m_GlyphCache; - graphics::Screen * m_CacheScreen; - RenderParams(); - RenderParams(graphics::EDensity density, - int exactDensityDPI, - TInvalidateFn invalidateFn, - graphics::GlyphCache * glyphCache, - graphics::Screen * cacheScreen); - }; - - private: - - /// Element that has focus. - shared_ptr<Element> m_focusedElement; - - typedef list<shared_ptr<Element> > ElemsT; - - ElemsT m_Elements; - - /// Select top element under specified point for tap processing. - shared_ptr<Element> SelectTopElement(m2::PointD const & pt, bool onlyVisible) const; - - /// Invalidate GUI function - TInvalidateFn m_InvalidateFn; - - /// Screen density - graphics::EDensity m_Density; - - /// VisualScale to multiply all Device-Independent-Pixels dimensions. - double m_VisualScale; - - /// GlyphCache for text rendering by GUI elements. - graphics::GlyphCache * m_GlyphCache; - - /// Cache for display lists for fast rendering on GUI thread - unique_ptr<DisplayListCache> m_DisplayListCache; - - /// Localized strings for GUI. - StringsBundle const * m_bundle; - - /// Screen, which is used to cache gui::Elements into display lists. - graphics::Screen * m_CacheScreen = nullptr; - - /// Should we call the onTapEnded when the tap finished(we should - /// not if the tap was cancelled while moving). - bool m_LastTapCancelled; - - public: - - /// Constructor with GestureDetector to route events from. - Controller(); - /// Destructor - virtual ~Controller(); - - /// Handlers to be called from the client code to power up the GUI. - /// @{ - bool OnTapStarted(m2::PointD const & pt); - bool OnTapMoved(m2::PointD const & pt); - bool OnTapEnded(m2::PointD const & pt); - bool OnTapCancelled(m2::PointD const & pt); - /// @} - - /// Attach GUI Controller to the renderer - void SetRenderParams(RenderParams const & p); - /// Set the bundle with localized strings - void SetStringsBundle(StringsBundle const * bundle); - /// Detach GUI Controller from the renderer - void ResetRenderParams(); - /// Invalidate the scene - void Invalidate(); - /// Remove GUI element by pointer - void RemoveElement(shared_ptr<Element> const & e); - /// Add GUI element to the controller - void AddElement(shared_ptr<Element> const & e); - /// Get VisualScale parameter - double GetVisualScale() const; - /// Get Density parameter - graphics::EDensity GetDensity() const; - /// Get localized strings bundle - StringsBundle const * GetStringsBundle() const; - /// Get GlyphCache - graphics::GlyphCache * GetGlyphCache() const; - /// Get graphics::Screen, which is used to cache gui::Element's - /// into display lists. - graphics::Screen * GetCacheScreen() const; - /// Get display list cache - DisplayListCache * GetDisplayListCache() const; - /// Redraw GUI - void DrawFrame(graphics::Screen * screen); - /// Calling gui::Element::update for every element. - void UpdateElements(); - /// Calling gui::Element::purge for every element. - void PurgeElements(); - /// Calling gui::Element::performLayout for every element - void LayoutElements(); - }; -} diff --git a/gui/display_list_cache.cpp b/gui/display_list_cache.cpp deleted file mode 100644 index 353a84c742..0000000000 --- a/gui/display_list_cache.cpp +++ /dev/null @@ -1,97 +0,0 @@ -#include "gui/display_list_cache.hpp" - -#include "graphics/screen.hpp" -#include "graphics/display_list.hpp" -#include "graphics/glyph.hpp" -#include "graphics/depth_constants.hpp" - - -using namespace graphics; - -namespace gui -{ - DisplayListCache::DisplayListCache(Screen * CacheScreen, - GlyphCache * GlyphCache) - : m_CacheScreen(CacheScreen), - m_GlyphCache(GlyphCache) - {} - - shared_ptr<DisplayList> const & DisplayListCache::FindGlyph(GlyphKey const & key) - { - TGlyphs::const_iterator it = m_Glyphs.find(key); - - if (it != m_Glyphs.end()) - return it->second; - - shared_ptr<DisplayList> & dl = m_Glyphs[key]; - - dl.reset(m_CacheScreen->createDisplayList()); - - m_CacheScreen->beginFrame(); - m_CacheScreen->setDisplayList(dl.get()); - - uint32_t resID = m_CacheScreen->mapInfo(Glyph::Info(key, m_GlyphCache)); - Resource const * res = m_CacheScreen->fromID(resID); - - ASSERT(res->m_cat == Resource::EGlyph, ()); - Glyph const * glyph = static_cast<Glyph const *>(res); - - m_CacheScreen->drawGlyph(m2::PointD(0, 0), m2::PointD(0, 0), ang::AngleD(0), 0, glyph, maxDepth - 10); - - m_CacheScreen->setDisplayList(0); - m_CacheScreen->endFrame(); - - return dl; - } - - void DisplayListCache::TouchGlyph(GlyphKey const & key) - { - FindGlyph(key); - } - - bool DisplayListCache::HasGlyph(GlyphKey const & key) - { - return m_Glyphs.find(key) != m_Glyphs.end(); - } - - /* - void DisplayListCache::TouchSymbol(char const * name) - { - FindSymbol(name); - } - - bool DisplayListCache::HasSymbol(char const * name) - { - return m_Symbols.find(name) != m_Symbols.end(); - } - - shared_ptr<DisplayList> const & DisplayListCache::FindSymbol(char const * name) - { - string s(name); - TSymbols::const_iterator it = m_Symbols.find(s); - - if (it != m_Symbols.end()) - return it->second; - - shared_ptr<DisplayList> & dl = m_Symbols[s]; - - dl.reset(m_CacheScreen->createDisplayList()); - - m_CacheScreen->beginFrame(); - m_CacheScreen->setDisplayList(dl.get()); - - EPosition pos = EPosAbove; - if (s == "search-result") - pos = EPosCenter; - - /// @todo do not cache depth in display list. use separate vertex shader and uniform constant - /// to specify it while rendering display list. - m_CacheScreen->drawSymbol(m2::PointD(0, 0), name, pos, poiDepth); - - m_CacheScreen->setDisplayList(0); - m_CacheScreen->endFrame(); - - return dl; - } - */ -} diff --git a/gui/display_list_cache.hpp b/gui/display_list_cache.hpp deleted file mode 100644 index a88f1137d6..0000000000 --- a/gui/display_list_cache.hpp +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - - -#include "graphics/glyph_cache.hpp" - -#include "std/shared_ptr.hpp" - - -namespace graphics -{ - class Screen; - class DisplayList; -} - -namespace gui -{ - class DisplayListCache - { - private: - - /// Screen, which should be used for caching - graphics::Screen * m_CacheScreen; - /// GlyphCache, which should be used for caching - graphics::GlyphCache * m_GlyphCache; - /// Actual cache of glyphs as a display lists - typedef map<graphics::GlyphKey, shared_ptr<graphics::DisplayList> > TGlyphs; - TGlyphs m_Glyphs; - - typedef map<string, shared_ptr<graphics::DisplayList> > TSymbols; - TSymbols m_Symbols; - - public: - - DisplayListCache(graphics::Screen * CacheScreen, - graphics::GlyphCache * GlyphCache); - - /// Add element to cache if needed - void TouchGlyph(graphics::GlyphKey const & key); - /// Find glyph in cache, caching if needed. - shared_ptr<graphics::DisplayList> const & FindGlyph(graphics::GlyphKey const & key); - /// Check, whether the glyph is present in cache. - bool HasGlyph(graphics::GlyphKey const & key); - - /* - /// Add symbol to cache if needed - void TouchSymbol(char const * name); - /// Find symbol in cache, caching if needed - shared_ptr<graphics::DisplayList> const & FindSymbol(char const * name); - /// Check, whether the display list for specified symbol is present in cache - bool HasSymbol(char const * name); - */ - }; -} diff --git a/gui/element.cpp b/gui/element.cpp deleted file mode 100644 index 8e55a03f22..0000000000 --- a/gui/element.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "gui/element.hpp" -#include "gui/controller.hpp" - -#include "base/logging.hpp" - - -namespace gui -{ - Element::Element(Params const & p) - : OverlayElement(p), - m_controller(0), - m_state(EActive) - {} - - void Element::setState(EState state) - { - m_state = state; - } - - Element::EState Element::state() const - { - return m_state; - } - - void Element::setFont(EState state, graphics::FontDesc const & font) - { - m_fonts[state] = font; - } - - graphics::FontDesc const & Element::font(EState state) const - { - return m_fonts[state]; - } - - void Element::setColor(EState state, graphics::Color const & c) - { - m_colors[state] = c; - } - - graphics::Color const & Element::color(EState state) const - { - return m_colors[state]; - } - - void Element::invalidate() - { - if (m_controller) - m_controller->Invalidate(); - else - LOG(LDEBUG/*LWARNING*/, ("unattached gui::Element couldn't be invalidated!")); - } - - double Element::visualScale() const - { - if (m_controller) - return m_controller->GetVisualScale(); - else - { - LOG(LDEBUG/*LWARNING*/, ("unattached gui::Elements shouldn't call gui::Element::visualScale function")); - return 0.0; - } - } - - void Element::cache() - {} - - void Element::purge() - {} - - void Element::update() - {} - - void Element::layout() - {} - - void Element::checkDirtyLayout() const - { - if (isDirtyLayout()) - { - const_cast<Element*>(this)->layout(); - const_cast<Element*>(this)->cache(); - setIsDirtyLayout(false); - } - } - - void Element::draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const &) const - { - DrawRectsDebug(r, color(state()), depth()); - } - - double Element::priority() const - { - 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; - } - - void Element::setTransformation(const math::Matrix<double, 3, 3> & /*m*/) - { - } -} diff --git a/gui/element.hpp b/gui/element.hpp deleted file mode 100644 index 1e3416e1e0..0000000000 --- a/gui/element.hpp +++ /dev/null @@ -1,96 +0,0 @@ -#pragma once - -#include "graphics/overlay_element.hpp" -#include "graphics/color.hpp" -#include "graphics/font_desc.hpp" - -#include "std/map.hpp" - - -namespace graphics -{ - namespace gl - { - class OverlayRenderer; - } -} - -namespace gui -{ - class Controller; - - class Element : public graphics::OverlayElement - { - public: - enum EState - { - EInactive = 0, - EActive, - EPressed, - ESelected - }; - - protected: - Controller * m_controller; - - private: - EState m_state; - - mutable map<EState, graphics::FontDesc> m_fonts; - mutable map<EState, graphics::Color> m_colors; - - public: - typedef OverlayElement::Params Params; - - Element(Params const & p); - - void setState(EState state); - EState state() const; - - virtual void setFont(EState state, graphics::FontDesc const & font); - graphics::FontDesc const & font(EState state) const; - - virtual void setColor(EState state, graphics::Color const & c); - graphics::Color const & color(EState state) const; - - /// Implement this method to handle single tap on the GUI element. - //@{ - 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); - //@} - - /// Invalidate the rendering system to redraw the gui elements. - void invalidate(); - /// obtain @see VisualScale - double visualScale() const; - - /// This method is called to cache visual appearance of gui::Element for fast rendering. - /// It should be called after layout() is calculated properly. - virtual void cache(); - /// This method is called upon renderPolicy destruction and should clean - /// all rendering-related resources, p.e. displayLists. - virtual void purge(); - /// This method is called in each frame and should be overriden if the - /// element wants to update it's internal state. - virtual void update(); - /// This method is called after gui::Controller::SetRenderParams to - /// perform layout calculations which might depends on RenderParams. - /// It should be called when isDirtyLayout is set to true (visual parameters of object is changed). - virtual void layout(); - /// Set the parent controller for this element. Should be called for all inner Elemen's too. - virtual void setController(Controller * controller); - - /// Check if the layout of element is dirty and re-layout element if needed. - /// Used in a "lazy" layout/cache strategy (called before actual drawing). - void checkDirtyLayout() const; - - /// @name Override from OverlayElement. - //@{ - void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; - double priority() const; - void setTransformation(const math::Matrix<double, 3, 3> & m); - //@} - }; -} diff --git a/gui/gui.pro b/gui/gui.pro deleted file mode 100644 index 725de88b88..0000000000 --- a/gui/gui.pro +++ /dev/null @@ -1,27 +0,0 @@ -# GUI library on top of Graphics - -TARGET = gui -TEMPLATE = lib -CONFIG += staticlib warn_on - -ROOT_DIR = .. - -include($$ROOT_DIR/common.pri) - -HEADERS += \ - controller.hpp\ - element.hpp \ - button.hpp \ - text_view.hpp \ - image_view.hpp \ - cached_text_view.hpp \ - display_list_cache.hpp - -SOURCES += \ - controller.cpp \ - element.cpp \ - button.cpp \ - text_view.cpp \ - image_view.cpp \ - cached_text_view.cpp \ - display_list_cache.cpp diff --git a/gui/gui_tests/gui_tests.cpp b/gui/gui_tests/gui_tests.cpp deleted file mode 100644 index 376414b4ac..0000000000 --- a/gui/gui_tests/gui_tests.cpp +++ /dev/null @@ -1,165 +0,0 @@ -#include "qt_tstfrm/gui_test_widget.hpp" - -#include "gui/button.hpp" -#include "gui/text_view.hpp" -#include "gui/image_view.hpp" -#include "gui/cached_text_view.hpp" - -#include "graphics/display_list.hpp" - -#include "map/country_status_display.hpp" -#include "map/framework.hpp" - - -struct ButtonTest -{ - shared_ptr<gui::Button> m_button; - - void Init(gui::Controller * c) - { - gui::Button::Params bp; - - bp.m_depth = graphics::maxDepth - 10; - bp.m_pivot = m2::PointD(200, 200); - bp.m_position = graphics::EPosAbove; - bp.m_text = "TestButton"; - bp.m_minWidth = 200; - bp.m_minHeight = 40; - - m_button.reset(new gui::Button(bp)); - - m_button->setFont(gui::Element::EActive, graphics::FontDesc(16, graphics::Color(255, 255, 255, 255))); - m_button->setFont(gui::Element::EPressed, graphics::FontDesc(16, graphics::Color(255, 255, 255, 255))); - - m_button->setColor(gui::Element::EActive, graphics::Color(graphics::Color(0, 0, 0, 0.6 * 255))); - m_button->setColor(gui::Element::EPressed, graphics::Color(graphics::Color(0, 0, 0, 0.4 * 255))); - - c->AddElement(m_button); - } - - void DoDraw(shared_ptr<graphics::Screen> const & p) - { - } -}; - -struct TextViewTest -{ - shared_ptr<gui::TextView> m_textView; - - void Init(gui::Controller * c) - { - gui::TextView::Params tp; - - tp.m_pivot = m2::PointD(100, 100); - tp.m_depth = graphics::maxDepth; - tp.m_position = graphics::EPosRight; - tp.m_text = "Simplicity is the ultimate"; - - m_textView.reset(new gui::TextView(tp)); - m_textView->setIsVisible(true); - - c->AddElement(m_textView); - } - - void DoDraw(shared_ptr<graphics::Screen> const & p) - { - } -}; - -struct CachedTextViewTest -{ - shared_ptr<gui::CachedTextView> m_cachedTextView; - - void Init(gui::Controller * c) - { - gui::CachedTextView::Params ctp; - - ctp.m_pivot = m2::PointD(100, 100); - ctp.m_depth = graphics::maxDepth; - ctp.m_position = graphics::EPosAbove; - ctp.m_text = "(123.15, 783.123)"; - - m_cachedTextView.reset(new gui::CachedTextView(ctp)); - m_cachedTextView->setIsVisible(true); - - m_cachedTextView->setFont(gui::Element::EActive, - graphics::FontDesc(20, graphics::Color(255, 0, 0, 255), true)); - - c->AddElement(m_cachedTextView); - } - - void DoDraw(shared_ptr<graphics::Screen> const & p) - { - } -}; - -struct ImageViewTest -{ - shared_ptr<gui::ImageView> m_imageView; - m2::PointD m_pivot; - - void Init(gui::Controller * c) - { - gui::ImageView::Params ip; - - m_pivot = m2::PointD(100, 100); - - ip.m_depth = graphics::maxDepth; - ip.m_pivot = m_pivot; - ip.m_position = graphics::EPosUnder; - - ip.m_image = graphics::Image::Info("arrow.png", graphics::EDensityMDPI); - - m_imageView.reset(new gui::ImageView(ip)); - - c->AddElement(m_imageView); - - m_imageView->setIsVisible(true); - } - - void DoDraw(shared_ptr<graphics::Screen> const & p) - { - m2::RectD r(m_pivot, m_pivot); - - r.Inflate(2, 2); - - p->drawRectangle(r, graphics::Color(255, 0, 0, 255), graphics::maxDepth); - } -}; - -struct CountryStatusDisplayTest -{ - shared_ptr<CountryStatusDisplay> m_countryStatus; - shared_ptr<Framework> m_framework; - m2::PointD m_pivot; - - void Init(gui::Controller * c) - { - CountryStatusDisplay::Params p(m_framework->GetCountryTree().GetActiveMapLayout()); - - m_pivot = m2::PointD(400, 400); - - m_framework.reset(new Framework()); - - ///@TODO (UVR) -// p.m_depth = graphics::maxDepth; -// p.m_pivot = m_pivot; -// p.m_position = graphics::EPosAboveLeft; - -// m_countryStatus.reset(new CountryStatusDisplay(p)); -// m_countryStatus->SetCountryIndex(storage::TIndex(1, 1, 1)); -// m_countryStatus->setPivot(m_pivot); -// c->AddElement(m_countryStatus); - } - - void DoDraw(shared_ptr<graphics::Screen> const & p) - { - } -}; - -//UNIT_TEST_GUI(ButtonTest); -//UNIT_TEST_GUI(TextViewTest); -//UNIT_TEST_GUI(ImageViewTest); -//UNIT_TEST_GUI(CachedTextViewTest); -//UNIT_TEST_GUI(CountryStatusDisplayTest); - diff --git a/gui/gui_tests/gui_tests.pro b/gui/gui_tests/gui_tests.pro deleted file mode 100644 index d2983b1e24..0000000000 --- a/gui/gui_tests/gui_tests.pro +++ /dev/null @@ -1,20 +0,0 @@ -TARGET = gui_tests -CONFIG += console warn_on -CONFIG -= app_bundle -TEMPLATE = app - -ROOT_DIR = ../.. -DEPENDENCIES = qt_tstfrm map gui indexer graphics storage platform geometry coding base \ - expat freetype fribidi protobuf tomcrypt jansson - -include($$ROOT_DIR/common.pri) - -QT *= opengl gui core - -win32*: LIBS *= -lopengl32 -macx-*: LIBS *= "-framework IOKit" - -SOURCES += \ - ../../testing/testingmain.cpp \ - gui_tests.cpp - diff --git a/gui/image_view.cpp b/gui/image_view.cpp deleted file mode 100644 index 6dec9261a9..0000000000 --- a/gui/image_view.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "gui/image_view.hpp" -#include "gui/controller.hpp" - -#include "graphics/screen.hpp" -#include "graphics/display_list.hpp" - -#include "geometry/transformations.hpp" - -#include "base/matrix.hpp" - - -namespace gui -{ - ImageView::Params::Params() - {} - - ImageView::ImageView(Params const & p) - : BaseT(p) - { - m_image = p.m_image; - } - - void ImageView::cache() - { - graphics::Screen * cs = m_controller->GetCacheScreen(); - - m_displayList.reset(); - m_displayList.reset(cs->createDisplayList()); - - cs->beginFrame(); - cs->setDisplayList(m_displayList.get()); - - math::Matrix<double, 3, 3> m = - math::Shift( - math::Identity<double, 3>(), - -(int)m_image.m_size.x / 2, -(int)m_image.m_size.y / 2); - - uint32_t const imageResID = cs->mapInfo(m_image); - cs->drawImage(m, imageResID, depth()); - - cs->setDisplayList(0); - cs->endFrame(); - } - - void ImageView::purge() - { - m_displayList.reset(); - } - - m2::RectD ImageView::GetBoundRect() const - { - m2::PointD const sz(m_image.m_size); - m2::PointD const pt = computeTopLeft(sz, pivot(), position()); - return m2::RectD(pt, pt + sz); - } - - void ImageView::draw(graphics::OverlayRenderer * r, - math::Matrix<double, 3, 3> const & m) const - { - if (isVisible()) - { - checkDirtyLayout(); - - m2::PointD pt = computeTopLeft(m_image.m_size, - pivot() * m, - position()); - - math::Matrix<double, 3, 3> drawM = math::Shift(math::Identity<double, 3>(), - pt.x + m_image.m_size.x / 2, - pt.y + m_image.m_size.y / 2); - - r->drawDisplayList(m_displayList.get(), drawM * m); - } - } - - void ImageView::setImage(graphics::Image::Info const & info) - { - m_image = info; - setIsDirtyLayout(true); - } -} diff --git a/gui/image_view.hpp b/gui/image_view.hpp deleted file mode 100644 index befe761a6c..0000000000 --- a/gui/image_view.hpp +++ /dev/null @@ -1,47 +0,0 @@ -#pragma once - -#include "gui/element.hpp" - -#include "graphics/image.hpp" - -#include "std/unique_ptr.hpp" - - -namespace graphics -{ - class OverlayRenderer; - class DisplayList; -} - -namespace gui -{ - class ImageView : public Element - { - graphics::Image::Info m_image; - m2::RectU m_margin; - unique_ptr<graphics::DisplayList> m_displayList; - - public: - typedef Element BaseT; - - struct Params : public BaseT::Params - { - graphics::Image::Info m_image; - Params(); - }; - - ImageView(Params const & p); - - void setImage(graphics::Image::Info const & info); - - /// @name Override from graphics::OverlayElement and gui::Element. - //@{ - virtual m2::RectD GetBoundRect() const; - - void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; - - void cache(); - void purge(); - //@} - }; -} diff --git a/gui/text_view.cpp b/gui/text_view.cpp deleted file mode 100644 index 534b2d4823..0000000000 --- a/gui/text_view.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include "gui/text_view.hpp" -#include "gui/controller.hpp" - -#include "graphics/display_list.hpp" -#include "graphics/screen.hpp" -#include "graphics/straight_text_element.hpp" - -#include "geometry/transformations.hpp" - - -namespace gui -{ - TextView::TextView(Params const & p) - : Element(p), m_maxWidth(numeric_limits<unsigned>::max()) - { - setText(p.m_text); - - setFont(EActive, graphics::FontDesc(12, graphics::Color(0, 0, 0, 255))); - setFont(EPressed, graphics::FontDesc(12, graphics::Color(0, 0, 0, 255))); - - setColor(EActive, graphics::Color(graphics::Color(192, 192, 192, 255))); - setColor(EPressed, graphics::Color(graphics::Color(64, 64, 64, 255))); - } - - void TextView::setText(string const & text) - { - if (m_text != text) - { - m_text = text; - setIsDirtyLayout(true); - } - } - - string const & TextView::text() const - { - return m_text; - } - - void TextView::layoutBody(EState state) - { - unique_ptr<graphics::StraightTextElement> & elem = m_elems[state]; - - graphics::StraightTextElement::Params params; - - params.m_depth = depth(); - params.m_fontDesc = font(state); - params.m_fontDesc.m_size *= visualScale(); - params.m_log2vis = true; - params.m_pivot = m2::PointD(0.0, 0.0); - params.m_position = position(); - params.m_glyphCache = m_controller->GetGlyphCache(); - params.m_logText = strings::MakeUniString(m_text); - params.m_doSplit = true; - params.m_doForceSplit = true; - params.m_delimiters = "\n"; - params.m_useAllParts = true; - params.m_maxPixelWidth = m_maxWidth; - - elem.reset(new graphics::StraightTextElement(params)); - } - - void TextView::layout() - { - layoutBody(EActive); - layoutBody(EPressed); - } - - void TextView::cacheBody(EState state) - { - graphics::Screen * cs = m_controller->GetCacheScreen(); - - unique_ptr<graphics::DisplayList> & dl = m_dls[state]; - - dl.reset(); - dl.reset(cs->createDisplayList()); - - cs->beginFrame(); - cs->setDisplayList(dl.get()); - - m_elems[state]->draw(cs, math::Identity<double, 3>()); - - cs->setDisplayList(0); - cs->endFrame(); - } - - void TextView::cache() - { - cacheBody(EActive); - cacheBody(EPressed); - } - - void TextView::purge() - { - m_dls.clear(); - } - - void TextView::draw(graphics::OverlayRenderer *r, math::Matrix<double, 3, 3> const & m) const - { - if (isVisible()) - { - checkDirtyLayout(); - - math::Matrix<double, 3, 3> drawM = math::Shift(math::Identity<double, 3>(), - pivot()); - - r->drawDisplayList(m_dls.at(state()).get(), drawM * m); - } - } - - void TextView::GetMiniBoundRects(RectsT & rects) const - { - checkDirtyLayout(); - - m2::PointD const pt = pivot(); - - rects.push_back(m2::AnyRectD(Offset(m_elems.at(EActive)->GetBoundRect(), pt))); - rects.push_back(m2::AnyRectD(Offset(m_elems.at(EPressed)->GetBoundRect(), pt))); - } - - void TextView::setMaxWidth(unsigned width) - { - m_maxWidth = width; - setIsDirtyLayout(true); - } - - bool TextView::onTapStarted(m2::PointD const & pt) - { - return false; - } - - bool TextView::onTapMoved(m2::PointD const & pt) - { - return false; - } - - bool TextView::onTapEnded(m2::PointD const & pt) - { - return false; - } - - bool TextView::onTapCancelled(m2::PointD const & pt) - { - return false; - } -} diff --git a/gui/text_view.hpp b/gui/text_view.hpp deleted file mode 100644 index ea6cf783bd..0000000000 --- a/gui/text_view.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include "gui/element.hpp" - -#include "std/unique_ptr.hpp" - - -namespace graphics -{ - class DisplayList; - class StraightTextElement; -} - -namespace gui -{ - class TextView : public Element - { - map<EState, unique_ptr<graphics::DisplayList> > m_dls; - - typedef map<EState, unique_ptr<graphics::StraightTextElement> > ElemsMapT; - ElemsMapT m_elems; - - string m_text; - unsigned m_maxWidth; - - void cacheBody(EState state); - void layoutBody(EState state); - - public: - struct Params : public Element::Params - { - string m_text; - }; - - TextView(Params const & p); - - void setText(string const & text); - string const & text() const; - void setMaxWidth(unsigned width); - - /// @name Overrider from graphics::OverlayElement and gui::Element. - //@{ - virtual void GetMiniBoundRects(RectsT & rects) const; - - void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const; - - void cache(); - void purge(); - void layout(); - - bool onTapStarted(m2::PointD const & pt); - bool onTapMoved(m2::PointD const & pt); - bool onTapEnded(m2::PointD const & pt); - bool onTapCancelled(m2::PointD const & pt); - //@} - }; -} |