author | mickeyl <mickeyl> | 2004-11-16 19:14:18 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-11-16 19:14:18 (UTC) |
commit | ea3945a9bd8f9830f70b1efa133f9df13b19362f (patch) (unidiff) | |
tree | f2ea22cc50e9aa8aa73ee7dea148f41c563c9666 /libopie/oticker.cpp | |
parent | 1c6f490e8541626f68422e0a3a7c7281d7f5b7d3 (diff) | |
download | opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.zip opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.gz opie-ea3945a9bd8f9830f70b1efa133f9df13b19362f.tar.bz2 |
libopie1 goes into unsupported
-rw-r--r-- | libopie/oticker.cpp | 132 |
1 files changed, 0 insertions, 132 deletions
diff --git a/libopie/oticker.cpp b/libopie/oticker.cpp deleted file mode 100644 index b41cab6..0000000 --- a/libopie/oticker.cpp +++ b/dev/null | |||
@@ -1,132 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | ||
4 | Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | ||
5 | |||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = General Public License along with | ||
26 | -- :-=` this; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | #include <qpe/config.h> | ||
34 | |||
35 | #include <stdlib.h> | ||
36 | #include <stdio.h> | ||
37 | |||
38 | #include "oticker.h" | ||
39 | |||
40 | OTicker::OTicker( QWidget* parent ) | ||
41 | : QLabel( parent ) { | ||
42 | // : QFrame( parent ) { | ||
43 | setTextFormat(Qt::RichText); | ||
44 | Config cfg("qpe"); | ||
45 | cfg.setGroup("Appearance"); | ||
46 | backgroundcolor = QColor( cfg.readEntry( "Background", "#E5E1D5" ) ); | ||
47 | foregroundcolor= Qt::black; | ||
48 | updateTimerTime = 50; | ||
49 | scrollLength = 1; | ||
50 | } | ||
51 | |||
52 | OTicker::~OTicker() { | ||
53 | } | ||
54 | |||
55 | void OTicker::setBackgroundColor(const QColor& backcolor) { | ||
56 | backgroundcolor = backcolor; | ||
57 | update(); | ||
58 | } | ||
59 | |||
60 | void OTicker::setForegroundColor(const QColor& backcolor) { | ||
61 | foregroundcolor = backcolor; | ||
62 | update(); | ||
63 | } | ||
64 | |||
65 | void OTicker::setFrame(int frameStyle) { | ||
66 | setFrameStyle( frameStyle/*WinPanel | Sunken */); | ||
67 | update(); | ||
68 | } | ||
69 | |||
70 | void OTicker::setText( const QString& text ) { | ||
71 | pos = 0; // reset it everytime the text is changed | ||
72 | scrollText = text; | ||
73 | qDebug(scrollText); | ||
74 | |||
75 | int pixelLen = 0; | ||
76 | bool bigger = false; | ||
77 | int contWidth = contentsRect().width(); | ||
78 | int contHeight = contentsRect().height(); | ||
79 | int pixelTextLen = fontMetrics().width( text ); | ||
80 | printf("<<<<<<<height %d, width %d, text width %d %d\n", contHeight, contWidth, pixelTextLen, scrollText.length()); | ||
81 | if( pixelTextLen < contWidth) | ||
82 | { | ||
83 | pixelLen = contWidth; | ||
84 | } | ||
85 | else | ||
86 | { | ||
87 | bigger = true; | ||
88 | pixelLen = pixelTextLen; | ||
89 | } | ||
90 | QPixmap pm( pixelLen, contHeight); | ||
91 | // pm.fill( QColor( 167, 212, 167 )); | ||
92 | |||
93 | pm.fill(backgroundcolor); | ||
94 | QPainter pmp( &pm ); | ||
95 | pmp.setPen(foregroundcolor ); | ||
96 | pmp.drawText( 0, 0, pixelTextLen, contHeight, AlignVCenter, scrollText ); | ||
97 | pmp.end(); | ||
98 | scrollTextPixmap = pm; | ||
99 | |||
100 | killTimers(); | ||
101 | // qDebug("Scrollupdate %d", updateTimerTime); | ||
102 | if ( bigger /*pixelTextLen > contWidth*/ ) | ||
103 | startTimer( updateTimerTime); | ||
104 | update(); | ||
105 | } | ||
106 | |||
107 | |||
108 | void OTicker::timerEvent( QTimerEvent * ) { | ||
109 | pos = ( pos <= 0 ) ? scrollTextPixmap.width() : pos - scrollLength;//1; | ||
110 | repaint( FALSE ); | ||
111 | } | ||
112 | |||
113 | void OTicker::drawContents( QPainter *p ) { | ||
114 | int pixelLen = scrollTextPixmap.width(); | ||
115 | p->drawPixmap( pos, contentsRect().y(), scrollTextPixmap ); | ||
116 | if ( pixelLen > contentsRect().width() ) // Scrolling | ||
117 | p->drawPixmap( pos - pixelLen, contentsRect().y(), scrollTextPixmap ); | ||
118 | } | ||
119 | |||
120 | void OTicker::mouseReleaseEvent( QMouseEvent * ) { | ||
121 | // qDebug("<<<<<<<>>>>>>>>>"); | ||
122 | emit mousePressed(); | ||
123 | } | ||
124 | |||
125 | void OTicker::setUpdateTime(int time) { | ||
126 | updateTimerTime=time; | ||
127 | } | ||
128 | |||
129 | void OTicker::setScrollLength(int len) { | ||
130 | scrollLength=len; | ||
131 | } | ||
132 | |||