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: 5afdaf5be2002deaf008304bf744f7d8929d931a (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
#pragma once

#include "element.hpp"

#include "../std/map.hpp"
#include "../std/vector.hpp"
#include "../std/shared_ptr.hpp"

#include "../base/string_utils.hpp"
#include "../base/matrix.hpp"

#include "../graphics/glyph_cache.hpp"
#include "../graphics/display_list.hpp"
#include "../graphics/glyph_layout.hpp"

namespace gui
{
  class CachedTextView : public Element
  {
  private:

    string m_text;

    strings::UniString m_uniText;

    vector<shared_ptr<graphics::DisplayList> > m_dls;
    vector<shared_ptr<graphics::DisplayList> > m_maskedDls;

    scoped_ptr<graphics::GlyphLayout> m_layout;
    scoped_ptr<graphics::GlyphLayout> m_maskedLayout;

    mutable vector<m2::AnyRectD> m_boundRects;

  public:

    struct Params : public Element::Params
    {
      string m_text;
    };

    CachedTextView(Params const & p);

    void setText(string const & text);
    string const & text() const;

    vector<m2::AnyRectD> const & boundRects() 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);
  };
}