otabbar.cpp
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 "otabbar.h"
00033
00034 OTabBar::OTabBar( QWidget *parent , const char *name )
00035 : QTabBar( parent, name )
00036 {
00037 }
00038
00039 void OTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
00040 {
00041
00042 QRect r = br;
00043 if ( t->iconset)
00044 {
00045 QIconSet::Mode mode = (t->enabled && isEnabled()) ? QIconSet::Normal : QIconSet::Disabled;
00046 if ( mode == QIconSet::Normal && has_focus ) {
00047 mode = QIconSet::Active;
00048 }
00049 QPixmap pixmap = t->iconset->pixmap( QIconSet::Small, mode );
00050 int pixw = pixmap.width();
00051 int pixh = pixmap.height();
00052 r.setLeft( r.left() + pixw + 2 );
00053 p->drawPixmap( br.left()+2, br.center().y()-pixh/2, pixmap );
00054 }
00055
00056 QRect tr = r;
00057 if ( t->id == currentTab() )
00058 {
00059 tr.setBottom( tr.bottom() - style().defaultFrameWidth() );
00060 }
00061
00062 if ( t->enabled && isEnabled() )
00063 {
00064 p->setPen( colorGroup().foreground() );
00065 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
00066 }
00067 else if ( style() == MotifStyle )
00068 {
00069 p->setPen( palette().disabled().foreground() );
00070 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
00071 }
00072 else
00073 {
00074 p->setPen( colorGroup().light() );
00075 QRect wr = tr;
00076 wr.moveBy( 1, 1 );
00077 p->drawText( wr, AlignCenter | ShowPrefix, t->label );
00078 p->setPen( palette().disabled().foreground() );
00079 p->drawText( tr, AlignCenter | ShowPrefix, t->label );
00080 }
00081 }
This file is part of the documentation for OPIE Version 1.1.