-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCanvasEngine.h
78 lines (57 loc) · 1.46 KB
/
CanvasEngine.h
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef _CANVASENGINE_
#define _CANVASENGINE_
#include <list>
#include <string>
#include <Evas.h>
#include "Xwindow.h"
#include "Geometry.h"
///////////////////// Layouts ////////////////////////////
class Layout {
public:
virtual ~Layout() = 0;
virtual void transform(Evas_Object *img) const = 0;
};
class RectLayout : public Layout {
public:
RectLayout(const Rect &r);
void transform(Evas_Object *img) const;
protected:
const Rect &layout;
};
class Layout3D : public Layout {
public:
Layout3D(const Rect3D &r);
void transform(Evas_Object *img) const;
protected:
const Rect3D &layout;
};
/////////////////////// Canvas Widget and Engine //////////////////////
class CanvasWidget {
public:
virtual ~CanvasWidget();
void setFrame(const Border &b);
protected:
friend class CanvasEngine;
CanvasWidget(Evas_Object *img, const Layout &l);
void render() const;
Evas_Object *image;
const Layout *layout;
};
class CanvasEngine {
public:
static void init(Xwindow &frame);
static CanvasEngine &get();
virtual CanvasWidget &addWidget(const std::string &path, const Layout &l);
virtual void render() const;
virtual void resize(const Size &s);
virtual ~CanvasEngine();
protected:
CanvasEngine(const CanvasEngine &);
CanvasEngine &operator=(const CanvasEngine &);
CanvasEngine(Xwindow &frame);
static CanvasEngine *instance;
Evas *canvas;
std::list<CanvasWidget *> widgets;
};
#endif /* _CANVASENGINE_ */
/* vim: set sw=2 sts=2 : */