Mercurial > projects > doodle
annotate doodle/dia/icanvas.d @ 84:cdd4fc728d94
Renamed Drawable to Renderer
author | daveb |
---|---|
date | Mon, 16 Aug 2010 17:23:09 +0930 |
parents | b759414d2b72 |
children | 467febed7367 |
rev | line source |
---|---|
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
1 module doodle.dia.icanvas; |
0 | 2 |
26 | 3 public { |
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
4 import doodle.tk.geometry; |
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
27
diff
changeset
|
5 import doodle.tk.events; |
84 | 6 import doodle.tk.renderer; |
26 | 7 } |
0 | 8 |
27 | 9 private { |
10 import std.typecons; | |
11 } | |
12 | |
13 mixin(defineEnum!("Cursor", | |
63
20d6327c4a75
Event progress. Got key press/release working and panning via keyboard.
daveb
parents:
58
diff
changeset
|
14 "DEFAULT", "HAND", "CROSSHAIR", "PENCIL")); |
27 | 15 |
78 | 16 interface IViewport2 { |
77 | 17 void damageModel(in Rectangle area); |
18 void damageScreen(in Rectangle area); | |
67 | 19 } |
10 | 20 |
78 | 21 interface IViewport : IViewport2 { |
22 void zoomRelative(in Point screenDatum, in double factor); // FIXME reorder arguments | |
23 void panRelative(in Vector screenDisplacement); | |
24 void setCursor(in Cursor cursor); | |
25 } | |
26 | |
27 /* | |
67 | 28 final class Damage { |
29 void increase(in Rectangle additional) { _rectangle = _rectangle | additional; } | |
30 Rectangle rectangle() const { return _rectangle; } | |
31 private Rectangle _rectangle; | |
0 | 32 } |
78 | 33 */ |
0 | 34 |
57 | 35 interface IEventHandler { |
36 bool handleButtonPress(scope IViewport viewport, in ButtonEvent event); | |
37 bool handleButtonRelease(scope IViewport viewport, in ButtonEvent event); | |
38 bool handleMotion(scope IViewport viewport, in MotionEvent event); | |
39 bool handleScroll(scope IViewport viewport, in ScrollEvent event); | |
64
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
40 bool handleEnter(scope IViewport viewport, CrossingEvent event); |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
41 bool handleLeave(scope IViewport viewport, CrossingEvent event); |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
42 bool handleKeyPress(scope IViewport viewport, in KeyEvent event); |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
43 bool handleKeyRelease(scope IViewport viewport, in KeyEvent event); |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
44 |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
45 // XXX Still not sure about these: |
57 | 46 //bool handleFocusIn(scope IViewport viewport, FocusEvent event); |
47 //bool handleFocusOut(scope IViewport viewport, FocusEvent event); | |
0 | 48 } |
10 | 49 |
57 | 50 interface IGrid { |
48 | 51 void zoomChanged(double zoom); |
35 | 52 |
36 | 53 // TODO inout? |
35 | 54 bool snap(in Point a, out Point b) const; |
55 } | |
56 | |
57 | 57 interface IPage { |
36 | 58 // TODO |
59 } | |
60 | |
10 | 61 abstract class Layer { |
12 | 62 this(in string name) { |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
57
diff
changeset
|
63 _name = name; |
12 | 64 } |
65 | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
57
diff
changeset
|
66 string name() const { return _name; } |
12 | 67 |
11 | 68 Rectangle bounds() const; |
35 | 69 |
84 | 70 void draw(in Rectangle screenDamage, scope Renderer screenRenderer, |
71 in Rectangle modelDamage, scope Renderer modelRenderer) const; | |
12 | 72 |
73 private { | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
57
diff
changeset
|
74 immutable string _name; |
12 | 75 } |
10 | 76 } |