author | sandman <sandman> | 2002-06-21 00:30:56 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-21 00:30:56 (UTC) |
commit | b5951d300371cbe78fa94163aa882419e3d08d4b (patch) (unidiff) | |
tree | cc52dbcba8666a86f38585b6e5032c31324e60bf | |
parent | 56649b4725b2e98d786d06f83d4b3281ea1090fb (diff) | |
download | opie-b5951d300371cbe78fa94163aa882419e3d08d4b.zip opie-b5951d300371cbe78fa94163aa882419e3d08d4b.tar.gz opie-b5951d300371cbe78fa94163aa882419e3d08d4b.tar.bz2 |
Fix for background drawing to make taskbar look nice with liquid style
-rw-r--r-- | core/launcher/inputmethods.cpp | 2 | ||||
-rw-r--r-- | core/launcher/mrulist.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index da98e07..ac72b02 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp | |||
@@ -45,64 +45,66 @@ | |||
45 | #ifdef SINGLE_APP | 45 | #ifdef SINGLE_APP |
46 | #include "handwritingimpl.h" | 46 | #include "handwritingimpl.h" |
47 | #include "keyboardimpl.h" | 47 | #include "keyboardimpl.h" |
48 | #include "pickboardimpl.h" | 48 | #include "pickboardimpl.h" |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | 51 | ||
52 | /* XPM */ | 52 | /* XPM */ |
53 | static const char * tri_xpm[]={ | 53 | static const char * tri_xpm[]={ |
54 | "9 9 2 1", | 54 | "9 9 2 1", |
55 | "a c #000000", | 55 | "a c #000000", |
56 | ". c None", | 56 | ". c None", |
57 | ".........", | 57 | ".........", |
58 | ".........", | 58 | ".........", |
59 | ".........", | 59 | ".........", |
60 | "....a....", | 60 | "....a....", |
61 | "...aaa...", | 61 | "...aaa...", |
62 | "..aaaaa..", | 62 | "..aaaaa..", |
63 | ".aaaaaaa.", | 63 | ".aaaaaaa.", |
64 | ".........", | 64 | ".........", |
65 | "........."}; | 65 | "........."}; |
66 | 66 | ||
67 | static const int inputWidgetStyle = QWidget::WStyle_Customize | | 67 | static const int inputWidgetStyle = QWidget::WStyle_Customize | |
68 | QWidget::WStyle_Tool | | 68 | QWidget::WStyle_Tool | |
69 | QWidget::WStyle_StaysOnTop | | 69 | QWidget::WStyle_StaysOnTop | |
70 | QWidget::WGroupLeader; | 70 | QWidget::WGroupLeader; |
71 | 71 | ||
72 | InputMethods::InputMethods( QWidget *parent ) : | 72 | InputMethods::InputMethods( QWidget *parent ) : |
73 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ) | 73 | QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ) |
74 | { | 74 | { |
75 | method = NULL; | 75 | method = NULL; |
76 | 76 | ||
77 | setBackgroundMode ( PaletteBackground ); | ||
78 | |||
77 | QHBoxLayout *hbox = new QHBoxLayout( this ); | 79 | QHBoxLayout *hbox = new QHBoxLayout( this ); |
78 | 80 | ||
79 | kbdButton = new QToolButton( this ); | 81 | kbdButton = new QToolButton( this ); |
80 | kbdButton->setFocusPolicy(NoFocus); | 82 | kbdButton->setFocusPolicy(NoFocus); |
81 | kbdButton->setToggleButton( TRUE ); | 83 | kbdButton->setToggleButton( TRUE ); |
82 | kbdButton->setFixedHeight( 17 ); | 84 | kbdButton->setFixedHeight( 17 ); |
83 | kbdButton->setFixedWidth( 32 ); | 85 | kbdButton->setFixedWidth( 32 ); |
84 | kbdButton->setAutoRaise( TRUE ); | 86 | kbdButton->setAutoRaise( TRUE ); |
85 | kbdButton->setUsesBigPixmap( TRUE ); | 87 | kbdButton->setUsesBigPixmap( TRUE ); |
86 | hbox->addWidget( kbdButton ); | 88 | hbox->addWidget( kbdButton ); |
87 | connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); | 89 | connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); |
88 | 90 | ||
89 | kbdChoice = new QToolButton( this ); | 91 | kbdChoice = new QToolButton( this ); |
90 | kbdChoice->setFocusPolicy(NoFocus); | 92 | kbdChoice->setFocusPolicy(NoFocus); |
91 | kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); | 93 | kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); |
92 | kbdChoice->setFixedHeight( 17 ); | 94 | kbdChoice->setFixedHeight( 17 ); |
93 | kbdChoice->setFixedWidth( 12 ); | 95 | kbdChoice->setFixedWidth( 12 ); |
94 | kbdChoice->setAutoRaise( TRUE ); | 96 | kbdChoice->setAutoRaise( TRUE ); |
95 | hbox->addWidget( kbdChoice ); | 97 | hbox->addWidget( kbdChoice ); |
96 | connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); | 98 | connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); |
97 | 99 | ||
98 | connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), | 100 | connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), |
99 | this, SLOT(resetStates()) ); | 101 | this, SLOT(resetStates()) ); |
100 | 102 | ||
101 | loadInputMethods(); | 103 | loadInputMethods(); |
102 | } | 104 | } |
103 | 105 | ||
104 | InputMethods::~InputMethods() | 106 | InputMethods::~InputMethods() |
105 | { | 107 | { |
106 | #ifndef SINGLE_APP | 108 | #ifndef SINGLE_APP |
107 | QValueList<InputMethod>::Iterator mit; | 109 | QValueList<InputMethod>::Iterator mit; |
108 | for ( mit = inputMethodList.begin(); mit != inputMethodList.end(); ++mit ) { | 110 | for ( mit = inputMethodList.begin(); mit != inputMethodList.end(); ++mit ) { |
diff --git a/core/launcher/mrulist.cpp b/core/launcher/mrulist.cpp index 5590d38..0530fd6 100644 --- a/core/launcher/mrulist.cpp +++ b/core/launcher/mrulist.cpp | |||
@@ -11,65 +11,65 @@ | |||
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #include "mrulist.h" | 22 | #include "mrulist.h" |
23 | 23 | ||
24 | #include <qpe/global.h> | 24 | #include <qpe/global.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
27 | 27 | ||
28 | #include <qframe.h> | 28 | #include <qframe.h> |
29 | #include <qpushbutton.h> | 29 | #include <qpushbutton.h> |
30 | #include <qtoolbutton.h> | 30 | #include <qtoolbutton.h> |
31 | #include <qpopupmenu.h> | 31 | #include <qpopupmenu.h> |
32 | #include <qpainter.h> | 32 | #include <qpainter.h> |
33 | #include <qwindowsystem_qws.h> | 33 | #include <qwindowsystem_qws.h> |
34 | 34 | ||
35 | 35 | ||
36 | QList<MRUList>*MRUList::MRUListWidgets = NULL; | 36 | QList<MRUList>*MRUList::MRUListWidgets = NULL; |
37 | QList<AppLnk>*MRUList::task = NULL; | 37 | QList<AppLnk>*MRUList::task = NULL; |
38 | 38 | ||
39 | 39 | ||
40 | MRUList::MRUList( QWidget *parent ) | 40 | MRUList::MRUList( QWidget *parent ) |
41 | : QFrame( parent ), selected(-1), oldsel(-1) | 41 | : QFrame( parent ), selected(-1), oldsel(-1) |
42 | { | 42 | { |
43 | setBackgroundMode( PaletteButton ); | 43 | setBackgroundMode( PaletteBackground ); |
44 | if (!MRUListWidgets) | 44 | if (!MRUListWidgets) |
45 | MRUListWidgets = new QList<MRUList>; | 45 | MRUListWidgets = new QList<MRUList>; |
46 | if (!task) | 46 | if (!task) |
47 | task = new QList<AppLnk>; | 47 | task = new QList<AppLnk>; |
48 | MRUListWidgets->append( this ); | 48 | MRUListWidgets->append( this ); |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | MRUList::~MRUList() | 52 | MRUList::~MRUList() |
53 | { | 53 | { |
54 | if (MRUListWidgets) | 54 | if (MRUListWidgets) |
55 | MRUListWidgets->remove( this ); | 55 | MRUListWidgets->remove( this ); |
56 | if (task) | 56 | if (task) |
57 | task->setAutoDelete( TRUE ); | 57 | task->setAutoDelete( TRUE ); |
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | QSize MRUList::sizeHint() const | 61 | QSize MRUList::sizeHint() const |
62 | { | 62 | { |
63 | return QSize( frameWidth(), 16 ); | 63 | return QSize( frameWidth(), 16 ); |
64 | } | 64 | } |
65 | 65 | ||
66 | // thanks to John from Trolltech | 66 | // thanks to John from Trolltech |
67 | void MRUList::removeTask(const QString &appName ) | 67 | void MRUList::removeTask(const QString &appName ) |
68 | { | 68 | { |
69 | qWarning("MRULList::removeTask( %s)", appName.latin1() ); | 69 | qWarning("MRULList::removeTask( %s)", appName.latin1() ); |
70 | if(appName.isEmpty() ) | 70 | if(appName.isEmpty() ) |
71 | return; | 71 | return; |
72 | 72 | ||
73 | if(!task ) // at least it should be called once before | 73 | if(!task ) // at least it should be called once before |
74 | return; | 74 | return; |
75 | unsigned int i= 0; | 75 | unsigned int i= 0; |
@@ -174,50 +174,51 @@ void MRUList::mousePressEvent(QMouseEvent *e) | |||
174 | } | 174 | } |
175 | } else { | 175 | } else { |
176 | break; | 176 | break; |
177 | } | 177 | } |
178 | } | 178 | } |
179 | selected = -1; | 179 | selected = -1; |
180 | repaint( FALSE ); | 180 | repaint( FALSE ); |
181 | } | 181 | } |
182 | 182 | ||
183 | 183 | ||
184 | void MRUList::mouseReleaseEvent(QMouseEvent *) | 184 | void MRUList::mouseReleaseEvent(QMouseEvent *) |
185 | { | 185 | { |
186 | if ( selected >= 0 ) { | 186 | if ( selected >= 0 ) { |
187 | if ( parentWidget() ) | 187 | if ( parentWidget() ) |
188 | if ( parentWidget()->isA( "QPopupMenu" ) ) | 188 | if ( parentWidget()->isA( "QPopupMenu" ) ) |
189 | parentWidget()->hide(); | 189 | parentWidget()->hide(); |
190 | Global::execute( task->at(selected)->exec() ); | 190 | Global::execute( task->at(selected)->exec() ); |
191 | selected = -1; | 191 | selected = -1; |
192 | oldsel = -1; | 192 | oldsel = -1; |
193 | update(); | 193 | update(); |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | 197 | ||
198 | void MRUList::paintEvent( QPaintEvent * ) | 198 | void MRUList::paintEvent( QPaintEvent * ) |
199 | { | 199 | { |
200 | QPainter p( this ); | 200 | QPainter p( this ); |
201 | AppLnk *t; | 201 | AppLnk *t; |
202 | int x = 0; | 202 | int x = 0; |
203 | int y = (height() - 14) / 2; | 203 | int y = (height() - 14) / 2; |
204 | int i = 0; | 204 | int i = 0; |
205 | 205 | ||
206 | p.fillRect( 0, 0, width(), height(), colorGroup().background() ); | 206 | // p.fillRect( 0, 0, width(), height(), colorGroup().background() ); |
207 | erase ( ); | ||
207 | 208 | ||
208 | if ( task ) { | 209 | if ( task ) { |
209 | QListIterator<AppLnk> it( *task ); | 210 | QListIterator<AppLnk> it( *task ); |
210 | for ( ; it.current(); i++, ++it ) { | 211 | for ( ; it.current(); i++, ++it ) { |
211 | if ( x + 15 <= width() ) { | 212 | if ( x + 15 <= width() ) { |
212 | t = it.current(); | 213 | t = it.current(); |
213 | if ( (int)i == selected ) | 214 | if ( (int)i == selected ) |
214 | p.fillRect( x, y, 15, t->pixmap().height()+1, colorGroup().highlight() ); | 215 | p.fillRect( x, y, 15, t->pixmap().height()+1, colorGroup().highlight() ); |
215 | else if ( (int)i == oldsel ) | 216 | else if ( (int)i == oldsel ) |
216 | p.eraseRect( x, y, 15, t->pixmap().height()+1 ); | 217 | p.eraseRect( x, y, 15, t->pixmap().height()+1 ); |
217 | p.drawPixmap( x, y, t->pixmap() ); | 218 | p.drawPixmap( x, y, t->pixmap() ); |
218 | x += 15; | 219 | x += 15; |
219 | } | 220 | } |
220 | } | 221 | } |
221 | } | 222 | } |
222 | } | 223 | } |
223 | 224 | ||