#include "NavigationFloatItem.h"

#include "ui_navigation.h"
#include <QPainter>
#include <QMouseEvent>
#include <QPixmapCache>
#include <QDebug>

NavigationFloatItem::NavigationFloatItem(QWidget *parent)
    : QWidget(parent), m_navigationWidget(new Ui::Navigation)
{
    m_navigationWidget->setupUi(this);
}

void NavigationFloatItem::paintEvent(QPaintEvent *event)
{
    QPainter painter(this);
    painter.drawPixmap(0, 0, pixmap("navigation/navigational_backdrop_top"));
    painter.drawPixmap(0, 70, pixmap("navigation/navigational_backdrop_center"));
    painter.drawPixmap(0, 311, pixmap("navigation/navigational_backdrop_bottom"));
}

QPixmap NavigationFloatItem::pixmap(const QString &id)
{
    QPixmap result;
    if (!QPixmapCache::find(id, result))
    {
        result = QPixmap(QLatin1String(":/") + id + QLatin1String(".png"));
        QPixmapCache::insert(id, result);
    }
    return result;
}


