-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathText.h
More file actions
63 lines (49 loc) · 1.29 KB
/
Text.h
File metadata and controls
63 lines (49 loc) · 1.29 KB
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 "Pixel.h"
#include "utils/Badge.h"
#include <string>
#include <memory>
namespace cairowindow {
class Text
{
private:
Pixel position_;
std::string text_;
public:
Text() = default;
Text(Pixel position, std::string const& text) : position_(position), text_(text) { }
Pixel position() const { return position_; }
std::string const& text() const { return text_; }
};
namespace draw {
class Text;
} // namespace draw
template<CS> class CoordinateSystem;
template<CS> class CoordinateMapper;
namespace plot {
class Plot;
class Text : public cairowindow::Text
{
public:
explicit Text(cairowindow::Text const& text) : cairowindow::Text(text) { }
using cairowindow::Text::Text;
public:
template<CS cs, typename... Args>
void create_draw_object(utils::Badge<Plot, cairowindow::CoordinateSystem<cs>, cairowindow::CoordinateMapper<cs>>, Args&&... args) const
{
draw_object_ = std::make_shared<cairowindow::draw::Text>(std::forward<Args>(args)...);
}
// Accessor for the draw object; used by Plot and CoordinateSystem.
std::shared_ptr<draw::Text> const& draw_object() const
{
return draw_object_;
}
void reset()
{
draw_object_.reset();
}
private:
mutable std::shared_ptr<draw::Text> draw_object_;
};
} // namespace plot
} // namespace cairowindow