Mercurial > projects > doodle
annotate tool.d @ 17:c643c04e3f5e
Checkpoint
author | David Bryant <daveb@acres.com.au> |
---|---|
date | Mon, 13 Jul 2009 16:46:21 +0930 |
parents | 9e63308b749c |
children | df8d81d9f499 |
rev | line source |
---|---|
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
1 module tool; |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
2 |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
3 public { |
17 | 4 import cairo_support; |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
5 import icanvas; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
6 import tk.events; |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
7 } |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
8 |
7 | 9 /* |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
10 interface IToolStack { |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
11 void push(Tool tool); |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
12 void pop(); |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
13 void replace(Tool tool); |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
14 } |
7 | 15 */ |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
16 |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
17 abstract class Tool { |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
18 /* |
17 | 19 enum Response { |
20 START, CONTINUE, FINISH | |
21 | |
22 } | |
23 */ | |
24 | |
25 /* | |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
26 abstract bool is_sticky(); |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
27 abstract bool is_replaceable(); |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
28 */ |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
29 |
7 | 30 /* |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
31 abstract void start(IToolStack tool_stack); |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
32 abstract void stop(IToolStack tool_stack); |
7 | 33 */ |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
34 |
17 | 35 void draw(const Viewport viewport, in Rectangle damage, Context model_cr, Context pixel_cr) const { |
36 } | |
16
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
37 |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
38 bool handle_button_press(Viewport viewport, in ButtonEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
39 bool handle_button_release(Viewport viewport, in ButtonEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
40 bool handle_motion(Viewport viewport, in MotionEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
41 bool handle_scroll(Viewport viewport, in ScrollEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
42 //bool handle_expose(Viewport viewport, ExposeEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
43 //bool handle_enter(Viewport viewport, CrossingEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
44 //bool handle_leave(Viewport viewport, CrossingEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
45 //bool handle_focus_in(Viewport viewport, FocusEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
46 //bool handle_focus_out(Viewport viewport, FocusEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
47 bool handle_key_press(Viewport viewport, in KeyEvent event); |
9e63308b749c
* Fix up public/private includes
David Bryant <daveb@acres.com.au>
parents:
10
diff
changeset
|
48 bool handle_key_release(Viewport viewport, in KeyEvent event); |
2
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
49 } |
d6f44347373d
* Switched over to geometry done with structs instead of classes.
David Bryant <daveb@acres.com.au>
parents:
diff
changeset
|
50 |