summaryrefslogtreecommitdiff
path: root/libopie2/opieui/otabbar.cpp
authormickeyl <mickeyl>2004-01-15 15:04:23 (UTC)
committer mickeyl <mickeyl>2004-01-15 15:04:23 (UTC)
commitac1e2b945965ee8caabd658e90f9e234fc622619 (patch) (unidiff)
treed787cb386c6b1b5f69cb00809636299e66c56833 /libopie2/opieui/otabbar.cpp
parentdde789ef19fa3a3913805e452ac1e3400688e8a0 (diff)
downloadopie-ac1e2b945965ee8caabd658e90f9e234fc622619.zip
opie-ac1e2b945965ee8caabd658e90f9e234fc622619.tar.gz
opie-ac1e2b945965ee8caabd658e90f9e234fc622619.tar.bz2
libopie1 --> libopie2 + namespace cleanups, code layout, etc.
Diffstat (limited to 'libopie2/opieui/otabbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opieui/otabbar.cpp83
1 files changed, 83 insertions, 0 deletions
diff --git a/libopie2/opieui/otabbar.cpp b/libopie2/opieui/otabbar.cpp
new file mode 100644
index 0000000..cd3a34b
--- a/dev/null
+++ b/libopie2/opieui/otabbar.cpp
@@ -0,0 +1,83 @@
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 <opie2/otabbar.h>
33
34using namespace Opie;
35
36OTabBar::OTabBar( QWidget *parent , const char *name )
37 :QTabBar( parent, name )
38{}
39
40void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
41{
42
43 QRect r = br;
44 if ( t->iconset)
45 {
46 QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
47 if ( mode == QIconSet::Normal && has_focus )
48 {
49 mode = QIconSet::Active;
50 }
51 QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode );
52 int pixw = pixmap.width();
53 int pixh = pixmap.height();
54 r.setLeft( r.left() + pixw + 2 );
55 p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap );
56 }
57
58 QRect tr = r;
59 if ( t->id == currentTab() )
60 {
61 tr.setBottom( tr.bottom() - style().defaultFrameWidth() );
62 }
63
64 if ( t->enabled && isEnabled() )
65 {
66 p->setPen( colorGroup().foreground() );
67 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
68 }
69 else if ( style() == MotifStyle )
70 {
71 p->setPen( palette().disabled().foreground() );
72 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
73 }
74 else
75 {
76 p->setPen( colorGroup().light() );
77 QRect wr = tr;
78 wr.moveBy( 1, 1 );
79 p->drawText( wr, AlignCenter | ShowPrefix, t->label );
80 p->setPen( palette().disabled().foreground() );
81 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
82 }
83}