if (parent) parent->drawTextCentre(text, area.x + x, area.y + y, colour);
else surface->drawTextCentre(text, x, y, colour);
}
+
+// std::string versions - the switch back to const char* is currently here
+
+void Boxx::drawText(const std::string& text, int x, int y, const DrawStyle& colour)
+{
+ if (parent) parent->drawText(text.c_str(), area.x + x, area.y + y, colour);
+ else surface->drawText(text.c_str(), x, y, colour);
+}
+
+void Boxx::drawText(const std::string& text, int x, int y, int width, const DrawStyle& colour)
+{
+ if (parent) parent->drawText(text.c_str(), area.x + x, area.y + y, width, colour);
+ else surface->drawText(text.c_str(), x, y, width, colour);
+}
+
+void Boxx::drawTextRJ(const std::string& text, int x, int y, const DrawStyle& colour)
+{
+ if (parent) parent->drawTextRJ(text.c_str(), area.x + x, area.y + y, colour);
+ else surface->drawTextRJ(text.c_str(), x, y, colour);
+}
+
+void Boxx::drawTextCentre(const std::string& text, int x, int y, const DrawStyle& colour)
+{
+ if (parent) parent->drawTextCentre(text.c_str(), area.x + x, area.y + y, colour);
+ else surface->drawTextCentre(text.c_str(), x, y, colour);
+}
+
+
// Now deprecated
/*
void Boxx::drawPixelAlpha(UINT x, UINT y, const Colour& colour,bool fastdraw)
void drawText(const char* text, int x, int y, int width, const DrawStyle& colour);
void drawTextRJ(const char* text, int x, int y, const DrawStyle& colour);
void drawTextCentre(const char* text, int x, int y, const DrawStyle& colour);
+ // std::string versions
+ void drawText(const std::string& text, int x, int y, const DrawStyle& colour);
+ void drawText(const std::string& text, int x, int y, int width, const DrawStyle& colour);
+ void drawTextRJ(const std::string& text, int x, int y, const DrawStyle& colour);
+ void drawTextCentre(const std::string& text, int x, int y, const DrawStyle& colour);
//Now deprecated
//void drawPixel(UINT x, UINT y, const Colour& colour, bool fastdraw=false);
void drawBitmap(UINT x, UINT y, const Bitmap& bm, const DisplayRegion& region);
static const char* TAG = "Channel";
-Channel::Channel()
-{
-}
-
-Channel::~Channel()
-{
- if (name) delete[] name;
- index = -1; // just in case
-}
-
void Channel::loadPids()
{
// Clear the list if this is a reload
#ifndef CHANNEL_H
#define CHANNEL_H
-#include <stdio.h>
#include <vector>
+#include <string>
#include "defines.h"
class Channel
{
public:
- Channel();
- ~Channel();
-
void loadPids();
int index{-1};
ULONG number{};
ULONG type{};
UCHAR vstreamtype{2}; //Mpeg2
- char* name{};
-
+ std::string name;
ULONG vpid{};
ULONG numAPids{};
new_channelinfo.numSPids=0;
new_channelinfo.number=0;
new_channelinfo.type=VDR::RADIO;
- new_channelinfo.name=NULL;
new_channelinfo.tpid=0xFFFFF; //unused, check this
new_channelinfo.vpid=0xFFFFF; //unused, check this
new_channelinfo.index=0;
void VChannelList::setList(std::shared_ptr<ChannelList> tlist)
{
- char str[500];
OsdVector *osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
sl.addColumn(0);
for (UINT i = 0; i < chanList->size(); i++)
{
chan = (*chanList)[i];
- sprintf(str, "%lu\t%s", chan->number, chan->name);
+ //sprintf(str, "%lu\t%s", chan->number, chan->name);
+ std::ostringstream os;
+ os << chan->number << '\t' << chan->name;
TVMediaInfo *info=NULL;
if (osdv) {
info= new TVMediaInfo();
if (type == VDR::VIDEO) info->setStaticFallback(sa_tv);
else info->setStaticFallback(sa_radio);
}
- chan->index = sl.addOption(str, chan, first, info);
+ chan->index = sl.addOption(os.str(), chan, first, info);
first = 0;
}
}
if (chan->number == channelNumber) break;
}
- sprintf(tempA, tr("Schedule - %s"), (*chanList)[listIndex]->name);
+ sprintf(tempA, tr("Schedule - %s"), (*chanList)[listIndex]->name.c_str());
setTitleText(tempA);
break;
}
text = takeText;
}
+void WTextbox::setText(const std::string& takeText)
+{
+ text = takeText;
+}
+
void WTextbox::setForegroundColour(const DrawStyle& fcolour)
{
foreColour = fcolour;
public:
WTextbox(const char* ttext = NULL);
void setText(const char* text);
+ void setText(const std::string& text);
void draw();
void setForegroundColour(const DrawStyle& fcolour);
void setTextPos(int x, int y); // optional