-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclass_adapter.hpp
52 lines (40 loc) · 1.06 KB
/
class_adapter.hpp
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
#ifndef ADAPTER_HPP
#define ADAPTER_HPP
class Shape {
public:
Shape();
virtual void BoundingBox(Point& bottomLeft, Point& topRight ) const;
virtual Manipulator* CreateManipulator() const;
};
class TextView {
public:
TextView();
void GetOrigin(Coord& x, Coord& y) const;
void GetExtent(Coord& width, Coord& height) const;
virtual bool IsEmpty() const;
};
class TextShape : public Shape, private TextView {
public:
TextShape();
virtual void BoundingBox(Point& bottomLeft, Point& topRight) const;
virtual bool IsEmpty() const;
virtual Manipulator* CreateManipulator() const;
};
void TextShape::BoundingBox (Point& bottomLeft, Point& topRight) const
{
Coord bottom, left, width, height;
GetOrigin(bottom, left);
GetExtent(width, height);
bottomLeft = Point(bottom, left);
topRight = Point(bottom + height, left + width);
//..
}
bool TextShape::IsEmpty () const
{
return TextView::IsEmpty();
}
Manipulator* TextShape::CreateManipulator () const
{
return new TextManipulator(this);
}
#endif // ADAPTER_HPP