Mercurial > projects > doodle
diff doodle/dia/tool_layer.d @ 36:188397ef9a12
Late night tinkering
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Sun, 30 Aug 2009 23:36:31 +0930 |
parents | 1754cb773d41 |
children | 1b4c9ba58673 |
line wrap: on
line diff
--- a/doodle/dia/tool_layer.d Sun Aug 30 22:14:01 2009 +0930 +++ b/doodle/dia/tool_layer.d Sun Aug 30 23:36:31 2009 +0930 @@ -1,20 +1,37 @@ module doodle.dia.tool_layer; +public { + import doodle.dia.tool; +} + private { import std.stdio; import doodle.cairo.routines; } -public { - import doodle.dia.tool; -} - class ToolLayer : Layer, EventHandler { this(in Tool[] tools, in string name) { super(name); mTools = tools.dup; } + // Layer overrides: + + override Rectangle bounds() const { + return Rectangle(); + } + + override void draw(const Viewport viewport, + in Rectangle pixel_damage, scope Context pixel_cr, + in Rectangle model_damage, scope Context model_cr) const { + // FIXME this isn't how we will really draw the tools... + foreach (const Tool tool; mTools) { + tool.draw(viewport, pixel_damage, pixel_cr, model_damage, model_cr); + } + } + + // EventHandler overrides: + override bool handle_button_press(scope Viewport viewport, in ButtonEvent event) { // writefln("%s", event); @@ -94,19 +111,6 @@ return true; } - override Rectangle bounds() const { - return Rectangle(); - } - - override void draw(const Viewport viewport, - in Rectangle pixel_damage, scope Context pixel_cr, - in Rectangle model_damage, scope Context model_cr) const { - // FIXME this isn't how we will really draw the tools... - foreach (const Tool tool; mTools) { - tool.draw(viewport, pixel_damage, pixel_cr, model_damage, model_cr); - } - } - /* override void push(Tool tool) { }