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
@@ -11,4 +11,5 @@
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>
@@ -988,4 +989,6 @@ void LiquidStyle::polish(QApplication *app)
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
@@ -997,4 +1000,6 @@ void LiquidStyle::unPolish(QApplication *app)
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
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
@@ -2,8 +2,10 @@ TEMPLATE = 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
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__