All pastes #1048875 Raw Edit

Adding on-when-pushed status to

public cpp v1 · immutable
#1048875 ·published 2008-06-17 07:12 UTC
rendered paste body
Index: libmyth/xmlparse.cpp===================================================================--- libmyth/xmlparse.cpp	(revision 17481)+++ 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 17481)+++ libmyth/uitypes.cpp	(working copy)@@ -4812,12 +4812,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;@@ -4846,7 +4847,14 @@      if (currently_pushed)     {-        p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap);+        if (has_focus && pushedon_pixmap.width())+        {+            p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushedon_pixmap);+        }+        else+        {+            p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap);+        }     }     else     {@@ -4913,6 +4921,10 @@     {         width = pushed_pixmap.width();     }+    if (pushedon_pixmap.width() > width)+    {+        width = pushedon_pixmap.width();+    }      height = off_pixmap.height();     if (on_pixmap.height() > height)@@ -4923,6 +4935,10 @@     {         height = pushed_pixmap.height();     }+    if (pushedon_pixmap.height() > height)+    {+        height = pushedon_pixmap.height();+    }      screen_area = QRect(x, y, width, height); }@@ -5164,7 +5180,7 @@                                QPixmap off,                                QPixmap pushed,                                QRect area)-               :UIPushButtonType(name, on, off, pushed)+               :UIPushButtonType(name, on, off, pushed, on) {     m_area = area;     my_data.clear();Index: libmyth/uitypes.h===================================================================--- libmyth/uitypes.h	(revision 17481)+++ 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);+         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;