Fresco/Berlin/modules/Drawing DrawDecorator.hh,1.2,1.3
Tobias Hunger <[email protected]> Mon, 27 Oct 2003 17:09:09 +0000
| Newsgroups | gmane.comp.video.fresco.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvs/fresco/Fresco/Berlin/modules/Drawing In directory purcel:/tmp/cvs-serv5328/Berlin/modules/Drawing Modified Files: DrawDecorator.hh Log Message: Make sure all classes defined by Kits are in the Kit's namespace. Do some coding style fixups while touching the files anyway. Index: DrawDecorator.hh =================================================================== RCS file: /cvs/fresco/Fresco/Berlin/modules/Drawing/DrawDecorator.hh,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DrawDecorator.hh 23 Mar 2000 22:07:47 -0000 1.2 +++ DrawDecorator.hh 27 Oct 2003 17:08:36 -0000 1.3 @@ -1,7 +1,7 @@ /*$Id$ * * This source file is a part of the Berlin Project. - * Copyright (C) 1999 Graydon Hoare <[email protected]> + * Copyright (C) 1999 Graydon Hoare <[email protected]> * http://www.berlin-consortium.org * * This library is free software; you can redistribute it and/or @@ -29,39 +29,47 @@ class DrawingKit; -class DrawStateContainer : public MonoGraphic +namespace Berlin { -public: - DrawStateContainer(Graphic_ptr b) {body(b);} - virtual void draw(DrawTraversal_ptr traversal) + namespace DrawingKit { - DrawingKit_var kit = traversal->kit(); - kit->saveState(); - MonoGraphic::traverse(traversal); - kit->restoreState(); - } -}; -// this just sets up a rudimentary decorator such that the value is set (in the -// traversing drawingkit) when it is entered. + class DrawStateContainer : public MonoGraphic + { + public: + DrawStateContainer(Graphic_ptr b) { body(b); } + virtual void draw(DrawTraversal_ptr traversal) + { + DrawingKit_var kit = traversal->kit(); + kit->saveState(); + MonoGraphic::traverse(traversal); + kit->restoreState(); + } + }; -template <class T> -class DrawDecorator : public MonoGraphic -{ - typedef void (DrawingKit::*Method)(T); -public: - DrawDecorator(Method m, T v) : method(m), value(v) {} - virtual void draw(DrawTraversal_ptr traversal) - { - DrawingKit_var kit = traversal->kit(); - kit->saveState(); - (kit->*method)(value); - MonoGraphic::traverse(traversal); - kit->restoreState(); - } -private: - Method method; - T value; -}; + // this just sets up a rudimentary decorator such that the value is set (in the + // traversing drawingkit) when it is entered. + + template <class T> + class DrawDecorator : public MonoGraphic + { + typedef void (DrawingKit::*Method)(T); + public: + DrawDecorator(Method m, T v) : method(m), value(v) { } + virtual void draw(DrawTraversal_ptr traversal) + { + DrawingKit_var kit = traversal->kit(); + kit->saveState(); + (kit->*method)(value); + MonoGraphic::traverse(traversal); + kit->restoreState(); + } + private: + Method method; + T value; + }; + + } // namespace +} // namespace #endif