00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <opie2/otabbar.h>
00033
00034 #include <qpe/applnk.h>
00035
00036 #include <stdio.h>
00037
00038 using namespace Opie::Ui;
00039
00040 OTabBar::OTabBar( QWidget *parent , const char *name )
00041 :QTabBar( parent, name )
00042 {}
00043
00044 void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
00045 {
00046
00047 QRect r = br;
00048 if ( t->iconset)
00049 {
00050 QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
00051 if ( mode == QIconSet::Normal && has_focus )
00052 {
00053 mode = QIconSet::Active;
00054 }
00055 QPixmap pixmap = t->iconset->pixmap();
00056 int pixw = pixmap.width();
00057 int pixh = pixmap.height();
00058 r.setLeft( r.left() + pixw + 2 );
00059 p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap );
00060 }
00061
00062 QRect tr = r;
00063 if ( t->id == currentTab() )
00064 {
00065 tr.setBottom( tr.bottom() - style().defaultFrameWidth() );
00066 }
00067
00068 if ( t->enabled && isEnabled() )
00069 {
00070 p->setPen( colorGroup().foreground() );
00071 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
00072 }
00073 else if ( style() == MotifStyle )
00074 {
00075 p->setPen( palette().disabled().foreground() );
00076 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
00077 }
00078 else
00079 {
00080 p->setPen( colorGroup().light() );
00081 QRect wr = tr;
00082 wr.moveBy( 1, 1 );
00083 p->drawText( wr, AlignCenter | ShowPrefix, t->label );
00084 p->setPen( palette().disabled().foreground() );
00085 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
00086 }
00087 }