summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/styles/liquid/liquid.cpp5
-rw-r--r--noncore/styles/liquid/liquid.pro2
-rw-r--r--noncore/styles/liquid/liquiddeco.cpp183
-rw-r--r--noncore/styles/liquid/liquiddeco.h41
4 files changed, 231 insertions, 0 deletions
diff --git a/noncore/styles/liquid/liquid.cpp b/noncore/styles/liquid/liquid.cpp
index 2b6eaa4..9a7d2dd 100644
--- a/noncore/styles/liquid/liquid.cpp
+++ b/noncore/styles/liquid/liquid.cpp
@@ -1,36 +1,37 @@
1/*- 1/*-
2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved. 2 * Copyright (C)QPL 2001 Daniel M. Duley. All rights reserved.
3 */ 3 */
4 4
5 5
6 6
7#ifndef INCLUDE_MENUITEM_DEF 7#ifndef INCLUDE_MENUITEM_DEF
8#define INCLUDE_MENUITEM_DEF 8#define INCLUDE_MENUITEM_DEF
9#endif 9#endif
10 10
11#include <qmenudata.h> 11#include <qmenudata.h>
12#include "liquid.h" 12#include "liquid.h"
13#include "liquiddeco.h"
13#include <qapplication.h> 14#include <qapplication.h>
14#include <qpe/config.h> 15#include <qpe/config.h>
15#include "effects.h" 16#include "effects.h"
16#include <qpalette.h> 17#include <qpalette.h>
17#include <qbitmap.h> 18#include <qbitmap.h>
18#include <qtabbar.h> 19#include <qtabbar.h>
19#include <qpopupmenu.h> 20#include <qpopupmenu.h>
20#include <qobjectlist.h> 21#include <qobjectlist.h>
21#include <qimage.h> 22#include <qimage.h>
22#include <qtimer.h> 23#include <qtimer.h>
23#include <qpixmapcache.h> 24#include <qpixmapcache.h>
24#include <qradiobutton.h> 25#include <qradiobutton.h>
25#include <qcombobox.h> 26#include <qcombobox.h>
26#include <qdrawutil.h> 27#include <qdrawutil.h>
27#include <qwidgetlist.h> 28#include <qwidgetlist.h>
28#include <qtoolbutton.h> 29#include <qtoolbutton.h>
29#include <qheader.h> 30#include <qheader.h>
30#include <unistd.h> 31#include <unistd.h>
31#include <qmenubar.h> 32#include <qmenubar.h>
32 33
33 34
34#include <stdio.h> 35#include <stdio.h>
35 36
36#include "htmlmasks.h" 37#include "htmlmasks.h"
@@ -966,57 +967,61 @@ void LiquidStyle::unPolish(QWidget *w)
966 } 967 }
967 if(w->inherits("QToolBar")){ 968 if(w->inherits("QToolBar")){
968 w->removeEventFilter(this); 969 w->removeEventFilter(this);
969 w->setBackgroundMode(QWidget::PaletteBackground); 970 w->setBackgroundMode(QWidget::PaletteBackground);
970 return; 971 return;
971 } 972 }
972 if(w->inherits("QHeader")){ 973 if(w->inherits("QHeader")){
973 w->setMouseTracking(false); 974 w->setMouseTracking(false);
974 w->removeEventFilter(this); 975 w->removeEventFilter(this);
975 } 976 }
976} 977}
977 978
978void LiquidStyle::polish(QApplication *app) 979void LiquidStyle::polish(QApplication *app)
979{ 980{
980 981
981 QWindowsStyle::polish(app); 982 QWindowsStyle::polish(app);
982 menuAni = app->isEffectEnabled(UI_AnimateMenu); 983 menuAni = app->isEffectEnabled(UI_AnimateMenu);
983 menuFade = app->isEffectEnabled(UI_FadeMenu); 984 menuFade = app->isEffectEnabled(UI_FadeMenu);
984 if(menuAni) 985 if(menuAni)
985 app->setEffectEnabled(UI_AnimateMenu, false); 986 app->setEffectEnabled(UI_AnimateMenu, false);
986 if(menuFade) 987 if(menuFade)
987 app->setEffectEnabled(UI_FadeMenu, false); 988 app->setEffectEnabled(UI_FadeMenu, false);
988 989
989 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem); 990 qt_set_draw_menu_bar_impl((QDrawMenuBarItemImpl) &LiquidStyle::drawMenuBarItem);
991
992 QApplication::qwsSetDecoration ( new LiquidDecoration ( ));
990} 993}
991 994
992void LiquidStyle::unPolish(QApplication *app) 995void LiquidStyle::unPolish(QApplication *app)
993{ 996{
994 QWindowsStyle::unPolish(app); 997 QWindowsStyle::unPolish(app);
995 app->setEffectEnabled(UI_AnimateMenu, menuAni); 998 app->setEffectEnabled(UI_AnimateMenu, menuAni);
996 app->setEffectEnabled(UI_FadeMenu, menuFade); 999 app->setEffectEnabled(UI_FadeMenu, menuFade);
997 1000
998 qt_set_draw_menu_bar_impl ( 0 ); 1001 qt_set_draw_menu_bar_impl ( 0 );
1002
1003 QApplication::qwsSetDecoration ( new QPEDecoration ( ));
999} 1004}
1000 1005
1001/* 1006/*
1002 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to 1007 * This is a fun method ;-) Here's an overview. KToolBar grabs resize to
1003 * force everything to erase and repaint on resize. This is going away, I'm 1008 * force everything to erase and repaint on resize. This is going away, I'm
1004 * trying to get shaped widgets to work right without masking. QPushButton, 1009 * trying to get shaped widgets to work right without masking. QPushButton,
1005 * QComboBox, and Panel applet handles capture mouse enter and leaves in order 1010 * QComboBox, and Panel applet handles capture mouse enter and leaves in order
1006 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and 1011 * to set the highlightwidget and repaint for mouse hovers. CheckBoxes and
1007 * RadioButtons need to do this differently. Qt buffers these in pixmaps and 1012 * RadioButtons need to do this differently. Qt buffers these in pixmaps and
1008 * caches them in QPixmapCache, which is bad for doing things like hover 1013 * caches them in QPixmapCache, which is bad for doing things like hover
1009 * because the style methods aren't called in paintEvents if everything 1014 * because the style methods aren't called in paintEvents if everything
1010 * is cached. We use our own Paint event handler instead. Taskbuttons and 1015 * is cached. We use our own Paint event handler instead. Taskbuttons and
1011 * pager buttons draw into a pixmap buffer, so we handle those with palette 1016 * pager buttons draw into a pixmap buffer, so we handle those with palette
1012 * modifications. For QHeader, different header items are actually one widget 1017 * modifications. For QHeader, different header items are actually one widget
1013 * that draws multiple items, so we need to check which ID is hightlighted 1018 * that draws multiple items, so we need to check which ID is hightlighted
1014 * and draw it. Finally, we also check enter and leave events for QLineEdit, 1019 * and draw it. Finally, we also check enter and leave events for QLineEdit,
1015 * since if it's inside a combobox we want to highlight the combobox during 1020 * since if it's inside a combobox we want to highlight the combobox during
1016 * hovering in the edit. 1021 * hovering in the edit.
1017 */ 1022 */
1018bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev) 1023bool LiquidStyle::eventFilter(QObject *obj, QEvent *ev)
1019{ 1024{
1020 if(obj->inherits("QToolBar")){ 1025 if(obj->inherits("QToolBar")){
1021 if(ev->type() == QEvent::Resize){ 1026 if(ev->type() == QEvent::Resize){
1022 const QObjectList *tbChildList = obj->children(); 1027 const QObjectList *tbChildList = obj->children();
diff --git a/noncore/styles/liquid/liquid.pro b/noncore/styles/liquid/liquid.pro
index 8689d3d..23dce09 100644
--- a/noncore/styles/liquid/liquid.pro
+++ b/noncore/styles/liquid/liquid.pro
@@ -1,28 +1,30 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG = qt embedded release warn_on 2CONFIG = qt embedded release warn_on
3SOURCES = liquid.cpp \ 3SOURCES = liquid.cpp \
4 liquiddeco.cpp \
4 effects.cpp \ 5 effects.cpp \
5 plugin.cpp 6 plugin.cpp
6 7
7HEADERS = liquid.h \ 8HEADERS = liquid.h \
9 liquiddeco.h \
8 effects.h 10 effects.h
9LIBS += -lqpe 11LIBS += -lqpe
10INCLUDEPATH += $(OPIEDIR)/include 12INCLUDEPATH += $(OPIEDIR)/include
11DESTDIR = $(OPIEDIR)/plugins/styles 13DESTDIR = $(OPIEDIR)/plugins/styles
12TARGET = liquid 14TARGET = liquid
13VERSION = 1.0.0 15VERSION = 1.0.0
14 16
15TRANSLATIONS = ../../../i18n/de/libliquid.ts \ 17TRANSLATIONS = ../../../i18n/de/libliquid.ts \
16 ../../../i18n/en/libliquid.ts \ 18 ../../../i18n/en/libliquid.ts \
17 ../../../i18n/es/libliquid.ts \ 19 ../../../i18n/es/libliquid.ts \
18 ../../../i18n/fr/libliquid.ts \ 20 ../../../i18n/fr/libliquid.ts \
19 ../../../i18n/hu/libliquid.ts \ 21 ../../../i18n/hu/libliquid.ts \
20 ../../../i18n/ja/libliquid.ts \ 22 ../../../i18n/ja/libliquid.ts \
21 ../../../i18n/ko/libliquid.ts \ 23 ../../../i18n/ko/libliquid.ts \
22 ../../../i18n/no/libliquid.ts \ 24 ../../../i18n/no/libliquid.ts \
23 ../../../i18n/pl/libliquid.ts \ 25 ../../../i18n/pl/libliquid.ts \
24 ../../../i18n/pt/libliquid.ts \ 26 ../../../i18n/pt/libliquid.ts \
25 ../../../i18n/pt_BR/libliquid.ts \ 27 ../../../i18n/pt_BR/libliquid.ts \
26 ../../../i18n/sl/libliquid.ts \ 28 ../../../i18n/sl/libliquid.ts \
27 ../../../i18n/zh_CN/libliquid.ts \ 29 ../../../i18n/zh_CN/libliquid.ts \
28 ../../../i18n/zh_TW/libliquid.ts 30 ../../../i18n/zh_TW/libliquid.ts
diff --git a/noncore/styles/liquid/liquiddeco.cpp b/noncore/styles/liquid/liquiddeco.cpp
new file mode 100644
index 0000000..8eee1b1
--- a/dev/null
+++ b/noncore/styles/liquid/liquiddeco.cpp
@@ -0,0 +1,183 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20
21#include <qapplication.h>
22#include <qstyle.h>
23#include <qwidget.h>
24#include <qpainter.h>
25#include <qtimer.h>
26#include <qwhatsthis.h>
27#include <qpe/qcopenvelope_qws.h>
28#include <qpe/qpedecoration_qws.h>
29#include <qdialog.h>
30#include <qdrawutil.h>
31#include <qgfx_qws.h>
32#include <qpe/qpeapplication.h>
33#include <qpe/resource.h>
34#include <qpe/global.h>
35#include <qfile.h>
36#include <qsignal.h>
37
38#include "liquiddeco.h"
39
40#include <stdlib.h>
41
42extern QRect qt_maxWindowRect;
43
44class HackWidget : public QWidget
45{
46public:
47 bool needsOk()
48 {
49 return ( getWState() & WState_Reserved1 );
50 }
51};
52
53
54LiquidDecoration::LiquidDecoration()
55 : QPEDecoration()
56{}
57
58LiquidDecoration::~LiquidDecoration()
59{}
60
61int LiquidDecoration::getTitleHeight( const QWidget * )
62{
63 return 15;
64}
65
66
67void LiquidDecoration::paint( QPainter *painter, const QWidget *widget )
68{
69 int titleWidth = getTitleWidth( widget );
70 int titleHeight = getTitleHeight( widget );
71
72 QRect rect( widget->rect() );
73
74 // Border rect
75 QRect br( rect.left() - BORDER_WIDTH,
76 rect.top() - BORDER_WIDTH - titleHeight,
77 rect.width() + 2 * BORDER_WIDTH,
78 rect.height() + BORDER_WIDTH + BOTTOM_BORDER_WIDTH + titleHeight );
79
80 // title bar rect
81 QRect tr;
82
83 tr = QRect( rect.left(), rect.top() - titleHeight, rect.width(), titleHeight );
84
85 QRegion oldClip = painter->clipRegion();
86 painter->setClipRegion( oldClip - QRegion( tr ) );// reduce flicker
87
88 bool isActive = ( widget == qApp->activeWindow() );
89
90 QColorGroup cg = QApplication::palette().active();
91 if ( isActive )
92 cg. setBrush ( QColorGroup::Button, cg. brush ( QColorGroup::Highlight ) );
93
94 qDrawWinPanel( painter, br.x(), br.y(), br.width(),
95 br.height() - 4, cg, FALSE,
96 &cg.brush( QColorGroup::Background ) );
97
98 painter->setClipRegion( oldClip );
99
100 if ( titleWidth > 0 ) {
101 QBrush titleBrush;
102 QPen titlePen;
103 QPen titleLines;
104 int titleLeft = titleHeight + 4;
105
106 titleLeft = rect.left() + 5;
107 painter->setPen( cg.midlight() );
108 painter->drawLine( rect.left() - BORDER_WIDTH + 2,
109 rect.bottom() + 1, rect.right() + BORDER_WIDTH - 2,
110 rect.bottom() + 1 );
111
112 QRect t ( rect.left() - 2, rect.top() - titleHeight - 2, rect.width() + 3, titleHeight + 2 );
113
114
115
116 QApplication::style().drawBevelButton( painter, t.x(), t.y(), t.width(), t.height(), cg, isActive );
117
118 t.setLeft( t.left() + 4 );
119 t.setRight( t.right() - 2 );
120
121 QFont f( QApplication::font() );
122 f.setWeight( QFont::Bold );
123
124 painter-> setFont( f );
125
126 QColor textcol = cg.color( isActive ? QColorGroup::HighlightedText : QColorGroup::Text );
127 QColor shadecol = ( qGray ( textcol. rgb ( ) ) > 128 ) ? textcol. dark ( 130 ) : textcol.light( 200 );
128
129 if ( textcol == shadecol ) {
130 if ( qGray ( shadecol. rgb ( ) ) < 128 )
131 shadecol = QColor ( 225, 225, 225 );
132 else
133 shadecol = QColor ( 30, 30, 30 );
134 }
135
136 painter-> setPen( shadecol );
137 painter-> drawText( t.x() + 1, t.y() + 1, t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() );
138 painter-> setPen( textcol );
139 painter-> drawText( t.x(), t.y(), t.width(), t.height(), Qt::AlignLeft | Qt::AlignVCenter | Qt::SingleLine, widget->caption() );
140 }
141
142#ifndef MINIMIZE_HELP_HACK
143 paintButton( painter, widget, ( QWSDecoration::Region ) Help, 0 );
144#endif
145}
146
147void LiquidDecoration::paintButton( QPainter *painter, const QWidget *w,
148 QWSDecoration::Region type, int state )
149{
150 const QColorGroup & cg = w->palette().active();
151
152 QRect brect( region( w, w->rect(), type ).boundingRect() );
153
154 const QImage *img = 0;
155
156 switch ( ( int ) type ) {
157 case Close:
158 img = &imageClose;
159 break;
160 case Minimize:
161 if ( ( ( HackWidget * ) w ) ->needsOk() ||
162 ( w->inherits( "QDialog" ) && !w->inherits( "QMessageBox" ) ) )
163 img = &imageOk;
164 else if ( helpExists )
165 img = &imageHelp;
166 break;
167 case Help:
168 img = &imageHelp;
169 break;
170 default:
171 return ;
172 }
173
174 if ( img ) {
175 if ( ( state & QWSButton::MouseOver ) && ( state & QWSButton::Clicked ) )
176 painter->drawImage( brect.x() + 1, brect.y() + 3, *img );
177 else
178 painter->drawImage( brect.x(), brect.y() + 2, *img );
179 }
180}
181
182
183
diff --git a/noncore/styles/liquid/liquiddeco.h b/noncore/styles/liquid/liquiddeco.h
new file mode 100644
index 0000000..d975fe5
--- a/dev/null
+++ b/noncore/styles/liquid/liquiddeco.h
@@ -0,0 +1,41 @@
1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3**
4** This file is part of Qtopia Environment.
5**
6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file.
10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15**
16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you.
18**
19**********************************************************************/
20#ifndef OPIE_LIQUIDDECO_H__
21#define OPIE_LIQUIDDECO_H__
22
23#include <qpe/qpedecoration_qws.h>
24
25
26class LiquidDecoration : public QPEDecoration
27{
28public:
29 LiquidDecoration();
30 virtual ~LiquidDecoration();
31
32 virtual void paint(QPainter *, const QWidget *);
33 virtual void paintButton(QPainter *, const QWidget *, Region, int state);
34
35protected:
36 virtual int getTitleHeight(const QWidget *);
37};
38
39
40
41#endif // OPIE_LIQUIDDECO_H__