KDEUI
kpixmapsequencewidget.cpp
Go to the documentation of this file.
00001 /* 00002 Copyright 2009 Sebastian Trueg <trueg@kde.org> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Lesser General Public 00006 License as published by the Free Software Foundation; either 00007 version 2.1 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Lesser General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "kpixmapsequencewidget.h" 00021 #include "kpixmapsequenceoverlaypainter.h" 00022 #include "kpixmapsequence.h" 00023 00024 #include <kdebug.h> 00025 00026 00027 class KPixmapSequenceWidget::Private 00028 { 00029 public: 00030 KPixmapSequenceOverlayPainter m_painter; 00031 }; 00032 00033 00034 KPixmapSequenceWidget::KPixmapSequenceWidget(QWidget *parent) 00035 : QWidget(parent), 00036 d(new Private) 00037 { 00038 d->m_painter.setWidget(this); 00039 setSequence(d->m_painter.sequence()); 00040 } 00041 00042 00043 KPixmapSequenceWidget::~KPixmapSequenceWidget() 00044 { 00045 delete d; 00046 } 00047 00048 00049 KPixmapSequence KPixmapSequenceWidget::sequence() const 00050 { 00051 return d->m_painter.sequence(); 00052 } 00053 00054 00055 int KPixmapSequenceWidget::interval() const 00056 { 00057 return d->m_painter.interval(); 00058 } 00059 00060 00061 QSize KPixmapSequenceWidget::sizeHint() const 00062 { 00063 if(d->m_painter.sequence().isValid()) 00064 return d->m_painter.sequence().frameSize(); 00065 else 00066 return QWidget::sizeHint(); 00067 } 00068 00069 00070 void KPixmapSequenceWidget::setSequence(const KPixmapSequence &seq) 00071 { 00072 d->m_painter.setSequence(seq); 00073 if(seq.isValid()) { 00074 setFixedSize(seq.frameSize()); 00075 d->m_painter.start(); 00076 } 00077 else { 00078 d->m_painter.stop(); 00079 } 00080 } 00081 00082 00083 void KPixmapSequenceWidget::setInterval(int msecs) 00084 { 00085 d->m_painter.setInterval(msecs); 00086 } 00087 00088 #include "kpixmapsequencewidget.moc"
KDE 4.6 API Reference