Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cached_text_view.hpp « gui - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2fe1b6410d067d0689a08d892991f8362f4d0e8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#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;
  };
}