From bcb704366cb5e333a626c18c308c7e0448a8e69f Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- knewsticker/newsscroller.h | 102 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 knewsticker/newsscroller.h (limited to 'knewsticker/newsscroller.h') diff --git a/knewsticker/newsscroller.h b/knewsticker/newsscroller.h new file mode 100644 index 00000000..efe0c3c2 --- /dev/null +++ b/knewsticker/newsscroller.h @@ -0,0 +1,102 @@ +/* + * newsscroller.h + * + * Copyright (c) 2000, 2001 Frerich Raabe + * Copyright (c) 2001 Malte Starostik + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. For licensing and distribution details, check the + * accompanying file 'COPYING'. + */ +#ifndef NEWSSCROLLER_H +#define NEWSSCROLLER_H + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "configaccess.h" +#include "newsengine.h" + +#include +#include +#include + +class QTimer; +class Headline; +template class QPtrList; +typedef QPtrList HeadlineList; + +class NewsScroller : public QFrame +{ + Q_OBJECT + + public: + NewsScroller(QWidget *, ConfigAccess *, const char * = 0); + + virtual QSize sizeHint() const; + virtual QSizePolicy sizePolicy() const; + + // Convenience stuff. Somehow ugly, no? + inline bool horizontal() const + { + return m_cfg->horizontal(static_cast(m_cfg->scrollingDirection())); + } + + inline bool vertical() const + { + return m_cfg->vertical(static_cast(m_cfg->scrollingDirection())); + } + + inline bool rotated() const + { + return m_cfg->rotated(static_cast(m_cfg->scrollingDirection())); + } + + public slots: + void clear(); + void addHeadline(Article::Ptr); + void reset(bool bSeparatorOnly = false); + + signals: + void contextMenu(); + + protected: + virtual void enterEvent(QEvent *); + virtual void mousePressEvent(QMouseEvent *); + virtual void mouseReleaseEvent(QMouseEvent *); + virtual void mouseMoveEvent(QMouseEvent *); + virtual void wheelEvent(QWheelEvent *); + virtual void leaveEvent(QEvent *); + virtual void drawContents(QPainter *); + virtual void dragEnterEvent( QDragEnterEvent *); + virtual void dropEvent(QDropEvent *); + + protected slots: + void scroll(int = 1, bool = true); + void slotTimeout(); + + private: + int scrollWidth() const; + int scrollHeight() const; + bool updateActive(const QPoint &); + bool isHeadline(const QString &) const; + int speedAsInterval( int speed ); + + private: + friend class Headline; + ConfigAccess *m_cfg; + QTimer *m_scrollTimer; + mutable HeadlineList m_headlines; + Headline *m_activeHeadline; + QPixmap m_separator; + int m_offset; + QPoint m_dragPos; + bool m_mouseDrag; + QString m_tempHeadline; + float m_totalStepping; + float m_stepping; +}; + +#endif // NEWSSCROLLER_H -- cgit v1.2.1