Mercurial > projects > doodle
annotate icanvas.d @ 18:df8d81d9f499
Lasso fiddling
author | David Bryant <daveb@acres.com.au> |
---|---|
date | Mon, 13 Jul 2009 17:08:32 +0930 |
parents | c643c04e3f5e |
children | 22abbf4cde96 |
rev | line source |
---|---|
0 | 1 module icanvas; |
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 { |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
8 void rel_zoom(Point pixel_datum, double factor); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
9 void rel_pan(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 | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
12
diff
changeset
|
47 void draw(const Viewport viewport, in Rectangle damage, Context model_cr, Context pixel_cr) const; |
12 | 48 |
49 private { | |
50 invariant string mName; | |
51 } | |
10 | 52 } |