blob: 7702d6b105d178906b5b8c26d56db8058bc4d7d6 (
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
|
#pragma once
#include "../std/vector.hpp"
#include "../std/shared_ptr.hpp"
#include "../geometry/any_rect2d.hpp"
#include "../graphics/straight_text_element.hpp"
#include "../graphics/display_list.hpp"
#include "element.hpp"
namespace gui
{
class TextView : public Element
{
private:
map<EState, shared_ptr<graphics::DisplayList> > m_dls;
map<EState, shared_ptr<graphics::StraightTextElement> > m_elems;
string m_text;
unsigned m_maxWidth;
mutable vector<m2::AnyRectD> m_boundRects;
void cacheBody(EState state);
void layoutBody(EState state);
public:
void cache();
void purge();
void layout();
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);
vector<m2::AnyRectD> const & boundRects() const;
void draw(graphics::OverlayRenderer * r, math::Matrix<double, 3, 3> const & m) const;
bool onTapStarted(m2::PointD const & pt);
bool onTapMoved(m2::PointD const & pt);
bool onTapEnded(m2::PointD const & pt);
bool onTapCancelled(m2::PointD const & pt);
};
}
|