diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-16 19:02:47 +0000 |
commit | e985f7e545f4739493965aad69bbecb136dc9346 (patch) | |
tree | 54afd409d8acd6202dd8ab611d24e78c28e4c0a0 /lib/compatibility/kmdi/qextmdi/kmultitabbar.cpp | |
parent | f7670c198945adc3b95ad69a959fe5f8ae55b493 (diff) | |
download | tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.tar.gz tdewebdev-e985f7e545f4739493965aad69bbecb136dc9346.zip |
TQt4 port kdewebdev
This enables compilation under both Qt3 and Qt4
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdewebdev@1237029 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/compatibility/kmdi/qextmdi/kmultitabbar.cpp')
-rw-r--r-- | lib/compatibility/kmdi/qextmdi/kmultitabbar.cpp | 156 |
1 files changed, 78 insertions, 78 deletions
diff --git a/lib/compatibility/kmdi/qextmdi/kmultitabbar.cpp b/lib/compatibility/kmdi/qextmdi/kmultitabbar.cpp index 853f8e8e..3ad39b1c 100644 --- a/lib/compatibility/kmdi/qextmdi/kmultitabbar.cpp +++ b/lib/compatibility/kmdi/qextmdi/kmultitabbar.cpp @@ -47,7 +47,7 @@ public: }; -KMultiTabBarInternal::KMultiTabBarInternal(TQWidget *parent, KMultiTabBar::KMultiTabBarMode bm):TQScrollView(parent) +KMultiTabBarInternal::KMultiTabBarInternal(TQWidget *tqparent, KMultiTabBar::KMultiTabBarMode bm):TQScrollView(tqparent) { m_expandedTabSize=-1; m_showActiveTabTexts=false; @@ -73,9 +73,9 @@ KMultiTabBarInternal::KMultiTabBarInternal(TQWidget *parent, KMultiTabBar::KMult } addChild(box); setFrameStyle(NoFrame); - viewport()->setBackgroundMode(Qt::PaletteBackground); -/* box->setPaletteBackgroundColor(Qt::red); - setPaletteBackgroundColor(Qt::green);*/ + viewport()->setBackgroundMode(TQt::PaletteBackground); +/* box->setPaletteBackgroundColor(TQt::red); + setPaletteBackgroundColor(TQt::green);*/ } void KMultiTabBarInternal::setStyle(enum KMultiTabBar::KMultiTabBarStyle style) @@ -110,7 +110,7 @@ void KMultiTabBarInternal::setStyle(enum KMultiTabBar::KMultiTabBarStyle style) mainLayout->setAutoAdd(true); } - viewport()->repaint(); + viewport()->tqrepaint(); } void KMultiTabBarInternal::drawContents ( TQPainter * paint, int clipx, int clipy, int clipw, int cliph ) @@ -120,9 +120,9 @@ void KMultiTabBarInternal::drawContents ( TQPainter * paint, int clipx, int clip if (m_position==KMultiTabBar::Right) { - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,0,0,viewport()->height()); - paint->setPen(colorGroup().background().dark(120)); + paint->setPen(tqcolorGroup().background().dark(120)); paint->drawLine(1,0,1,viewport()->height()); @@ -130,28 +130,28 @@ void KMultiTabBarInternal::drawContents ( TQPainter * paint, int clipx, int clip else if (m_position==KMultiTabBar::Left) { - paint->setPen(colorGroup().light()); + paint->setPen(tqcolorGroup().light()); paint->drawLine(23,0,23,viewport()->height()); paint->drawLine(22,0,22,viewport()->height()); - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,0,0,viewport()->height()); } else if (m_position==KMultiTabBar::Bottom) { - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,0,viewport()->width(),0); - paint->setPen(colorGroup().background().dark(120)); + paint->setPen(tqcolorGroup().background().dark(120)); paint->drawLine(0,1,viewport()->width(),1); } else { - paint->setPen(colorGroup().light()); + paint->setPen(tqcolorGroup().light()); paint->drawLine(0,23,viewport()->width(),23); paint->drawLine(0,22,viewport()->width(),22); -/* paint->setPen(colorGroup().shadow()); +/* paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,0,0,viewport()->height());*/ } @@ -188,8 +188,8 @@ void KMultiTabBarInternal::mousePressEvent(TQMouseEvent *ev) void KMultiTabBarInternal::resizeEvent(TQResizeEvent *ev) { /* kdDebug()<<"KMultiTabBarInternal::resizeEvent"<<endl; - kdDebug()<<"KMultiTabBarInternal::resizeEvent - box geometry"<<box->geometry()<<endl; - kdDebug()<<"KMultiTabBarInternal::resizeEvent - geometry"<<geometry()<<endl;*/ + kdDebug()<<"KMultiTabBarInternal::resizeEvent - box tqgeometry"<<box->tqgeometry()<<endl; + kdDebug()<<"KMultiTabBarInternal::resizeEvent - tqgeometry"<<tqgeometry()<<endl;*/ if (ev) TQScrollView::resizeEvent(ev); if ( (m_style==KMultiTabBar::KDEV3) || @@ -346,7 +346,7 @@ int KMultiTabBarInternal::appendTab(const TQPixmap &pic ,int id,const TQString& tab->installEventFilter(this); tab->showActiveTabText(m_showActiveTabTexts); - if (m_style==KMultiTabBar::KONQSBC) + if (m_style==KMultiTabBar::KONTQSBC) { if (m_expandedTabSize<tab->neededSize()) { m_expandedTabSize=tab->neededSize(); @@ -378,13 +378,13 @@ void KMultiTabBarInternal::setPosition(enum KMultiTabBar::KMultiTabBarPosition p m_position=pos; for (uint i=0;i<m_tabs.count();i++) m_tabs.at(i)->setTabsPosition(m_position); - viewport()->repaint(); + viewport()->tqrepaint(); } KMultiTabBarButton::KMultiTabBarButton(const TQPixmap& pic,const TQString& text, TQPopupMenu *popup, - int id,TQWidget *parent,KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style) - :TQPushButton(TQIconSet(),text,parent),m_style(style) + int id,TQWidget *tqparent,KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style) + :TQPushButton(TQIconSet(),text,tqparent),m_style(style) { setIconSet(pic); setText(text); @@ -399,8 +399,8 @@ KMultiTabBarButton::KMultiTabBarButton(const TQPixmap& pic,const TQString& text, } KMultiTabBarButton::KMultiTabBarButton(const TQString& text, TQPopupMenu *popup, - int id,TQWidget *parent,KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style) - :TQPushButton(TQIconSet(),text,parent),m_style(style) + int id,TQWidget *tqparent,KMultiTabBar::KMultiTabBarPosition pos,KMultiTabBar::KMultiTabBarStyle style) + :TQPushButton(TQIconSet(),text,tqparent),m_style(style) { setText(text); m_position=pos; @@ -435,45 +435,45 @@ void KMultiTabBarButton::slotClicked() void KMultiTabBarButton::setPosition(KMultiTabBar::KMultiTabBarPosition pos) { m_position=pos; - repaint(); + tqrepaint(); } void KMultiTabBarButton::setStyle(KMultiTabBar::KMultiTabBarStyle style) { m_style=style; - repaint(); + tqrepaint(); } void KMultiTabBarButton::hideEvent( TQHideEvent* he) { TQPushButton::hideEvent(he); - KMultiTabBar *tb=dynamic_cast<KMultiTabBar*>(parentWidget()); + KMultiTabBar *tb=dynamic_cast<KMultiTabBar*>(tqparentWidget()); if (tb) tb->updateSeparator(); } void KMultiTabBarButton::showEvent( TQShowEvent* he) { TQPushButton::showEvent(he); - KMultiTabBar *tb=dynamic_cast<KMultiTabBar*>(parentWidget()); + KMultiTabBar *tb=dynamic_cast<KMultiTabBar*>(tqparentWidget()); if (tb) tb->updateSeparator(); } -TQSize KMultiTabBarButton::sizeHint() const +TQSize KMultiTabBarButton::tqsizeHint() const { constPolish(); int w = 0, h = 0; // calculate contents size... -#ifndef QT_NO_ICONSET +#ifndef TQT_NO_ICONSET if ( iconSet() && !iconSet()->isNull() ) { int iw = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).width() + 4; int ih = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ).height(); w += iw; - h = QMAX( h, ih ); + h = TQMAX( h, ih ); } #endif if ( isMenuButton() ) - w += style().pixelMetric(TQStyle::PM_MenuButtonIndicator, this); + w += tqstyle().tqpixelMetric(TQStyle::PM_MenuButtonIndicator, this); if ( pixmap() ) { TQPixmap *pm = (TQPixmap *)pixmap(); @@ -483,24 +483,24 @@ TQSize KMultiTabBarButton::sizeHint() const TQString s( text() ); bool empty = s.isEmpty(); if ( empty ) - s = TQString::fromLatin1("XXXX"); + s = TQString::tqfromLatin1("XXXX"); TQFontMetrics fm = fontMetrics(); TQSize sz = fm.size( ShowPrefix, s ); if(!empty || !w) w += sz.width(); if(!empty || !h) - h = QMAX(h, sz.height()); + h = TQMAX(h, sz.height()); } - return (style().sizeFromContents(TQStyle::CT_ToolButton, this, TQSize(w, h)). + return (tqstyle().tqsizeFromContents(TQStyle::CT_ToolButton, this, TQSize(w, h)). expandedTo(TQApplication::globalStrut())); } KMultiTabBarTab::KMultiTabBarTab(const TQPixmap& pic, const TQString& text, - int id,TQWidget *parent,KMultiTabBar::KMultiTabBarPosition pos, + int id,TQWidget *tqparent,KMultiTabBar::KMultiTabBarPosition pos, KMultiTabBar::KMultiTabBarStyle style) - :KMultiTabBarButton(text,0,id,parent,pos,style), + :KMultiTabBarButton(text,0,id,tqparent,pos,style), m_showActiveTabText(false) { d=new KMultiTabBarTabPrivate(); @@ -526,7 +526,7 @@ void KMultiTabBarTab::setTabsPosition(KMultiTabBar::KMultiTabBarPosition pos) } setPosition(pos); -// repaint(); +// tqrepaint(); } void KMultiTabBarTab::setIcon(const TQString& icon) @@ -567,23 +567,23 @@ void KMultiTabBarTab::setState(bool b) void KMultiTabBarTab::updateState() { - if (m_style!=KMultiTabBar::KONQSBC) { + if (m_style!=KMultiTabBar::KONTQSBC) { if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) { TQPushButton::setText(m_text); } else { kdDebug()<<"KMultiTabBarTab::updateState(): setting text to an empty TQString***************"<<endl; - TQPushButton::setText(TQString::null); + TQPushButton::setText(TQString()); } if ((m_position==KMultiTabBar::Right || m_position==KMultiTabBar::Left)) { setFixedWidth(24); if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) { - setFixedHeight(KMultiTabBarButton::sizeHint().width()); + setFixedHeight(KMultiTabBarButton::tqsizeHint().width()); } else setFixedHeight(36); } else { setFixedHeight(24); if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) { - setFixedWidth(KMultiTabBarButton::sizeHint().width()); + setFixedWidth(KMultiTabBarButton::tqsizeHint().width()); } else setFixedWidth(36); } } else { @@ -623,7 +623,7 @@ void KMultiTabBarTab::drawButtonLabel(TQPainter *p) { } void KMultiTabBarTab::drawButton(TQPainter *paint) { - if (m_style!=KMultiTabBar::KONQSBC) drawButtonStyled(paint); + if (m_style!=KMultiTabBar::KONTQSBC) drawButtonStyled(paint); else drawButtonClassic(paint); } @@ -634,7 +634,7 @@ void KMultiTabBarTab::drawButtonStyled(TQPainter *paint) { const int height = 24; if ((m_style==KMultiTabBar::KDEV3) || (m_style==KMultiTabBar::KDEV3ICON) || (isOn())) { if ((m_position==KMultiTabBar::Left) || (m_position==KMultiTabBar::Right)) - sh=TQSize(this->height(),this->width());//KMultiTabBarButton::sizeHint(); + sh=TQSize(this->height(),this->width());//KMultiTabBarButton::tqsizeHint(); else sh=TQSize(this->width(),this->height()); } else @@ -651,8 +651,8 @@ void KMultiTabBarTab::drawButtonStyled(TQPainter *paint) { if (isOn()) st|=TQStyle::Style_On; - style().drawControl(TQStyle::CE_PushButton,&painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), colorGroup(),st); - style().drawControl(TQStyle::CE_PushButtonLabel,&painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), colorGroup(),st); + tqstyle().tqdrawControl(TQStyle::CE_PushButton,&painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), tqcolorGroup(),st); + tqstyle().tqdrawControl(TQStyle::CE_PushButtonLabel,&painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), tqcolorGroup(),st); switch (m_position) { case KMultiTabBar::Left: @@ -668,8 +668,8 @@ void KMultiTabBarTab::drawButtonStyled(TQPainter *paint) { paint->drawPixmap(0,0,pixmap); break; } -// style().drawControl(TQStyle::CE_PushButtonLabel,painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), -// colorGroup(),TQStyle::Style_Enabled); +// tqstyle().tqdrawControl(TQStyle::CE_PushButtonLabel,painter,this, TQRect(0,0,pixmap.width(),pixmap.height()), +// tqcolorGroup(),TQStyle::Style_Enabled); } @@ -679,58 +679,58 @@ void KMultiTabBarTab::drawButtonClassic(TQPainter *paint) TQPixmap pixmap; if ( iconSet()) pixmap = iconSet()->pixmap( TQIconSet::Small, TQIconSet::Normal ); - paint->fillRect(0, 0, 24, 24, colorGroup().background()); + paint->fillRect(0, 0, 24, 24, tqcolorGroup().background()); if (!isOn()) { if (m_position==KMultiTabBar::Right) { - paint->fillRect(0,0,21,21,TQBrush(colorGroup().background())); + paint->fillRect(0,0,21,21,TQBrush(tqcolorGroup().background())); - paint->setPen(colorGroup().background().dark(150)); + paint->setPen(tqcolorGroup().background().dark(150)); paint->drawLine(0,22,23,22); paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap); - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,0,0,23); - paint->setPen(colorGroup().background().dark(120)); + paint->setPen(tqcolorGroup().background().dark(120)); paint->drawLine(1,0,1,23); } else if ((m_position==KMultiTabBar::Bottom) || (m_position==KMultiTabBar::Top)) { - paint->fillRect(0,1,23,22,TQBrush(colorGroup().background())); + paint->fillRect(0,1,23,22,TQBrush(tqcolorGroup().background())); paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap); - paint->setPen(colorGroup().background().dark(120)); + paint->setPen(tqcolorGroup().background().dark(120)); paint->drawLine(23,0,23,23); - paint->setPen(colorGroup().light()); + paint->setPen(tqcolorGroup().light()); paint->drawLine(0,22,23,22); paint->drawLine(0,23,23,23); - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,0,23,0); - paint->setPen(colorGroup().background().dark(120)); + paint->setPen(tqcolorGroup().background().dark(120)); paint->drawLine(0,1,23,1); } else { - paint->setPen(colorGroup().background().dark(120)); + paint->setPen(tqcolorGroup().background().dark(120)); paint->drawLine(0,23,23,23); - paint->fillRect(0,0,23,21,TQBrush(colorGroup().background())); + paint->fillRect(0,0,23,21,TQBrush(tqcolorGroup().background())); paint->drawPixmap(12-pixmap.width()/2,12-pixmap.height()/2,pixmap); - paint->setPen(colorGroup().light()); + paint->setPen(tqcolorGroup().light()); paint->drawLine(23,0,23,23); paint->drawLine(22,0,22,23); - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,0,0,23); } @@ -741,12 +741,12 @@ void KMultiTabBarTab::drawButtonClassic(TQPainter *paint) { if (m_position==KMultiTabBar::Right) { - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,height()-1,23,height()-1); paint->drawLine(0,height()-2,23,height()-2); paint->drawLine(23,0,23,height()-1); paint->drawLine(22,0,22,height()-1); - paint->fillRect(0,0,21,height()-3,TQBrush(colorGroup().light())); + paint->fillRect(0,0,21,height()-3,TQBrush(tqcolorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) @@ -756,9 +756,9 @@ void KMultiTabBarTab::drawButtonClassic(TQPainter *paint) TQPixmap tpixmap(height()-25-3, width()-2); TQPainter painter(&tpixmap); - painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),TQBrush(colorGroup().light())); + painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),TQBrush(tqcolorGroup().light())); - painter.setPen(colorGroup().text()); + painter.setPen(tqcolorGroup().text()); painter.drawText(0,+width()/2+TQFontMetrics(TQFont()).height()/2,m_text); paint->rotate(90); @@ -770,25 +770,25 @@ void KMultiTabBarTab::drawButtonClassic(TQPainter *paint) else if (m_position==KMultiTabBar::Top) { - paint->fillRect(0,0,width()-1,23,TQBrush(colorGroup().light())); + paint->fillRect(0,0,width()-1,23,TQBrush(tqcolorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) { - paint->setPen(colorGroup().text()); + paint->setPen(tqcolorGroup().text()); paint->drawText(25,height()/2+TQFontMetrics(TQFont()).height()/2,m_text); } } else if (m_position==KMultiTabBar::Bottom) { - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,23,width()-1,23); paint->drawLine(0,22,width()-1,22); - paint->fillRect(0,0,width()-1,21,TQBrush(colorGroup().light())); + paint->fillRect(0,0,width()-1,21,TQBrush(tqcolorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) { - paint->setPen(colorGroup().text()); + paint->setPen(tqcolorGroup().text()); paint->drawText(25,height()/2+TQFontMetrics(TQFont()).height()/2,m_text); } @@ -797,10 +797,10 @@ void KMultiTabBarTab::drawButtonClassic(TQPainter *paint) { - paint->setPen(colorGroup().shadow()); + paint->setPen(tqcolorGroup().shadow()); paint->drawLine(0,height()-1,23,height()-1); paint->drawLine(0,height()-2,23,height()-2); - paint->fillRect(0,0,23,height()-3,TQBrush(colorGroup().light())); + paint->fillRect(0,0,23,height()-3,TQBrush(tqcolorGroup().light())); paint->drawPixmap(10-pixmap.width()/2,10-pixmap.height()/2,pixmap); if (m_showActiveTabText) { @@ -810,9 +810,9 @@ void KMultiTabBarTab::drawButtonClassic(TQPainter *paint) TQPixmap tpixmap(height()-25-3, width()-2); TQPainter painter(&tpixmap); - painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),TQBrush(colorGroup().light())); + painter.fillRect(0,0,tpixmap.width(),tpixmap.height(),TQBrush(tqcolorGroup().light())); - painter.setPen(colorGroup().text()); + painter.setPen(tqcolorGroup().text()); painter.drawText(tpixmap.width()-TQFontMetrics(TQFont()).width(m_text),+width()/2+TQFontMetrics(TQFont()).height()/2,m_text); paint->rotate(-90); @@ -833,19 +833,19 @@ void KMultiTabBarTab::drawButtonClassic(TQPainter *paint) -KMultiTabBar::KMultiTabBar(KMultiTabBarMode bm, TQWidget *parent,const char *name):TQWidget(parent,name) +KMultiTabBar::KMultiTabBar(KMultiTabBarMode bm, TQWidget *tqparent,const char *name):TQWidget(tqparent,name) { m_buttons.setAutoDelete(false); if (bm==Vertical) { m_l=new TQVBoxLayout(this); - setSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Expanding, true); + tqsetSizePolicy(TQSizePolicy::Fixed, TQSizePolicy::Expanding, true); // setFixedWidth(24); } else { m_l=new TQHBoxLayout(this); - setSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Fixed, true); + tqsetSizePolicy(TQSizePolicy::Expanding, TQSizePolicy::Fixed, true); // setFixedHeight(24); } m_l->setMargin(0); @@ -855,7 +855,7 @@ KMultiTabBar::KMultiTabBar(KMultiTabBarMode bm, TQWidget *parent,const char *nam setPosition((bm==KMultiTabBar::Vertical)?KMultiTabBar::Right:KMultiTabBar::Bottom); setStyle(VSNET); // setStyle(KDEV3); - //setStyle(KONQSBC); + //setStyle(KONTQSBC); m_l->insertWidget(0,m_internal); m_l->insertWidget(0,m_btnTabSep=new TQFrame(this)); m_btnTabSep->setFixedHeight(4); @@ -878,7 +878,7 @@ KMultiTabBar::~KMultiTabBar() { int KMultiTabBar::appendButton(const TQPixmap &pic ,int id,TQPopupMenu *popup,const TQString&) { KMultiTabBarButton *btn; - m_buttons.append(btn= new KMultiTabBarButton(pic,TQString::null, + m_buttons.append(btn= new KMultiTabBarButton(pic,TQString(), popup,id,this,m_position,m_internal->m_style)); m_l->insertWidget(0,btn); btn->show(); @@ -980,7 +980,7 @@ void KMultiTabBar::fontChange(const TQFont& /* oldFont */) { for (uint i=0;i<tabs()->count();i++) tabs()->at(i)->resize(); - repaint(); + tqrepaint(); } TQPtrList<KMultiTabBarTab>* KMultiTabBar::tabs() {return m_internal->tabs();} |