diff options
Diffstat (limited to 'lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp')
-rw-r--r-- | lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp | 101 |
1 files changed, 52 insertions, 49 deletions
diff --git a/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp b/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp index ee670afb..e8752b41 100644 --- a/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp +++ b/lib/compatibility/tdemdi/qextmdi/kdockwidget.cpp @@ -42,7 +42,10 @@ #include <kdebug.h> #include <tdeglobalsettings.h> +#ifdef HAVE_CONFIG_H #include "config.h" +#endif + #ifdef TQ_WS_X11 #include <X11/X.h> #include <X11/Xlib.h> @@ -122,7 +125,7 @@ void KDockMainWindow::setMainDockWidget( KDockWidget* mdw ) void KDockMainWindow::setView( TQWidget *view ) { if ( view->isA("KDockWidget") ){ - if ( TQT_BASE_OBJECT(view->parent()) != TQT_BASE_OBJECT(this) ) ((KDockWidget*)view)->applyToWidget( this ); + if ( view->parent() != this ) ((KDockWidget*)view)->applyToWidget( this ); } #ifndef NO_KDE2 @@ -203,7 +206,7 @@ void KDockWidgetHeaderDrag::paintEvent( TQPaintEvent* ) paint.begin( this ); - style().tqdrawPrimitive (TQStyle::PE_DockWindowHandle, &paint, TQRect(0,0,width(), height()), colorGroup()); + style().drawPrimitive (TQStyle::PE_DockWindowHandle, &paint, TQRect(0,0,width(), height()), colorGroup()); paint.end(); } @@ -219,7 +222,7 @@ KDockWidgetHeader::KDockWidgetHeader( KDockWidget* parent, const char* name ) #ifdef BORDERLESS_WINDOWS setCursor(TQCursor(ArrowCursor)); #endif - d = new KDockWidgetHeaderPrivate( TQT_TQOBJECT(this) ); + d = new KDockWidgetHeaderPrivate( this ); layout = new TQHBoxLayout( this ); layout->setResizeMode( TQLayout::Minimum ); @@ -230,28 +233,28 @@ KDockWidgetHeader::KDockWidgetHeader( KDockWidget* parent, const char* name ) TQToolTip::add( closeButton, i18n("Close") ); closeButton->setPixmap( style().stylePixmap (TQStyle::SP_TitleBarCloseButton , this)); closeButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height()); - connect( closeButton, TQT_SIGNAL(clicked()), parent, TQT_SIGNAL(headerCloseButtonClicked())); - connect( closeButton, TQT_SIGNAL(clicked()), parent, TQT_SLOT(undock())); + connect( closeButton, TQ_SIGNAL(clicked()), parent, TQ_SIGNAL(headerCloseButtonClicked())); + connect( closeButton, TQ_SIGNAL(clicked()), parent, TQ_SLOT(undock())); stayButton = new KDockButton_Private( this, "DockStayButton" ); TQToolTip::add( stayButton, i18n("Freeze the window geometry", "Freeze") ); stayButton->setToggleButton( true ); stayButton->setPixmap( const_cast< const char** >(not_close_xpm) ); stayButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height()); - connect( stayButton, TQT_SIGNAL(clicked()), this, TQT_SLOT(slotStayClicked())); + connect( stayButton, TQ_SIGNAL(clicked()), this, TQ_SLOT(slotStayClicked())); dockbackButton = new KDockButton_Private( this, "DockbackButton" ); TQToolTip::add( dockbackButton, i18n("Dock this window", "Dock") ); dockbackButton->setPixmap( const_cast< const char** >(dockback_xpm)); dockbackButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height()); - connect( dockbackButton, TQT_SIGNAL(clicked()), parent, TQT_SIGNAL(headerDockbackButtonClicked())); - connect( dockbackButton, TQT_SIGNAL(clicked()), parent, TQT_SLOT(dockBack())); + connect( dockbackButton, TQ_SIGNAL(clicked()), parent, TQ_SIGNAL(headerDockbackButtonClicked())); + connect( dockbackButton, TQ_SIGNAL(clicked()), parent, TQ_SLOT(dockBack())); d->toDesktopButton = new KDockButton_Private( this, "ToDesktopButton" ); TQToolTip::add( d->toDesktopButton, i18n("Detach") ); d->toDesktopButton->setPixmap( const_cast< const char** >(todesktop_xpm)); d->toDesktopButton->setFixedSize(closeButton->pixmap()->width(),closeButton->pixmap()->height()); - connect( d->toDesktopButton, TQT_SIGNAL(clicked()), parent, TQT_SLOT(toDesktop())); + connect( d->toDesktopButton, TQ_SIGNAL(clicked()), parent, TQ_SLOT(toDesktop())); stayButton->hide(); d->dummy = new TQWidget( this ); @@ -501,7 +504,7 @@ KDockWidget::KDockWidget( KDockManager* dockManager, const char* name, const TQP layout->setResizeMode( TQLayout::Minimum ); manager = dockManager; - manager->childDock->append( TQT_TQOBJECT(this) ); + manager->childDock->append( this ); installEventFilter( manager ); eDocking = DockFullDocking; @@ -525,7 +528,7 @@ KDockWidget::KDockWidget( KDockManager* dockManager, const char* name, const TQP setIcon( pixmap); widget = 0L; - TQObject::connect(this, TQT_SIGNAL(hasUndocked()), manager->main, TQT_SLOT(slotDockWidgetUndocked()) ); + TQObject::connect(this, TQ_SIGNAL(hasUndocked()), manager->main, TQ_SLOT(slotDockWidgetUndocked()) ); applyToWidget( parent, TQPoint(0,0) ); } @@ -565,8 +568,8 @@ KDockWidget::~KDockWidget() } } emit iMBeingClosed(); - if (manager->d) manager->d->containerDocks.remove(TQT_TQOBJECT(this)); - manager->childDock->remove( TQT_TQOBJECT(this) ); + if (manager->d) manager->d->containerDocks.remove(this); + manager->childDock->remove( this ); delete pix; delete d; // destroy private data d=0; @@ -577,7 +580,7 @@ void KDockWidget::paintEvent(TQPaintEvent* pe) TQWidget::paintEvent(pe); TQPainter paint; paint.begin( this ); - style().tqdrawPrimitive (TQStyle::PE_Panel, &paint, TQRect(0,0,width(), height()), colorGroup()); + style().drawPrimitive (TQStyle::PE_Panel, &paint, TQRect(0,0,width(), height()), colorGroup()); paint.end(); } @@ -779,7 +782,7 @@ void KDockWidget::updateHeader() setCursor(TQCursor(ArrowCursor)); #endif - if ( (TQT_BASE_OBJECT(parent()) == TQT_BASE_OBJECT(manager->main)) || isGroup || (eDocking == KDockWidget::DockNone) ){ + if ( (parent() == manager->main) || isGroup || (eDocking == KDockWidget::DockNone) ){ header->hide(); } else { header->setTopLevel( false ); @@ -800,7 +803,7 @@ void KDockWidget::updateHeader() void KDockWidget::applyToWidget( TQWidget* s, const TQPoint& p ) { - if ( TQT_BASE_OBJECT(parent()) != TQT_BASE_OBJECT(s) ) + if ( parent() != s ) { hide(); reparent(s, 0, TQPoint(0,0), false); @@ -922,7 +925,7 @@ KDockWidget *KDockWidget::findNearestDockWidget(DockPosition pos) { if (!parent()) return 0; if (!parent()->inherits("KDockSplitter")) return 0; - Qt::Orientation orientation=((pos==DockLeft) || (pos==DockRight)) ?Qt::Vertical:Qt::Horizontal; + TQt::Orientation orientation=((pos==DockLeft) || (pos==DockRight)) ?TQt::Vertical:TQt::Horizontal; if (((KDockSplitter*)(parent()))->orientation()==orientation) { KDockWidget *neighbor= @@ -931,7 +934,7 @@ KDockWidget *KDockWidget::findNearestDockWidget(DockPosition pos) static_cast<KDockWidget*>(((KDockSplitter*)(parent()))->getLast()); if (neighbor==this) - return (static_cast<KDockWidget*>(TQT_TQWIDGET(parent()->parent()))->findNearestDockWidget(pos)); + return (static_cast<KDockWidget*>(parent()->parent())->findNearestDockWidget(pos)); else if (neighbor->getWidget() && (neighbor->getWidget()->tqt_cast("KDockTabGroup"))) return (KDockWidget*)(((KDockTabGroup*)neighbor->getWidget())->page(0)); @@ -939,7 +942,7 @@ KDockWidget *KDockWidget::findNearestDockWidget(DockPosition pos) return neighbor; } else - return (static_cast<KDockWidget*>(TQT_TQWIDGET(parent()->parent()))->findNearestDockWidget(pos)); + return (static_cast<KDockWidget*>(parent()->parent())->findNearestDockWidget(pos)); return 0; } @@ -1106,7 +1109,7 @@ KDockWidget* KDockWidget::manualDock( KDockWidget* target, DockPosition dockPos, if ( dockPos == KDockWidget::DockCenter ) { KDockTabGroup* tab = new KDockTabGroup( newDock, "_dock_tab"); - TQObject::connect(tab, TQT_SIGNAL(currentChanged(TQWidget*)), d, TQT_SLOT(slotFocusEmbeddedWidget(TQWidget*))); + TQObject::connect(tab, TQ_SIGNAL(currentChanged(TQWidget*)), d, TQ_SLOT(slotFocusEmbeddedWidget(TQWidget*))); newDock->setWidget( tab ); target->applyToWidget( tab ); @@ -1143,13 +1146,13 @@ KDockWidget* KDockWidget::manualDock( KDockWidget* target, DockPosition dockPos, // if to dock not to the center of the target dockwidget, // dock to newDock KDockSplitter* panner = 0L; - if ( dockPos == KDockWidget::DockTop || dockPos == KDockWidget::DockBottom ) panner = new KDockSplitter( newDock, "_dock_split_",Qt::Horizontal, spliPos, manager->splitterHighResolution() ); - if ( dockPos == KDockWidget::DockLeft || dockPos == KDockWidget::DockRight ) panner = new KDockSplitter( newDock, "_dock_split_",Qt::Vertical , spliPos, manager->splitterHighResolution() ); + if ( dockPos == KDockWidget::DockTop || dockPos == KDockWidget::DockBottom ) panner = new KDockSplitter( newDock, "_dock_split_",TQt::Horizontal, spliPos, manager->splitterHighResolution() ); + if ( dockPos == KDockWidget::DockLeft || dockPos == KDockWidget::DockRight ) panner = new KDockSplitter( newDock, "_dock_split_",TQt::Vertical , spliPos, manager->splitterHighResolution() ); newDock->setWidget( panner ); panner->setOpaqueResize(manager->splitterOpaqueResize()); panner->setKeepSize(manager->splitterKeepSize()); - panner->setFocusPolicy( TQ_NoFocus ); + panner->setFocusPolicy( TQWidget::NoFocus ); target->applyToWidget( panner ); applyToWidget( panner ); target->formerDockPos = target->currentDockPos; @@ -1328,13 +1331,13 @@ void KDockWidget::undock() split->deactivate(); if ( split->getFirst() == parentOfTab ){ split->activate( lastTab ); - if ( ((KDockWidget*)split->parent())->splitterOrientation ==Qt::Vertical ) + if ( ((KDockWidget*)split->parent())->splitterOrientation ==TQt::Vertical ) emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockLeft ); else emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockTop ); } else { split->activate( 0L, lastTab ); - if ( ((KDockWidget*)split->parent())->splitterOrientation ==Qt::Vertical ) + if ( ((KDockWidget*)split->parent())->splitterOrientation ==TQt::Vertical ) emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockRight ); else emit ((KDockWidget*)split->getAnother(parentOfTab))->docking( parentOfTab, KDockWidget::DockBottom ); @@ -1430,7 +1433,7 @@ void KDockWidget::setWidget( TQWidget* mw ) { if ( !mw ) return; - if ( TQT_BASE_OBJECT(mw->parent()) != TQT_BASE_OBJECT(this) ){ + if ( mw->parent() != this ){ mw->reparent(this, 0, TQPoint(0,0), false); } @@ -1447,7 +1450,7 @@ void KDockWidget::setWidget( TQWidget* mw ) if (dc) { d->isContainer=true; - manager->d->containerDocks.append(TQT_TQOBJECT(this)); + manager->d->containerDocks.append(this); } else { @@ -1486,13 +1489,13 @@ void KDockWidget::setDockTabName( KDockTabGroup* tab ) bool KDockWidget::mayBeHide() const { - bool f = (TQT_BASE_OBJECT(parent()) != TQT_BASE_OBJECT(manager->main)); + bool f = (parent() != manager->main); return ( !isGroup && !isTabGroup && f && isVisible() && ( eDocking != (int)KDockWidget::DockNone ) ); } bool KDockWidget::mayBeShow() const { - bool f = (TQT_BASE_OBJECT(parent()) != TQT_BASE_OBJECT(manager->main)); + bool f = (parent() != manager->main); return ( !isGroup && !isTabGroup && f && !isVisible() ); } @@ -1541,15 +1544,15 @@ void KDockWidget::setFormerBrotherDockWidget(KDockWidget *dockWidget) { formerBrotherDockWidget = dockWidget; if( formerBrotherDockWidget ) - TQObject::connect( formerBrotherDockWidget, TQT_SIGNAL(iMBeingClosed()), - this, TQT_SLOT(loseFormerBrotherDockWidget()) ); + TQObject::connect( formerBrotherDockWidget, TQ_SIGNAL(iMBeingClosed()), + this, TQ_SLOT(loseFormerBrotherDockWidget()) ); } void KDockWidget::loseFormerBrotherDockWidget() { if( formerBrotherDockWidget ) - TQObject::disconnect( formerBrotherDockWidget, TQT_SIGNAL(iMBeingClosed()), - this, TQT_SLOT(loseFormerBrotherDockWidget()) ); + TQObject::disconnect( formerBrotherDockWidget, TQ_SIGNAL(iMBeingClosed()), + this, TQ_SLOT(loseFormerBrotherDockWidget()) ); formerBrotherDockWidget = 0L; repaint(); } @@ -1639,8 +1642,8 @@ KDockManager::KDockManager( TQWidget* mainWindow , const char* name ) menu = new TQPopupMenu(); #endif - connect( menu, TQT_SIGNAL(aboutToShow()), TQT_SLOT(slotMenuPopup()) ); - connect( menu, TQT_SIGNAL(activated(int)), TQT_SLOT(slotMenuActivated(int)) ); + connect( menu, TQ_SIGNAL(aboutToShow()), TQ_SLOT(slotMenuPopup()) ); + connect( menu, TQ_SIGNAL(activated(int)), TQ_SLOT(slotMenuActivated(int)) ); childDock = new TQObjectList(); childDock->setAutoDelete( false ); @@ -1680,7 +1683,7 @@ void KDockManager::activate() obj->show(); } } - if ( !main->inherits(TQDIALOG_OBJECT_NAME_STRING) ) main->show(); + if ( !main->inherits("TQDialog") ) main->show(); } bool KDockManager::eventFilter( TQObject *obj, TQEvent *event ) @@ -1700,7 +1703,7 @@ bool KDockManager::eventFilter( TQObject *obj, TQEvent *event ) break; case TQEvent::MouseButtonPress: - if ( ((TQMouseEvent*)event)->button() == Qt::LeftButton ){ + if ( ((TQMouseEvent*)event)->button() == TQt::LeftButton ){ if ( curdw->eDocking != (int)KDockWidget::DockNone ){ dropCancel = true; curdw->setFocus(); @@ -1725,7 +1728,7 @@ bool KDockManager::eventFilter( TQObject *obj, TQEvent *event ) } break; case TQEvent::MouseButtonRelease: - if ( ((TQMouseEvent*)event)->button() == Qt::LeftButton ){ + if ( ((TQMouseEvent*)event)->button() == TQt::LeftButton ){ if ( dragging ){ if ( !dropCancel ) drop(); @@ -1803,7 +1806,7 @@ bool KDockManager::eventFilter( TQObject *obj, TQEvent *event ) if (d->readyToDrag) { d->readyToDrag = false; } - if ( (((TQMouseEvent*)event)->state() == Qt::LeftButton) && + if ( (((TQMouseEvent*)event)->state() == TQt::LeftButton) && (curdw->eDocking != (int)KDockWidget::DockNone) ) { startDrag( curdw); } @@ -1841,8 +1844,8 @@ KDockWidget* KDockManager::findDockWidgetAt( const TQPoint& pos ) } w = p; } - if ( tqt_find_obj_child( TQT_TQOBJECT(w), "KDockSplitter", "_dock_split_" ) ) return 0L; - if ( tqt_find_obj_child( TQT_TQOBJECT(w), "KDockTabGroup", "_dock_tab" ) ) return 0L; + if ( tqt_find_obj_child( w, "KDockSplitter", "_dock_split_" ) ) return 0L; + if ( tqt_find_obj_child( w, "KDockTabGroup", "_dock_tab" ) ) return 0L; if (dynamic_cast<KDockContainer*>(w)) return 0L; if (!childDockWidgetList) return 0L; @@ -2159,7 +2162,7 @@ void KDockManager::writeConfig(TQDomElement &base) TQObjectListIt it(*childDock); KDockWidget *obj1; while ( (obj1=(KDockWidget*)it.current()) ) { - if ( TQT_BASE_OBJECT(obj1->parent()) == TQT_BASE_OBJECT(main) ) + if ( obj1->parent() == main ) mainWidgetStr = TQString::fromLatin1(obj1->name()); nList.append(obj1->name()); ++it; @@ -2347,7 +2350,7 @@ void KDockManager::readConfig(TQDomElement &base) KDockWidget *second = getDockWidgetFromName(secondName); if (first && second) { obj = first->manualDock(second, - (orientation == (int)Qt::Vertical)? KDockWidget::DockLeft : KDockWidget::DockTop, + (orientation == (int)TQt::Vertical)? KDockWidget::DockLeft : KDockWidget::DockTop, separatorPos); if (obj) obj->setName(name.latin1()); @@ -2458,7 +2461,7 @@ void KDockManager::removeFromAutoCreateList(KDockWidget* pDockWidget) { if (!autoCreateDock) return; autoCreateDock->setAutoDelete(false); - autoCreateDock->removeRef(TQT_TQOBJECT(pDockWidget)); + autoCreateDock->removeRef(pDockWidget); autoCreateDock->setAutoDelete(true); } @@ -2494,7 +2497,7 @@ void KDockManager::writeConfig( TDEConfig* c, TQString group ) ++it; //debug(" +Add subdock %s", obj->name()); nList.append( obj->name() ); - if ( TQT_BASE_OBJECT(obj->parent()) == TQT_BASE_OBJECT(main) ) + if ( obj->parent() == main ) c->writeEntry( "Main:view", obj->name() ); } @@ -2702,9 +2705,9 @@ void KDockManager::readConfig( TDEConfig* c, TQString group ) KDockWidget* last = getDockWidgetFromName( c->readEntry( oname + ":last_name" ) ); int sepPos = c->readNumEntry( oname + ":sepPos" ); - Qt::Orientation p = (Qt::Orientation)c->readNumEntry( oname + ":orientation" ); + TQt::Orientation p = (TQt::Orientation)c->readNumEntry( oname + ":orientation" ); if ( first && last ){ - obj = first->manualDock( last, ( p ==Qt::Vertical ) ? KDockWidget::DockLeft : KDockWidget::DockTop, sepPos ); + obj = first->manualDock( last, ( p ==TQt::Vertical ) ? KDockWidget::DockLeft : KDockWidget::DockTop, sepPos ); if (obj){ obj->setName( oname.latin1() ); } @@ -2831,7 +2834,7 @@ KDockWidget* KDockManager::getDockWidgetFromName( const TQString& dockName ) if ( autoCreateDock ){ kdDebug(282)<<"Autocreating dock: "<<dockName<<endl; autoCreate = new KDockWidget( this, dockName.latin1(), TQPixmap(TQString("")) ); - autoCreateDock->append( TQT_TQOBJECT(autoCreate) ); + autoCreateDock->append( autoCreate ); } return autoCreate; } @@ -3046,7 +3049,7 @@ void KDockArea::resizeEvent(TQResizeEvent *rsize) #ifndef NO_KDE2 // kdDebug(282)<<"KDockArea::resize"<<endl; #endif - TQObjectList *list=queryList(TQWIDGET_OBJECT_NAME_STRING,0,false); + TQObjectList *list=queryList("TQWidget",0,false); TQObjectListIt it( *list ); // iterate over the buttons TQObject *obj; |