Ticket #5465: adds_onwhenpushed_to_pushbuttons.diff

File adds_onwhenpushed_to_pushbuttons.diff, 3.9 KB (added by reynaldo@…, 16 years ago)

Patch agains mythtv/libs adding optional on-when-pushed rollover to pushbuttons

  • libmyth/xmlparse.cpp

     
    29222922    QPixmap *image_on = NULL;
    29232923    QPixmap *image_off = NULL;
    29242924    QPixmap *image_pushed = NULL;
     2925    QPixmap *image_pushedon = NULL;
    29252926
    29262927    QString name = element.attribute("name", "");
    29272928    if (name.isNull() || name.isEmpty())
     
    29962997                        cerr << "xmparse.o: I can't find a file called " << (const char *)file << endl ;
    29972998                    }
    29982999                }
     3000                if (imgname.lower() == "pushedon")
     3001                {
     3002                    image_pushedon = gContext->LoadScalePixmap(file);
     3003                    if (!image_pushedon)
     3004                    {
     3005                        cerr << "xmparse.o: I can't find a file called " << (const char *)file << endl ;
     3006                    }
     3007                }
    29993008            }
    30003009            else
    30013010            {
     
    30113020        image_off = new QPixmap();
    30123021    if (!image_pushed)
    30133022        image_pushed = new QPixmap();
     3023    if (!image_pushedon)
     3024        image_pushedon = new QPixmap();
    30143025
    30153026    UIPushButtonType *pbt = new UIPushButtonType(name, *image_on, *image_off,
    3016                                                  *image_pushed);
     3027                                                 *image_pushed,
     3028                                                 *image_pushedon);
    30173029
    30183030    delete image_on;
    30193031    delete image_off;
    30203032    delete image_pushed;
     3033    delete image_pushedon;
    30213034
    30223035    pbt->SetScreen(wmult, hmult);
    30233036    pbt->setPosition(pos);
  • libmyth/uitypes.cpp

     
    48304830
    48314831// ********************************************************************
    48324832
    4833 UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed)
     4833UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QPixmap pushedon)
    48344834                     : UIType(name)
    48354835{
    48364836    on_pixmap = on;
    48374837    off_pixmap = off;
    48384838    pushed_pixmap = pushed;
     4839    pushedon_pixmap = pushedon;
    48394840    currently_pushed = false;
    48404841    takes_focus = true;
    48414842    m_lockOn = false;
     
    48644865
    48654866    if (currently_pushed)
    48664867    {
    4867         p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap);
     4868        if (has_focus && !!pushedon_pixmap)
     4869        {
     4870            p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushedon_pixmap);
     4871        }
     4872        else
     4873        {
     4874            p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap);
     4875        }
    48684876    }
    48694877    else
    48704878    {
     
    49314939    {
    49324940        width = pushed_pixmap.width();
    49334941    }
     4942    if (pushedon_pixmap.width() > width)
     4943    {
     4944        width = pushedon_pixmap.width();
     4945    }
    49344946
    49354947    height = off_pixmap.height();
    49364948    if (on_pixmap.height() > height)
     
    49414953    {
    49424954        height = pushed_pixmap.height();
    49434955    }
     4956    if (pushedon_pixmap.height() > height)
     4957    {
     4958        height = pushedon_pixmap.height();
     4959    }
    49444960
    49454961    screen_area = QRect(x, y, width, height);
    49464962}
  • libmyth/uitypes.h

     
    11821182
    11831183  public:
    11841184
    1185     UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed);
    1186 
     1185    UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QPixmap pushedon=QPixmap());
     1186   
    11871187    virtual void Draw(QPainter *, int drawlayer, int context);
    11881188    void    setPosition(QPoint pos){m_displaypos = pos;}
    11891189    virtual void calculateScreenArea();
     
    12061206    QPixmap on_pixmap;
    12071207    QPixmap off_pixmap;
    12081208    QPixmap pushed_pixmap;
     1209    QPixmap pushedon_pixmap;
    12091210    bool    currently_pushed;
    12101211    QTimer  push_timer;
    12111212    bool    m_lockOn;