All pastes #1048689 Raw Edit

Add on-when-pushed state to push

public cpp v1 · immutable
#1048689 ·published 2008-06-17 01:24 UTC
rendered paste body
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_pipxmap = 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)+        {+            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); }