Mercurial > projects > doodle
annotate doodle/dia/page_layer.d @ 81:d92b9f04b1e8
Bed time
author | "David Bryant <bagnose@gmail.com>" |
---|---|
date | Mon, 16 Aug 2010 00:04:27 +0930 |
parents | b759414d2b72 |
children | cdd4fc728d94 |
rev | line source |
---|---|
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
26
diff
changeset
|
1 module doodle.dia.page_layer; |
17 | 2 |
3 public { | |
28
1754cb773d41
Part-way through getting to compile with configure/builder.
Graham St Jack <graham.stjack@internode.on.net>
parents:
26
diff
changeset
|
4 import doodle.dia.icanvas; |
17 | 5 } |
10 | 6 |
36 | 7 private { |
10 | 8 } |
9 | |
57 | 10 class PageLayer : Layer, IPage { |
58
c63719604adb
Beginnings of creating a rectangle...
"David Bryant <bagnose@gmail.com>"
parents:
57
diff
changeset
|
11 this(in string name = "Page") { |
12 | 12 super(name); |
48 | 13 _pageGeometry = Rectangle(Point.DEFAULT, Vector(210.0, 297.0)); |
14 //_pageGeometry = Rectangle(Point.DEFAULT, Vector(100.0, 100.0)); | |
11 | 15 } |
16 | |
36 | 17 // Layer overrides: |
18 | |
11 | 19 override Rectangle bounds() const { |
48 | 20 return _pageGeometry; |
11 | 21 } |
22 | |
80
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
23 override void draw(in Rectangle screenDamage, scope Drawable screenDrawable, |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
24 in Rectangle modelDamage, scope Drawable modelDrawable) const { |
10 | 25 // Make the paper white, with a border |
26 | |
80
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
27 modelDrawable.pushState; { |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
28 modelDrawable.setColor(Color(0.0, 0.0, 0.0, 1.0)); |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
29 modelDrawable.drawRectangle(_pageGeometry, false); |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
30 } modelDrawable.popState; |
41 | 31 |
80
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
32 modelDrawable.pushState; { |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
33 modelDrawable.setColor(Color(1.0, 1.0, 1.0, 1.0)); |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
34 modelDrawable.drawRectangle(_pageGeometry, true); |
b759414d2b72
Switched from cairo to Drawable abstraction
"David Bryant <bagnose@gmail.com>"
parents:
74
diff
changeset
|
35 } modelDrawable.popState; |
10 | 36 } |
37 | |
57 | 38 // IPage overrides: |
36 | 39 |
10 | 40 private { |
48 | 41 Rectangle _pageGeometry; |
10 | 42 } |
43 } |