1 #ifndef __lib_gui_subtitle_h
2 #define __lib_gui_subtitle_h
4 #include <lib/gui/ewidget.h>
5 #include <lib/dvb/teletext.h>
6 #include <lib/dvb/subtitle.h>
8 struct ePangoSubtitlePageElement
12 std::string m_pango_line;
14 ePangoSubtitlePageElement(const gRGB &color, const std::string &text)
15 : m_color(color), m_have_color(true), m_pango_line(text)
18 ePangoSubtitlePageElement(const std::string &text)
19 : m_have_color(false), m_pango_line(text)
24 struct ePangoSubtitlePage
27 int m_timeout; /* in milliseconds */
28 std::vector<ePangoSubtitlePageElement> m_elements;
29 void clear() { m_elements.clear(); }
32 struct eVobSubtitlePage
35 int m_timeout; /* in milliseconds */
36 ePtr<gPixmap> m_pixmap;
39 class eDVBTeletextSubtitlePage;
40 class eDVBSubtitlePage;
42 class eSubtitleWidget: public eWidget, public Object
45 eSubtitleWidget(eWidget *parent);
47 void setPage(const eDVBTeletextSubtitlePage &p);
48 void setPage(const eDVBSubtitlePage &p);
49 void setPage(const ePangoSubtitlePage &p);
51 void setPixmap(ePtr<gPixmap> &pixmap, gRegion changed, eRect dest = eRect(0, 0, 720, 576));
53 typedef enum { Subtitle_TTX, Subtitle_Regular, Subtitle_Bold, Subtitle_Italic, Subtitle_MAX } subfont_t;
57 int have_foreground_color, have_shadow_color;
58 gRGB foreground_color, shadow_color;
63 static void setFontStyle(subfont_t face, gFont *font, int autoColor, const gRGB &col, const gRGB &shadowCol, const ePoint &shadowOffset);
66 int event(int event, void *data=0, void *data2=0);
69 eDVBTeletextSubtitlePage m_page;
72 eDVBSubtitlePage m_dvb_page;
75 ePangoSubtitlePage m_pango_page;
77 ePtr<eTimer> m_hide_subtitles_timer;
79 gRegion m_visible_region;
81 static eSubtitleStyle subtitleStyles[Subtitle_MAX];
83 ePtr<gPixmap> m_pixmap; // pixmap to paint on next evtPaint