summaryrefslogtreecommitdiff
path: root/noncore/decorations/liquid
authorsandman <sandman>2002-10-04 00:46:45 (UTC)
committer sandman <sandman>2002-10-04 00:46:45 (UTC)
commit7f1029811faae4aa88c0c35157a33b95abffaae8 (patch) (unidiff)
tree3cab1efdd4a88ae832dd29a424b1c9d884679ef4 /noncore/decorations/liquid
parent4131d24ac051733b2d9ba323b18e6602ae396b85 (diff)
downloadopie-7f1029811faae4aa88c0c35157a33b95abffaae8.zip
opie-7f1029811faae4aa88c0c35157a33b95abffaae8.tar.gz
opie-7f1029811faae4aa88c0c35157a33b95abffaae8.tar.bz2
Added three window decoration flavours:
- flat from Qtopia 1.6 - polished from Qtopia 1.6 - liquid - this was written by me and resembles the KDE3 liquid look
Diffstat (limited to 'noncore/decorations/liquid') (more/less context) (show whitespace changes)
-rw-r--r--noncore/decorations/liquid/liquid.cpp136
-rw-r--r--noncore/decorations/liquid/liquid.h25
-rw-r--r--noncore/decorations/liquid/liquid.pro10
-rw-r--r--noncore/decorations/liquid/opie-deco-liquid.control9
4 files changed, 180 insertions, 0 deletions
diff --git a/noncore/decorations/liquid/liquid.cpp b/noncore/decorations/liquid/liquid.cpp
new file mode 100644
index 0000000..75b1fc9
--- a/dev/null
+++ b/noncore/decorations/liquid/liquid.cpp
@@ -0,0 +1,136 @@
1#include "liquid.h"
2
3#include <qapplication.h>
4#include <qpainter.h>
5#include <qpalette.h>
6#include <qdrawutil.h>
7
8
9LiquidDecoInterface::LiquidDecoInterface ( ) : ref ( 0 )
10{
11}
12
13LiquidDecoInterface::~LiquidDecoInterface ( )
14{
15}
16
17
18
19QString LiquidDecoInterface::name ( ) const
20{
21 return qApp-> translate ( "Decoration", "Liquid" );
22}
23
24
25QPixmap LiquidDecoInterface::icon ( ) const
26{
27 return QPixmap ( );
28}
29
30void LiquidDecoInterface::drawArea( Area a, QPainter *p, const WindowData *wd ) const
31{
32 QRect r = wd-> rect;
33 int th = metric ( TitleHeight, wd );
34
35 switch ( a ) {
36 case WindowDecorationInterface::Border: {
37 const QColorGroup &cg = wd-> palette. active ( );
38 qDrawWinPanel ( p, r. x ( ) - metric ( LeftBorder, wd ),
39 r. y ( ) - th - metric ( TopBorder, wd ),
40 r. width ( ) + metric ( LeftBorder, wd ) + metric ( RightBorder, wd ),
41 r. height ( ) + th + metric ( TopBorder,wd) + metric ( BottomBorder, wd ),
42 cg, false, &cg. brush ( QColorGroup::Background ));
43 break;
44 }
45 case WindowDecorationInterface::Title: {
46 const QColorGroup &cg = wd-> palette. active ( );
47
48 QBrush titleBrush;
49 QPen titleLines1, titleLines2;
50
51 titleBrush = cg. brush (( wd-> flags & WindowData::Active ) ? QColorGroup::Highlight : QColorGroup::Background );
52 titleLines1 = titleBrush. color ( ). dark ( 105 );
53 titleLines2 = titleBrush. color ( ). dark ( 103 );
54
55 p-> fillRect ( r. x ( ), r. y ( ) - th, r. width ( ), th, titleBrush );
56 for ( int i = r.y()-th; i < r.y(); i += 4 ) {
57 p-> setPen ( titleLines1 );
58 p-> drawLine ( r. left ( ), i, r. right ( ), i );
59 p-> setPen ( titleLines2 );
60 p-> drawLine ( r. left ( ), i+1, r. right ( ), i+1 );
61 }
62 break;
63 }
64 case WindowDecorationInterface::TitleText: {
65 QColor textcol = wd-> palette. active ( ). color (( wd-> flags & WindowData::Active ) ? QColorGroup::HighlightedText : QColorGroup::Text );
66 QColor shadecol = ( qGray ( textcol. rgb ( ) ) > 128 ) ? textcol. dark ( 230 ) : textcol.light( 300 );
67 if ( textcol == shadecol ) {
68 if ( qGray ( shadecol. rgb ( ) ) < 128 )
69 shadecol = QColor ( 225, 225, 225 );
70 else
71 shadecol = QColor ( 30, 30, 30 );
72 }
73 QColor fillcol = wd-> palette. active ( ). color (( wd-> flags & WindowData::Active ) ? QColorGroup::Highlight : QColorGroup::Background );
74 QColor bordercol = fillcol. dark ( 110 );
75 fillcol = fillcol. light ( 110 );
76
77 QRect tr ( r.x ( ) + 3 + metric ( HelpWidth, wd ), r. top ( ) - th,
78 r. width ( ) - metric ( OKWidth, wd ) - metric ( CloseWidth, wd ), th );
79
80 QFont f = p-> font ( );
81 f. setWeight ( QFont::Bold );
82 p-> setFont ( f );
83
84 QRect br = p-> boundingRect ( tr, QPainter::AlignCenter, wd-> caption );
85 int trh2 = tr. height ( ) / 2;
86
87 int align = QPainter::AlignCenter;
88
89 if ( br. width ( ) + 2 * trh2 > tr. width ( ) ) {
90 br. setLeft ( tr. left ( ) + trh2 );
91 br. setWidth ( tr. width ( ) - 2 * trh2 );
92
93 align = QPainter::AlignLeft | QPainter::AlignVCenter;
94 }
95
96 p-> setBrush ( fillcol );
97 p-> setPen ( bordercol /*Qt::NoPen*/ );
98 p->drawChord ( br. left ( ) - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, 180*16 );
99 p->drawChord ( br. right ( ) + 1 - trh2, tr. top ( ), 2 * trh2, tr. height ( ), 90*16, -180*16 );
100
101 p-> fillRect ( br.left() - 1, tr. top ( ), br. width ( ) + 2, tr. height ( ), fillcol);
102
103 p-> setPen ( shadecol );
104 p-> drawText ( br, align, wd-> caption );
105 p-> setPen ( textcol );
106 br. moveBy ( -1, -1 );
107 p-> drawText ( br, align, wd-> caption );
108 break;
109 }
110 default: {
111 WindowDecorationInterface::drawArea ( a, p, wd );
112 break;
113 }
114 }
115}
116
117QRESULT LiquidDecoInterface::queryInterface ( const QUuid &uuid, QUnknownInterface **iface )
118{
119 *iface = 0;
120
121 if ( uuid == IID_QUnknown )
122 *iface = this;
123 else if ( uuid == IID_WindowDecoration )
124 *iface = this;
125
126 if ( *iface )
127 (*iface)-> addRef ( );
128
129 return QS_OK;
130}
131
132Q_EXPORT_INTERFACE()
133{
134 Q_CREATE_INSTANCE( LiquidDecoInterface )
135}
136
diff --git a/noncore/decorations/liquid/liquid.h b/noncore/decorations/liquid/liquid.h
new file mode 100644
index 0000000..ec55132
--- a/dev/null
+++ b/noncore/decorations/liquid/liquid.h
@@ -0,0 +1,25 @@
1#ifndef __OPIE_LIQUIDDECO_PLUGIN_H__
2#define __OPIE_LIQUIDDECO_PLUGIN_H__
3
4#include <qpe/windowdecorationinterface.h>
5
6class LiquidSettings;
7
8class LiquidDecoInterface : public WindowDecorationInterface {
9public:
10 LiquidDecoInterface ( );
11 virtual ~LiquidDecoInterface ( );
12
13 QRESULT queryInterface ( const QUuid &, QUnknownInterface ** );
14 Q_REFCOUNT
15
16 virtual void drawArea( Area a, QPainter *, const WindowData * ) const;
17
18 virtual QString name ( ) const;
19 virtual QPixmap icon ( ) const;
20
21private:
22 ulong ref;
23};
24
25#endif
diff --git a/noncore/decorations/liquid/liquid.pro b/noncore/decorations/liquid/liquid.pro
new file mode 100644
index 0000000..25b4fd3
--- a/dev/null
+++ b/noncore/decorations/liquid/liquid.pro
@@ -0,0 +1,10 @@
1TEMPLATE = lib
2CONFIG = qt embedded release warn_on
3SOURCES = liquid.cpp
4HEADERS = liquid.h
5LIBS += -lqpe
6INCLUDEPATH += $(OPIEDIR)/include
7DESTDIR = $(OPIEDIR)/plugins/decorations
8TARGET = liquid
9VERSION = 1.0.0
10
diff --git a/noncore/decorations/liquid/opie-deco-liquid.control b/noncore/decorations/liquid/opie-deco-liquid.control
new file mode 100644
index 0000000..7d56914
--- a/dev/null
+++ b/noncore/decorations/liquid/opie-deco-liquid.control
@@ -0,0 +1,9 @@
1Files: plugins/decorations/libliquid.so*
2Priority: optional
3Section: opie/decorations
4Maintainer: Robert Griebl <sandman@handhelds.org>
5Architecture: arm
6Version: $QPE_VERSION-$SUB_VERSION.1
7Depends: opie-base ($QPE_VERSION)
8Description: OPIE window decoration style
9 Liquid (KDE3) window decoration style for OPIE.