Theme Editor: Implemented some basic viewport/text mirroring with the %ax tag
[kugel-rb.git] / utils / themeeditor / graphics / rbviewport.h
blobcc47e41666315d45fae9301e3da43ac80cb8c50f
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 RBVIEWPORT_H
23 #define RBVIEWPORT_H
25 #include "skin_parser.h"
26 #include "rbfont.h"
27 #include "rbmovable.h"
29 class RBScreen;
30 class RBRenderInfo;
31 class ParseTreeNode;
33 #include <QGraphicsItem>
35 class SkinDocument;
37 class RBViewport : public RBMovable
39 public:
40 enum Alignment
42 Left,
43 Center,
44 Right
47 static const double scrollRate;
49 RBViewport(skin_element* node, const RBRenderInfo& info,
50 ParseTreeNode* pNode);
51 virtual ~RBViewport();
53 QPainterPath shape() const;
54 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
55 QWidget *widget);
57 void setBGColor(QColor color){ background = color; }
58 QColor getBGColor(){ return background; }
59 void setFGColor(QColor color){ foreground = color; }
60 QColor getFGColor(){ return foreground; }
61 void makeCustomUI(){ customUI = true; }
62 void clearCustomUI(){ customUI = false; }
64 void newLine();
65 void write(QString text);
66 void alignText(Alignment align){ textAlign = align; }
67 int getTextOffset(){ return textOffset.y(); }
68 void addTextOffset(int height){ textOffset.setY(textOffset.y() + height); }
69 void flushText()
71 if(textOffset.x() < 0)
72 return;
73 alignLeft();
74 alignRight();
75 alignCenter();
77 void scrollText(double time){ scrollTime = time; }
79 void enableStatusBar(){ showStatusBar = true; }
81 void showPlaylist(const RBRenderInfo& info, int start, skin_element* id3,
82 skin_element* noId3);
84 void makeFullScreen();
86 protected:
87 void saveGeometry();
89 private:
91 void alignLeft();
92 void alignCenter();
93 void alignRight();
95 RBFont* font;
96 QColor foreground;
97 QColor background;
99 bool debug;
100 bool customUI;
101 QPoint textOffset;
102 int lineHeight;
104 RBScreen* screen;
106 QString leftText;
107 QString centerText;
108 QString rightText;
109 Alignment textAlign;
111 bool showStatusBar;
112 QPixmap statusBarTexture;
114 RBText* leftGraphic;
115 RBText* centerGraphic;
116 RBText* rightGraphic;
118 double scrollTime;
120 int baseParam;
121 ParseTreeNode* node;
122 SkinDocument* doc;
124 bool mirrored;
127 #endif // RBVIEWPORT_H