Mercurial > projects > doodle
annotate doodle/dia/icanvas.d @ 104:ab745d8b10e5
Updated to dmd 2.052
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Sun, 20 Feb 2011 22:24:36 +1030 |
parents | a98116479793 |
children | 7abaf5c3959f |
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; |
89 | 7 import doodle.tk.screen_model; |
26 | 8 } |
0 | 9 |
27 | 10 private { |
11 import std.typecons; | |
12 } | |
13 | |
104 | 14 enum Cursor { |
15 DEFAULT, | |
16 HAND, | |
17 CROSSHAIR, | |
18 PENCIL | |
19 } | |
27 | 20 |
78 | 21 interface IViewport2 { |
77 | 22 void damageModel(in Rectangle area); |
23 void damageScreen(in Rectangle area); | |
67 | 24 } |
10 | 25 |
78 | 26 interface IViewport : IViewport2 { |
92 | 27 void zoomRelative(in double factor, in Point screenDatum); |
78 | 28 void panRelative(in Vector screenDisplacement); |
29 void setCursor(in Cursor cursor); | |
30 } | |
31 | |
32 /* | |
67 | 33 final class Damage { |
34 void increase(in Rectangle additional) { _rectangle = _rectangle | additional; } | |
35 Rectangle rectangle() const { return _rectangle; } | |
36 private Rectangle _rectangle; | |
0 | 37 } |
78 | 38 */ |
0 | 39 |
57 | 40 interface IEventHandler { |
41 bool handleButtonPress(scope IViewport viewport, in ButtonEvent event); | |
42 bool handleButtonRelease(scope IViewport viewport, in ButtonEvent event); | |
43 bool handleMotion(scope IViewport viewport, in MotionEvent event); | |
44 bool handleScroll(scope IViewport viewport, in ScrollEvent event); | |
92 | 45 bool handleEnter(scope IViewport viewport, in CrossingEvent event); |
46 bool handleLeave(scope IViewport viewport, in CrossingEvent event); | |
64
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
47 bool handleKeyPress(scope IViewport viewport, in KeyEvent event); |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
48 bool handleKeyRelease(scope IViewport viewport, in KeyEvent event); |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
49 |
eb5436b47d13
Implemented crossing events
"David Bryant <bagnose@gmail.com>"
parents:
63
diff
changeset
|
50 // XXX Still not sure about these: |
57 | 51 //bool handleFocusIn(scope IViewport viewport, FocusEvent event); |
52 //bool handleFocusOut(scope IViewport viewport, FocusEvent event); | |
0 | 53 } |
10 | 54 |
57 | 55 interface IGrid { |
92 | 56 void zoomChanged(in double zoom); |
35 | 57 |
58 } | |
59 | |
57 | 60 interface IPage { |
36 | 61 } |
62 | |
10 | 63 abstract class Layer { |
12 | 64 this(in string name) { |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
57
diff
changeset
|
65 _name = name; |
12 | 66 } |
67 | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
57
diff
changeset
|
68 string name() const { return _name; } |
12 | 69 |
11 | 70 Rectangle bounds() const; |
35 | 71 |
92 | 72 //bool snap(in Point a, out Point b) const; |
73 | |
84 | 74 void draw(in Rectangle screenDamage, scope Renderer screenRenderer, |
89 | 75 in Rectangle modelDamage, scope Renderer modelRenderer, |
76 in ScreenModel screenModel) const; | |
12 | 77 |
78 private { | |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
57
diff
changeset
|
79 immutable string _name; |
12 | 80 } |
10 | 81 } |