self.l.setElementPosition(self.l.celServiceName, eRect(0, 0, self.instance.size().width(), 28))
else:
self.instance.setItemHeight(28)
- self.l.setElementFont(self.l.celServiceName, gFont("Arial", 22))
- self.l.setElementPosition(self.l.celServiceName, eRect(50, 0, self.instance.size().width(), 28))
self.l.setElementFont(self.l.celServiceNumber, gFont("Arial", 20))
- self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 2, 50, 28))
+ self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, 40, 28))
+ self.l.setElementFont(self.l.celServiceName, gFont("Arial", 22))
+ self.l.setElementPosition(self.l.celServiceName, eRect(50, 0, self.instance.size().width()-50, 28))
+ self.l.setElementFont(self.l.celServiceInfo, gFont("Arial", 18))
self.l.setVisualMode(eListboxServiceContent.visModeComplex)
#include <lib/service/listboxservice.h>
#include <lib/service/service.h>
+#include <lib/gdi/font.h>
+#include <lib/dvb/epgcache.h>
void eListboxServiceContent::setRoot(const eServiceReference &root)
{
DEFINE_REF(eListboxServiceContent);
eListboxServiceContent::eListboxServiceContent()
- :m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_numberoffset(0)
+ :epgcache(eEPGCache::getInstance()), m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_numberoffset(0)
{
cursorHome();
eServiceCenter::getInstance(m_service_center);
{
if (!m_element_font[e])
continue;
- painter.setFont(m_element_font[e]);
-
+ int flags=gPainter::RT_VALIGN_CENTER;
+
+ eRect area = m_element_position[e];
+
std::string text = "<n/a>";
-
+
switch (e)
{
- case celServiceName:
- {
- if (service_info)
- service_info->getName(*m_cursor, text);
- break;
- }
+ case celIcon:
+ // render icon here...
+ continue;
case celServiceNumber:
{
char bla[10];
sprintf(bla, "%d", m_numberoffset + m_cursor_number + 1);
text = bla;
+ flags|=gPainter::RT_HALIGN_RIGHT;
+ break;
+ }
+ case celServiceName:
+ {
+ if (service_info)
+ service_info->getName(*m_cursor, text);
break;
}
case celServiceInfo:
{
- text = "now&next";
+ ePtr<eServiceEvent> evt;
+ time_t t=-1;
+ if ( !epgcache->lookupEventTime(*m_cursor, t, evt) )
+ text = '(' + evt->getEventName() + ')';
+ else
+ continue;
break;
}
- case celIcon:
- continue;
}
-
- eRect area = m_element_position[e];
- area.moveBy(offset.x(), offset.y());
-
- painter.renderText(area, text);
+
+ eTextPara *para = new eTextPara(area);
+
+ para->setFont(m_element_font[e]);
+ para->renderString(text);
+
+ if (e == celServiceName)
+ {
+ eRect bbox = para->getBoundBox();
+ int name_width = bbox.width()+10;
+ m_element_position[celServiceInfo].setLeft(area.left()+name_width);
+ m_element_position[celServiceInfo].setTop(area.top());
+ m_element_position[celServiceInfo].setWidth(area.width()-name_width);
+ m_element_position[celServiceInfo].setHeight(area.height());
+ }
+
+ if (flags & gPainter::RT_HALIGN_RIGHT)
+ para->realign(eTextPara::dirRight);
+ else if (flags & gPainter::RT_HALIGN_CENTER)
+ para->realign(eTextPara::dirCenter);
+ else if (flags & gPainter::RT_HALIGN_BLOCK)
+ para->realign(eTextPara::dirBlock);
+
+ ePoint offs = offset;
+
+ if (flags & gPainter::RT_VALIGN_CENTER)
+ {
+ eRect bbox = para->getBoundBox();
+ int vcentered_top = (area.height() - bbox.height()) / 2;
+ int correction = vcentered_top - bbox.top();
+ offs += ePoint(0, correction);
+ }
+
+ painter.renderPara(para, offs);
}
if (selected)