All pastes #1053350 Raw Edit

Adding on-when-pushed status to

public cpp v1 · immutable
#1053350 ·published 2008-06-23 16:39 UTC
rendered paste body
Index: libmyth/xmlparse.cpp===================================================================--- libmyth/xmlparse.cpp	(revision 17589)+++ libmyth/xmlparse.cpp	(working copy)@@ -2922,6 +2922,7 @@     QPixmap *image_on = NULL;     QPixmap *image_off = NULL;     QPixmap *image_pushed = NULL;+    QPixmap *image_pushedon = NULL;      QString name = element.attribute("name", "");     if (name.isNull() || name.isEmpty())@@ -2996,6 +2997,14 @@                         cerr << "xmparse.o: I can't find a file called " << (const char *)file << endl ;                     }                 }+                if (imgname.lower() == "pushedon")+                {+                    image_pushedon = gContext->LoadScalePixmap(file);+                    if (!image_pushedon)+                    {+                        cerr << "xmparse.o: I can't find a file called " << (const char *)file << endl ;+                    }+                }             }             else             {@@ -3011,13 +3020,17 @@         image_off = new QPixmap();     if (!image_pushed)         image_pushed = new QPixmap();+    if (!image_pushedon)+        image_pushedon = new QPixmap();      UIPushButtonType *pbt = new UIPushButtonType(name, *image_on, *image_off,-                                                 *image_pushed);+                                                 *image_pushed,+                                                 *image_pushedon);      delete image_on;     delete image_off;     delete image_pushed;+    delete image_pushedon;      pbt->SetScreen(wmult, hmult);     pbt->setPosition(pos);Index: libmyth/uitypes.cpp===================================================================--- libmyth/uitypes.cpp	(revision 17589)+++ libmyth/uitypes.cpp	(working copy)@@ -4830,12 +4830,13 @@  // ******************************************************************** -UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed)+UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QPixmap pushedon)                      : UIType(name) {     on_pixmap = on;     off_pixmap = off;     pushed_pixmap = pushed;+    pushedon_pixmap = pushedon;     currently_pushed = false;     takes_focus = true;     m_lockOn = false;@@ -4864,7 +4865,14 @@      if (currently_pushed)     {-        p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap);+        if (has_focus && !!pushedon_pixmap)+        {+            p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushedon_pixmap);+        }+        else+        {+            p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap);+        }     }     else     {@@ -4931,6 +4939,10 @@     {         width = pushed_pixmap.width();     }+    if (pushedon_pixmap.width() > width)+    {+        width = pushedon_pixmap.width();+    }      height = off_pixmap.height();     if (on_pixmap.height() > height)@@ -4941,6 +4953,10 @@     {         height = pushed_pixmap.height();     }+    if (pushedon_pixmap.height() > height)+    {+        height = pushedon_pixmap.height();+    }      screen_area = QRect(x, y, width, height); }Index: libmyth/uitypes.h===================================================================--- libmyth/uitypes.h	(revision 17589)+++ libmyth/uitypes.h	(working copy)@@ -1182,8 +1182,8 @@    public: -    UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed);-+    UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QPixmap pushedon=QPixmap());+         virtual void Draw(QPainter *, int drawlayer, int context);     void    setPosition(QPoint pos){m_displaypos = pos;}     virtual void calculateScreenArea();@@ -1206,6 +1206,7 @@     QPixmap on_pixmap;     QPixmap off_pixmap;     QPixmap pushed_pixmap;+    QPixmap pushedon_pixmap;     bool    currently_pushed;     QTimer  push_timer;     bool    m_lockOn;