summaryrefslogtreecommitdiff
path: root/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
Unidiff
Diffstat (limited to 'noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp97
1 files changed, 0 insertions, 97 deletions
diff --git a/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp b/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
deleted file mode 100644
index 3bdc820..0000000
--- a/noncore/todayplugins/stockticker/stocktickerlib/ticker.cpp
+++ b/dev/null
@@ -1,97 +0,0 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =.
8 .=l.
9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details.
24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA.
31
32*/
33
34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h>
36#include <qpe/config.h>
37
38#include <qwidget.h>
39#include <qpixmap.h>
40#include <qbutton.h>
41#include <qpainter.h>
42#include <qframe.h>
43#include <qlayout.h>
44#include <qdir.h>
45#include <stdlib.h>
46#include <stdio.h>
47
48#include "ticker.h"
49
50Ticker::Ticker( QWidget* parent=0 ) : QFrame( parent ) {
51 setFrameStyle( NoFrame/*WinPanel | Sunken */);
52}
53
54Ticker::~Ticker() {
55}
56
57void Ticker::setText( const QString& text ) {
58 Config cfg("qpe");
59 cfg.setGroup("Appearance");
60
61 pos = 0; // reset it everytime the text is changed
62 scrollText = text;
63
64 int pixelLen = fontMetrics().width( text );
65 QPixmap pm( pixelLen, contentsRect().height() );
66// pm.fill( QColor( 167, 212, 167 ));
67
68 pm.fill( QColor( cfg.readEntry( "Background", "#E5E1D5" ) ));
69 QPainter pmp( &pm );
70 pmp.setPen( Qt::black );
71 pmp.drawText( 0, 0, pixelLen, contentsRect().height(), AlignVCenter, scrollText );
72 pmp.end();
73 scrollTextPixmap = pm;
74
75 killTimers();
76 if ( pixelLen > contentsRect().width() )
77 startTimer( 50 );
78 update();
79}
80
81
82void Ticker::timerEvent( QTimerEvent * ) {
83 pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - 1;
84 repaint( FALSE );
85}
86
87void Ticker::drawContents( QPainter *p ) {
88 int pixelLen = scrollTextPixmap.width();
89 p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap );
90 if ( pixelLen > contentsRect().width() ) // Scrolling
91 p->drawPixmap( pos - pixelLen, contentsRect().y(), scrollTextPixmap );
92}
93
94void Ticker::mouseReleaseEvent( QMouseEvent * e) {
95 qDebug("<<<<<<<>>>>>>>>>");
96 emit mousePressed();
97}