make eSubtitleWidget more flexible
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 27 Mar 2008 19:19:33 +0000 (19:19 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 27 Mar 2008 19:19:33 +0000 (19:19 +0000)
lib/gui/esubtitle.cpp
lib/gui/esubtitle.h

index aef09a2..80211b4 100644 (file)
@@ -75,6 +75,12 @@ void eSubtitleWidget::clearPage()
        m_visible_region.rects.clear();
 }
 
        m_visible_region.rects.clear();
 }
 
+void eSubtitleWidget::setPixmap(ePtr<gPixmap> &pixmap, gRegion changed)
+{
+       m_pixmap = pixmap;
+       invalidate(changed);
+}
+
 int eSubtitleWidget::event(int event, void *data, void *data2)
 {
        switch (event)
 int eSubtitleWidget::event(int event, void *data, void *data2)
 {
        switch (event)
@@ -85,14 +91,15 @@ int eSubtitleWidget::event(int event, void *data, void *data2)
                gPainter &painter = *(gPainter*)data2;
 
                getStyle(style);
                gPainter &painter = *(gPainter*)data2;
 
                getStyle(style);
-               
                eWidget::event(event, data, data2);
                eWidget::event(event, data, data2);
-               ePtr<gFont> font = new gFont("Regular", 38);
-               painter.setFont(font);
-               
-               if (m_page_ok)
+
+               if (m_pixmap)
+                       painter.blit(m_pixmap, ePoint(0,0));
+               else if (m_page_ok)
                {
                        int elements = m_page.m_elements.size();
                {
                        int elements = m_page.m_elements.size();
+                       ePtr<gFont> font = new gFont("Regular", 38);
+                       painter.setFont(font);
                        for (int i=0; i<elements; ++i)
                        {
                                eDVBTeletextSubtitlePageElement &element = m_page.m_elements[i];
                        for (int i=0; i<elements; ++i)
                        {
                                eDVBTeletextSubtitlePageElement &element = m_page.m_elements[i];
index 4d65e17..1554277 100644 (file)
@@ -16,6 +16,7 @@ public:
        void setPage(const eDVBSubtitlePage &p);
        void clearPage();
 
        void setPage(const eDVBSubtitlePage &p);
        void clearPage();
 
+       void setPixmap(ePtr<gPixmap> &pixmap, gRegion changed);
 protected:
        int event(int event, void *data=0, void *data2=0);
 
 protected:
        int event(int event, void *data=0, void *data2=0);
 
@@ -29,6 +30,8 @@ private:
        eTimer m_hide_subtitles_timer;
 
        gRegion m_visible_region;
        eTimer m_hide_subtitles_timer;
 
        gRegion m_visible_region;
+
+       ePtr<gPixmap> m_pixmap;  // pixmap to paint on next evtPaint
 };
 
 #endif
 };
 
 #endif