summaryrefslogtreecommitdiff
path: root/libopie/otabbar.cpp
authorharlekin <harlekin>2002-09-03 13:58:53 (UTC)
committer harlekin <harlekin>2002-09-03 13:58:53 (UTC)
commitaed06eed3fe9a2d9a2ba7b86e7313cf403fabf36 (patch) (unidiff)
treebb8d6704ed0d354028c6ae1161f753e5e2cee066 /libopie/otabbar.cpp
parentbd7f0afcd9159ae8b4b7332531a5232e28abd592 (diff)
downloadopie-aed06eed3fe9a2d9a2ba7b86e7313cf403fabf36.zip
opie-aed06eed3fe9a2d9a2ba7b86e7313cf403fabf36.tar.gz
opie-aed06eed3fe9a2d9a2ba7b86e7313cf403fabf36.tar.bz2
forgot something
Diffstat (limited to 'libopie/otabbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/otabbar.cpp81
1 files changed, 81 insertions, 0 deletions
diff --git a/libopie/otabbar.cpp b/libopie/otabbar.cpp
new file mode 100644
index 0000000..b5b93ba
--- a/dev/null
+++ b/libopie/otabbar.cpp
@@ -0,0 +1,81 @@
1/*
2                This file is part of the Opie Project
3
4              Copyright (c) 2002 Dan Williams <williamsdr@acm.org>
5 =.
6 .=l.
7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can
9.> <`_,   >  .   <= redistribute it and/or modify it under
10:`=1 )Y*s>-.--   : the terms of the GNU Library General Public
11.="- .-=="i,     .._ License as published by the Free Software
12 - .   .-<_>     .<> Foundation; either version 2 of the License,
13     ._= =}       : or (at your option) any later version.
14    .%`+i>       _;_.
15    .i_,=:_.      -<s. This program is distributed in the hope that
16     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
17    : ..    .:,     . . . without even the implied warranty of
18    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
19  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
20..}^=.=       =       ; Library General Public License for more
21++=   -.     .`     .: details.
22 :     =  ...= . :.=-
23 -.   .:....=;==+<; You should have received a copy of the GNU
24  -_. . .   )=.  = Library General Public License along with
25    --        :-=` this library; see the file COPYING.LIB.
26 If not, write to the Free Software Foundation,
27 Inc., 59 Temple Place - Suite 330,
28 Boston, MA 02111-1307, USA.
29
30*/
31
32#include "otabbar.h"
33
34OTabBar::OTabBar( QWidget *parent = 0, const char *name = 0 )
35 : QTabBar( parent, name )
36{
37}
38
39void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
40{
41
42 QRect r = br;
43 if ( t->iconset)
44 {
45 QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
46 if ( mode == QIconSet::Normal && has_focus ) {
47 mode = QIconSet::Active;
48 }
49 QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode );
50 int pixw = pixmap.width();
51 int pixh = pixmap.height();
52 r.setLeft( r.left() + pixw + 2 );
53 p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap );
54 }
55
56 QRect tr = r;
57 if ( t->id == currentTab() )
58 {
59 tr.setBottom( tr.bottom() - style().defaultFrameWidth() );
60 }
61
62 if ( t->enabled && isEnabled() )
63 {
64 p->setPen( colorGroup().foreground() );
65 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
66 }
67 else if ( style() == MotifStyle )
68 {
69 p->setPen( palette().disabled().foreground() );
70 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
71 }
72 else
73 {
74 p->setPen( colorGroup().light() );
75 QRect wr = tr;
76 wr.moveBy( 1, 1 );
77 p->drawText( wr, AlignCenter | ShowPrefix, t->label );
78 p->setPen( palette().disabled().foreground() );
79 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
80 }
81}