Mercurial > projects > doodle
annotate dia/icanvas.d @ 22:17c2df87b459
Package refactoring.
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Wed, 15 Jul 2009 23:31:29 +0930 |
parents | icanvas.d@d6e7a5a6f008 |
children | 06c30d250c0a |
rev | line source |
---|---|
22 | 1 module dia.icanvas; |
0 | 2 |
3
7d57cae10805
Renamed geometry2 to geometry
David Bryant <daveb@acres.com.au>
parents:
2
diff
changeset
|
3 import tk.geometry; |
7 | 4 import tk.events; |
10 | 5 import cairo.Context; |
0 | 6 |
10 | 7 interface Viewport { |
20 | 8 void zoom_relative(Point pixel_datum, double factor); |
9 void pan_relative(Vector pixel_displacement); | |
17 | 10 void damage_model(Rectangle area); // FIXME could be an inout parameter of the event handling, or a special scope Damage object that supports growth only |
18 | 11 void damage_pixel(Rectangle area); // FIXME as above |
10 | 12 |
17 | 13 // FIXME not sure about these: |
11 | 14 double zoom() const; |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
15 Point model_to_pixel(Point model) const; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
16 Point pixel_to_model(Point pixel) const; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
17 Vector model_to_pixel(Vector model) const; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
18 Vector pixel_to_model(Vector pixel) const; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
19 Rectangle model_to_pixel(Rectangle model) const; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
20 Rectangle pixel_to_model(Rectangle model) const; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
21 double model_to_pixel(double model) const; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
22 double pixel_to_model(double pixel) const; |
0 | 23 } |
24 | |
10 | 25 interface EventHandler { |
26 bool handle_button_press(Viewport viewport, in ButtonEvent event); | |
27 bool handle_button_release(Viewport viewport, in ButtonEvent event); | |
28 bool handle_motion(Viewport viewport, in MotionEvent event); | |
29 bool handle_scroll(Viewport viewport, in ScrollEvent event); | |
30 //bool handle_enter(Viewport viewport, CrossingEvent event); | |
31 //bool handle_leave(Viewport viewport, CrossingEvent event); | |
32 //bool handle_focus_in(Viewport viewport, FocusEvent event); | |
33 //bool handle_focus_out(Viewport viewport, FocusEvent event); | |
34 bool handle_key_press(Viewport viewport, in KeyEvent event); | |
35 bool handle_key_release(Viewport viewport, in KeyEvent event); | |
0 | 36 } |
10 | 37 |
38 abstract class Layer { | |
12 | 39 this(in string name) { |
40 mName = name; | |
41 } | |
42 | |
43 string name() const { return mName; } | |
44 | |
11 | 45 Rectangle bounds() const; |
46 //void zoom_changed | |
19 | 47 void draw(const Viewport viewport, |
48 in Rectangle pixel_damage, scope Context pixel_cr, | |
49 in Rectangle model_damage, scope Context model_cr) const; | |
12 | 50 |
51 private { | |
52 invariant string mName; | |
53 } | |
10 | 54 } |