2010-06-18 21:10:01 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2010 Robert Bieber
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef RBVIEWPORT_H
|
|
|
|
#define RBVIEWPORT_H
|
|
|
|
|
|
|
|
#include "skin_parser.h"
|
2010-06-25 05:14:13 +00:00
|
|
|
#include "rbfont.h"
|
2010-06-18 21:10:01 +00:00
|
|
|
|
|
|
|
class RBScreen;
|
|
|
|
class RBRenderInfo;
|
|
|
|
|
|
|
|
#include <QGraphicsItem>
|
|
|
|
|
|
|
|
class RBViewport : public QGraphicsItem
|
|
|
|
{
|
|
|
|
public:
|
2010-06-30 07:00:05 +00:00
|
|
|
enum Alignment
|
|
|
|
{
|
|
|
|
Left,
|
|
|
|
Center,
|
|
|
|
Right
|
|
|
|
};
|
|
|
|
|
2010-06-18 21:10:01 +00:00
|
|
|
RBViewport(skin_element* node, const RBRenderInfo& info);
|
|
|
|
virtual ~RBViewport();
|
|
|
|
|
|
|
|
QPainterPath shape() const;
|
|
|
|
QRectF boundingRect() const;
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
|
|
|
QWidget *widget);
|
|
|
|
|
2010-06-23 19:41:30 +00:00
|
|
|
void setBGColor(QColor color){ background = color; }
|
|
|
|
void setFGColor(QColor color){ foreground = color; }
|
|
|
|
void makeCustomUI(){ customUI = true; }
|
|
|
|
void clearCustomUI(){ customUI = false; }
|
|
|
|
|
2010-06-25 05:14:13 +00:00
|
|
|
void newLine();
|
|
|
|
void write(QString text);
|
2010-06-30 07:00:05 +00:00
|
|
|
void alignText(Alignment align){ textAlign = align; }
|
2010-06-18 21:10:01 +00:00
|
|
|
|
|
|
|
private:
|
2010-06-25 05:14:13 +00:00
|
|
|
|
2010-06-30 07:00:05 +00:00
|
|
|
void alignLeft();
|
|
|
|
void alignCenter();
|
|
|
|
void alignRight();
|
|
|
|
|
2010-06-18 21:10:01 +00:00
|
|
|
QRectF size;
|
2010-06-25 05:14:13 +00:00
|
|
|
RBFont* font;
|
2010-06-26 05:18:21 +00:00
|
|
|
QColor foreground;
|
|
|
|
QColor background;
|
2010-06-18 21:10:01 +00:00
|
|
|
|
2010-06-26 05:51:07 +00:00
|
|
|
bool debug;
|
2010-06-21 20:11:58 +00:00
|
|
|
bool customUI;
|
2010-06-25 05:14:13 +00:00
|
|
|
QPoint textOffset;
|
|
|
|
int lineHeight;
|
2010-06-18 21:10:01 +00:00
|
|
|
|
2010-06-25 05:14:13 +00:00
|
|
|
RBScreen* screen;
|
2010-06-30 07:00:05 +00:00
|
|
|
|
|
|
|
QList<QGraphicsItem*> leftText;
|
|
|
|
QList<QGraphicsItem*> centerText;
|
|
|
|
QList<QGraphicsItem*> rightText;
|
|
|
|
Alignment textAlign;
|
2010-06-18 21:10:01 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // RBVIEWPORT_H
|