2010-05-05 15:35:52 +03:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "dialog.h"
|
|
|
|
#include "gmenu2x.h"
|
2013-08-03 23:30:12 +03:00
|
|
|
#include "font.h"
|
2010-05-05 15:35:52 +03:00
|
|
|
|
|
|
|
Dialog::Dialog(GMenu2X *gmenu2x) : gmenu2x(gmenu2x)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
void Dialog::drawTitleIcon(Surface& s, const std::string &icon, bool skinRes)
|
2010-05-05 15:35:52 +03:00
|
|
|
{
|
|
|
|
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");
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
i->blit(s, 4, (gmenu2x->skinConfInt["topBarHeight"] - 32) / 2);
|
2010-05-05 15:35:52 +03:00
|
|
|
}
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
void Dialog::writeTitle(Surface& s, const std::string &title)
|
2010-05-05 15:35:52 +03:00
|
|
|
{
|
2014-08-01 00:10:16 +03:00
|
|
|
gmenu2x->font->write(s, title, 40, 0, Font::HAlignLeft, Font::VAlignTop);
|
2010-05-05 15:35:52 +03:00
|
|
|
}
|
|
|
|
|
2014-08-10 05:26:59 +03:00
|
|
|
void Dialog::writeSubTitle(Surface& s, const std::string &subtitle)
|
2010-05-05 15:35:52 +03:00
|
|
|
{
|
2014-07-24 05:52:44 +03:00
|
|
|
std::string wrapped = gmenu2x->font->wordWrap(subtitle, gmenu2x->resX - 48);
|
2014-08-10 05:26:59 +03:00
|
|
|
gmenu2x->font->write(s, wrapped, 40,
|
|
|
|
gmenu2x->skinConfInt["topBarHeight"]
|
|
|
|
- gmenu2x->font->getTextHeight(wrapped),
|
|
|
|
Font::HAlignLeft, Font::VAlignTop);
|
2010-05-05 15:35:52 +03:00
|
|
|
}
|