1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-20 20:05:20 +02:00
gmenu2x/src/dialog.cpp

40 lines
929 B
C++
Raw Normal View History

#include <string>
#include "dialog.h"
#include "gmenu2x.h"
#include "font.h"
Dialog::Dialog(GMenu2X *gmenu2x) : gmenu2x(gmenu2x)
{
}
void Dialog::drawTitleIcon(Surface& s, const std::string &icon, bool skinRes)
{
Surface *i = NULL;
if (!icon.empty()) {
if (skinRes)
i = gmenu2x->sc.skinRes(icon);
else
i = gmenu2x->sc[icon];
}
if (i==NULL)
i = gmenu2x->sc.skinRes("icons/generic.png");
i->blit(s, 4, (gmenu2x->skinConfInt["topBarHeight"] - 32) / 2);
}
void Dialog::writeTitle(Surface& s, const std::string &title)
{
gmenu2x->font->write(s, title, 40, 0, Font::HAlignLeft, Font::VAlignTop);
}
void Dialog::writeSubTitle(Surface& s, const std::string &subtitle)
{
std::string wrapped = gmenu2x->font->wordWrap(subtitle, gmenu2x->resX - 48);
gmenu2x->font->write(s, wrapped, 40,
gmenu2x->skinConfInt["topBarHeight"]
- gmenu2x->font->getTextHeight(wrapped),
Font::HAlignLeft, Font::VAlignTop);
}