Mercurial > projects > doodle
annotate doodle/fig/diagram_elements.d @ 84:cdd4fc728d94
Renamed Drawable to Renderer
author | daveb |
---|---|
date | Mon, 16 Aug 2010 17:23:09 +0930 |
parents | b759414d2b72 |
children | 66210d8ea37a |
rev | line source |
---|---|
54 | 1 module doodle.fig.diagram_elements; |
27 | 2 |
44 | 3 private { |
4 import doodle.tk.geometry; | |
84 | 5 import doodle.tk.renderer; |
44 | 6 } |
7 | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
8 interface IDiagram { |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
9 void add(DiagramElement element); |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
10 } |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
11 |
54 | 12 abstract class DiagramElement { |
44 | 13 Rectangle bounds() const; |
14 | |
84 | 15 void draw(in Rectangle damage, scope Renderer cr) const; |
44 | 16 |
17 private { | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
18 //GraphElement _container; // FIXME use an interface to the container |
54 | 19 } |
20 } | |
21 | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
22 /* |
66 | 23 abstract class SemanticModelBridge { |
24 }; | |
54 | 25 |
66 | 26 abstract class GraphElement : DiagramElement { |
27 // Link to model via bridge goes here | |
28 private { | |
29 SemanticModelBridge _modelBridge; | |
30 GraphConnector[] _anchorages; | |
31 } | |
44 | 32 } |
27 | 33 |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
34 class GraphConnector { |
44 | 35 } |
27 | 36 |
67 | 37 final class GraphNode : GraphElement { |
44 | 38 } |
27 | 39 |
67 | 40 final class GraphEdge : GraphElement { |
66 | 41 private { |
42 GraphConnector[2] _anchors; | |
44 | 43 } |
66 | 44 } |
45 */ | |
44 | 46 |
54 | 47 abstract class LeafElement : DiagramElement { |
48 } | |
49 | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
50 /* |
66 | 51 class TextElement : LeafElement { |
52 } | |
53 */ | |
54 | 54 |
55 abstract class GraphicPrimitive : LeafElement { | |
44 | 56 } |
54 | 57 |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
58 /* |
66 | 59 class PolylinePrimitive : GraphicPrimitive { |
60 private { | |
61 Point[] _waypoints; | |
62 } | |
63 } | |
64 */ | |
54 | 65 |
67 | 66 final class RectanglePrimitive : GraphicPrimitive { |
84 | 67 override void draw(in Rectangle damage, scope Renderer drawable) const { |
80
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
73
diff
changeset
|
68 drawable.drawRectangle(bounds, false); |
54 | 69 } |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
70 |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
71 override Rectangle bounds() const { return _bounds; } |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
72 |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
73 private { |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
74 Rectangle _bounds; |
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
54
diff
changeset
|
75 } |
54 | 76 } |