1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-22 23:20:37 +02:00
gmenu2x/src/dialog.cpp
2011-05-09 05:17:25 +02:00

45 lines
952 B
C++

#include <string>
#include "dialog.h"
#include "gmenu2x.h"
#include "asfont.h"
Dialog::Dialog(GMenu2X *gmenu2x) : gmenu2x(gmenu2x)
{
}
void Dialog::drawTitleIcon(const std::string &icon, bool skinRes, Surface *s)
{
if (s==NULL)
s = gmenu2x->s;
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(const std::string &title, Surface *s)
{
if (s==NULL)
s = gmenu2x->s;
s->write(gmenu2x->font, title, 40, gmenu2x->skinConfInt["topBarHeight"]/4, ASFont::HAlignLeft, ASFont::VAlignMiddle);
}
void Dialog::writeSubTitle(const std::string &subtitle, Surface *s)
{
if (s==NULL)
s = gmenu2x->s;
s->write(gmenu2x->font, subtitle, 40, gmenu2x->skinConfInt["topBarHeight"]/4*3, ASFont::HAlignLeft, ASFont::VAlignMiddle);
}