Manual: Small English improvement
[maemo-rb.git] / utils / themeeditor / models / parsetreenode.h
blobaf998faf114713224fa939fbe1c63e3732300c6f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2010 Robert Bieber
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef PARSETREENODE_H
23 #define PARSETREENODE_H
25 #include "skin_parser.h"
26 #include "rbviewport.h"
27 #include "rbscreen.h"
28 #include "rbrenderinfo.h"
30 #include <QString>
31 #include <QVariant>
32 #include <QList>
34 class ParseTreeNode
36 public:
37 ParseTreeNode(struct skin_element* data, ParseTreeModel* model);
38 ParseTreeNode(struct skin_element* data, ParseTreeNode* parent,
39 ParseTreeModel* model);
40 ParseTreeNode(struct skin_tag_parameter* data, ParseTreeNode* parent,
41 ParseTreeModel* model);
42 virtual ~ParseTreeNode();
44 QString genCode() const;
45 int genHash() const;
47 bool isParam() const{ if(param) return true; else return false; }
48 struct skin_tag_parameter* getParam(){ return param;}
49 struct skin_element* getElement(){return element;}
51 ParseTreeNode* child(int row);
52 int numChildren() const;
53 QVariant data(int column) const;
54 int getRow() const;
55 ParseTreeNode* getParent() const;
56 ParseTreeNode* getChild(int row) const
58 if(row < children.count())
59 return children[row];
60 else
61 return 0;
64 void render(const RBRenderInfo& info);
65 void render(const RBRenderInfo &info, RBViewport* viewport,
66 bool noBreak = false);
68 double findBranchTime(ParseTreeNode* branch, const RBRenderInfo& info);
69 double findConditionalTime(ParseTreeNode* conditional,
70 const RBRenderInfo& info);
72 void modParam(QVariant value, int index = -1);
74 private:
76 bool execTag(const RBRenderInfo& info, RBViewport* viewport);
77 QVariant evalTag(const RBRenderInfo& info, bool conditional = false,
78 int branches = 0);
80 ParseTreeNode* parent;
81 struct skin_element* element;
82 struct skin_tag_parameter* param;
83 QList<ParseTreeNode*> children;
85 static int openConditionals;
86 static bool breakFlag;
87 QGraphicsItem* rendered;
89 ParseTreeModel* model;
91 QList<int> extraParams;
95 #endif // PARSETREENODE_H