diff src/styleengine.hh @ 503:00b31843839b

implement various apply() methods
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Wed, 29 Oct 2008 16:44:28 +0100
parents 424e4f409636
children 03de2284bfa6
line wrap: on
line diff
--- a/src/styleengine.hh	Tue Oct 28 21:28:57 2008 +0100
+++ b/src/styleengine.hh	Wed Oct 29 16:44:28 2008 +0100
@@ -4,17 +4,38 @@
 #include "dw/core.hh"
 #include "doctree.hh"
 
-class StyleEngine {
+class StyleEngine : public Doctree {
    private:
-      dw::core::style::Style *currentStyle;
+      class Node : public DoctreeNode {
+         public:
+            dw::core::style::Style *style;
+
+
+      };
+
+      lout::misc::SimpleVector <Node> *stack;
 
    public:
       StyleEngine ();
       ~StyleEngine ();
+   
+      /* Doctree interface */
+      const DoctreeNode *top () {
+         return stack->getRef (stack->size () - 1);
+      };
+      const DoctreeNode *parent (const DoctreeNode *n) {
+         if (n->depth > 0)
+            return stack->getRef (n->depth - 1);
+         else
+            return NULL;
+      };
 
       void startElement (int tag, const char *id, const char *klass, const char *style);
       void endElement (int tag);
-      inline dw::core::style::Style *style () { return currentStyle; };
+
+      inline dw::core::style::Style *style () {
+         return stack->getRef (stack->size () - 1)->style;
+      };
 };
 
 #endif