diff options
Diffstat (limited to 'kdevdesigner/designer/actiondnd.cpp')
-rw-r--r-- | kdevdesigner/designer/actiondnd.cpp | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/kdevdesigner/designer/actiondnd.cpp b/kdevdesigner/designer/actiondnd.cpp index 2bd08500..a94b74ff 100644 --- a/kdevdesigner/designer/actiondnd.cpp +++ b/kdevdesigner/designer/actiondnd.cpp @@ -84,7 +84,7 @@ ActionDrag::~ActionDrag() the_action = 0; } -void TQDesignerAction::init() +void QDesignerAction::init() { MetaDataBase::addEntry( this ); int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( this ) ); @@ -92,7 +92,7 @@ void TQDesignerAction::init() WidgetFactory::saveChangedProperties( this, id ); } -void TQDesignerActionGroup::init() +void QDesignerActionGroup::init() { MetaDataBase::addEntry( this ); int id = WidgetDatabase::idFromClassName( WidgetFactory::classNameOf( this ) ); @@ -100,7 +100,7 @@ void TQDesignerActionGroup::init() WidgetFactory::saveChangedProperties( this, id ); } -bool TQDesignerAction::addTo( TQWidget *w ) +bool QDesignerAction::addTo( TQWidget *w ) { if ( !widgetToInsert ) return TQAction::addTo( w ); @@ -114,7 +114,7 @@ bool TQDesignerAction::addTo( TQWidget *w ) return TRUE; } -bool TQDesignerAction::removeFrom( TQWidget *w ) +bool QDesignerAction::removeFrom( TQWidget *w ) { if ( !widgetToInsert ) return TQAction::removeFrom( w ); @@ -123,7 +123,7 @@ bool TQDesignerAction::removeFrom( TQWidget *w ) return TRUE; } -void TQDesignerAction::remove() +void QDesignerAction::remove() { if ( !widgetToInsert ) return; @@ -131,7 +131,7 @@ void TQDesignerAction::remove() widgetToInsert->reparent( 0, TQPoint( 0, 0 ), FALSE ); } -TQDesignerToolBarSeparator::TQDesignerToolBarSeparator(Qt::Orientation o , TQToolBar *tqparent, +QDesignerToolBarSeparator::QDesignerToolBarSeparator(Qt::Orientation o , TQToolBar *tqparent, const char* name ) : TQWidget( tqparent, name ) { @@ -143,17 +143,17 @@ TQDesignerToolBarSeparator::TQDesignerToolBarSeparator(Qt::Orientation o , TQToo tqsetSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) ); } -void TQDesignerToolBarSeparator::setOrientation( Qt::Orientation o ) +void QDesignerToolBarSeparator::setOrientation( Qt::Orientation o ) { orient = o; } -void TQDesignerToolBarSeparator::styleChange( TQStyle& ) +void QDesignerToolBarSeparator::styleChange( TQStyle& ) { setOrientation( orient ); } -TQSize TQDesignerToolBarSeparator::tqsizeHint() const +TQSize QDesignerToolBarSeparator::tqsizeHint() const { int extent = tqstyle().tqpixelMetric( TQStyle::PM_DockWindowSeparatorExtent, this ); @@ -163,7 +163,7 @@ TQSize TQDesignerToolBarSeparator::tqsizeHint() const return TQSize( 0, extent ); } -void TQDesignerToolBarSeparator::paintEvent( TQPaintEvent * ) +void QDesignerToolBarSeparator::paintEvent( TQPaintEvent * ) { TQPainter p( this ); TQStyle::SFlags flags = TQStyle::Style_Default; @@ -177,16 +177,16 @@ void TQDesignerToolBarSeparator::paintEvent( TQPaintEvent * ) -TQSeparatorAction::TQSeparatorAction( TQObject *tqparent ) +QSeparatorAction::QSeparatorAction( TQObject *tqparent ) : TQAction( tqparent, "qt_designer_separator" ), wid( 0 ) { } -bool TQSeparatorAction::addTo( TQWidget *w ) +bool QSeparatorAction::addTo( TQWidget *w ) { if ( ::tqqt_cast<TQToolBar*>(w) ) { TQToolBar *tb = (TQToolBar*)w; - wid = new TQDesignerToolBarSeparator( tb->orientation(), tb ); + wid = new QDesignerToolBarSeparator( tb->orientation(), tb ); return TRUE; } else if ( ::tqqt_cast<TQPopupMenu*>(w) ) { idx = ( (TQPopupMenu*)w )->count(); @@ -196,7 +196,7 @@ bool TQSeparatorAction::addTo( TQWidget *w ) return FALSE; } -bool TQSeparatorAction::removeFrom( TQWidget *w ) +bool QSeparatorAction::removeFrom( TQWidget *w ) { if ( ::tqqt_cast<TQToolBar*>(w) ) { delete wid; @@ -208,14 +208,14 @@ bool TQSeparatorAction::removeFrom( TQWidget *w ) return FALSE; } -TQWidget *TQSeparatorAction::widget() const +TQWidget *QSeparatorAction::widget() const { return wid; } -TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw ) +QDesignerToolBar::QDesignerToolBar( TQMainWindow *mw ) : TQToolBar( mw ), lastIndicatorPos( -1, -1 ) { insertAnchor = 0; @@ -223,7 +223,7 @@ TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw ) setAcceptDrops( TRUE ); MetaDataBase::addEntry( TQT_TQOBJECT(this) ); lastIndicatorPos = TQPoint( -1, -1 ); - indicator = new TQDesignerIndicatorWidget( this ); + indicator = new QDesignerIndicatorWidget( this ); indicator->hide(); installEventFilter( this ); widgetInserting = FALSE; @@ -231,13 +231,13 @@ TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw ) mw->setDockEnabled( DockTornOff, FALSE ); } -TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw, Dock dock ) +QDesignerToolBar::QDesignerToolBar( TQMainWindow *mw, Dock dock ) : TQToolBar( TQString(), mw, dock), lastIndicatorPos( -1, -1 ) { insertAnchor = 0; afterAnchor = TRUE; setAcceptDrops( TRUE ); - indicator = new TQDesignerIndicatorWidget( this ); + indicator = new QDesignerIndicatorWidget( this ); indicator->hide(); MetaDataBase::addEntry( TQT_TQOBJECT(this) ); installEventFilter( this ); @@ -246,7 +246,7 @@ TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw, Dock dock ) mw->setDockEnabled( DockTornOff, FALSE ); } -void TQDesignerToolBar::findFormWindow() +void QDesignerToolBar::findFormWindow() { TQWidget *w = this; while ( w ) { @@ -257,29 +257,29 @@ void TQDesignerToolBar::findFormWindow() } } -void TQDesignerToolBar::addAction( TQAction *a ) +void QDesignerToolBar::addAction( TQAction *a ) { actionList.append( a ); connect( a, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( actionRemoved() ) ); if ( ::tqqt_cast<TQActionGroup*>(a) ) { - ( (TQDesignerActionGroup*)a )->widget()->installEventFilter( this ); - actionMap.insert( ( (TQDesignerActionGroup*)a )->widget(), a ); - } else if ( ::tqqt_cast<TQSeparatorAction*>(a) ) { - ( (TQSeparatorAction*)a )->widget()->installEventFilter( this ); - actionMap.insert( ( (TQSeparatorAction*)a )->widget(), a ); + ( (QDesignerActionGroup*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a ); + } else if ( ::tqqt_cast<QSeparatorAction*>(a) ) { + ( (QSeparatorAction*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (QSeparatorAction*)a )->widget(), a ); } else { - ( (TQDesignerAction*)a )->widget()->installEventFilter( this ); - actionMap.insert( ( (TQDesignerAction*)a )->widget(), a ); + ( (QDesignerAction*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (QDesignerAction*)a )->widget(), a ); } } static void fixObject( TQObject *&o ) { - while ( o && o->tqparent() && !::tqqt_cast<TQDesignerToolBar*>(o->tqparent()) ) + while ( o && o->tqparent() && !::tqqt_cast<QDesignerToolBar*>(o->tqparent()) ) o = o->tqparent(); } -bool TQDesignerToolBar::eventFilter( TQObject *o, TQEvent *e ) +bool QDesignerToolBar::eventFilter( TQObject *o, TQEvent *e ) { if ( !o || !e || o->inherits( TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING ) || o->inherits( "TQDockWindowTitleBar" ) ) return TQToolBar::eventFilter( o, e ); @@ -334,7 +334,7 @@ bool TQDesignerToolBar::eventFilter( TQObject *o, TQEvent *e ) return TQToolBar::eventFilter( o, e ); } -void TQDesignerToolBar::paintEvent( TQPaintEvent *e ) +void QDesignerToolBar::paintEvent( TQPaintEvent *e ) { TQToolBar::paintEvent( e ); if ( e->rect() != rect() ) @@ -342,7 +342,7 @@ void TQDesignerToolBar::paintEvent( TQPaintEvent *e ) lastIndicatorPos = TQPoint( -1, -1 ); } -void TQDesignerToolBar::contextMenuEvent( TQContextMenuEvent *e ) +void QDesignerToolBar::contextMenuEvent( TQContextMenuEvent *e ) { e->accept(); TQPopupMenu menu( 0 ); @@ -356,7 +356,7 @@ void TQDesignerToolBar::contextMenuEvent( TQContextMenuEvent *e ) } } -void TQDesignerToolBar::mousePressEvent( TQMouseEvent *e ) +void QDesignerToolBar::mousePressEvent( TQMouseEvent *e ) { widgetInserting = FALSE; if ( e->button() == Qt::LeftButton && @@ -367,14 +367,14 @@ void TQDesignerToolBar::mousePressEvent( TQMouseEvent *e ) widgetInserting = TRUE; } -void TQDesignerToolBar::mouseReleaseEvent( TQMouseEvent *e ) +void QDesignerToolBar::mouseReleaseEvent( TQMouseEvent *e ) { if ( widgetInserting ) doInsertWidget( mapFromGlobal( e->globalPos() ) ); widgetInserting = FALSE; } -void TQDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w ) +void QDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w ) { if ( widgetInserting ) doInsertWidget( mapFromGlobal( e->globalPos() ) ); @@ -385,7 +385,7 @@ void TQDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w ) widgetInserting = FALSE; } -void TQDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject *o ) +void QDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject *o ) { e->accept(); TQPopupMenu menu( 0 ); @@ -393,7 +393,7 @@ void TQDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject const int ID_SEP = 2; const int ID_DELTOOLBAR = 3; TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.tqfind( (TQWidget*)o ); - if ( it != actionMap.end() && ::tqqt_cast<TQSeparatorAction*>(*it) ) + if ( it != actionMap.end() && ::tqqt_cast<QSeparatorAction*>(*it) ) menu.insertItem( i18n( "Delete Separator" ), ID_DELETE ); else menu.insertItem( i18n( "Delete Item" ), ID_DELETE ); @@ -415,7 +415,7 @@ void TQDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject cmd->execute(); } else if ( res == ID_SEP ) { calcIndicatorPos( mapFromGlobal( e->globalPos() ) ); - TQAction *a = new TQSeparatorAction( 0 ); + TQAction *a = new QSeparatorAction( 0 ); int index = actionList.tqfindRef( *actionMap.tqfind( insertAnchor ) ); if ( index != -1 && afterAnchor ) ++index; @@ -436,7 +436,7 @@ void TQDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject } } -void TQDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * ) +void QDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * ) { widgetInserting = FALSE; @@ -455,7 +455,7 @@ void TQDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * ) dragStartPos = e->pos(); } -void TQDesignerToolBar::removeWidget( TQWidget *w ) +void QDesignerToolBar::removeWidget( TQWidget *w ) { TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.tqfind( w ); if ( it == actionMap.end() ) @@ -472,7 +472,7 @@ void TQDesignerToolBar::removeWidget( TQWidget *w ) adjustSize(); } -void TQDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o ) +void QDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o ) { if ( widgetInserting || ( e->state() & Qt::LeftButton ) == 0 ) return; @@ -495,12 +495,12 @@ void TQDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o ) adjustSize(); TQString type = ::tqqt_cast<TQActionGroup*>(a) ? TQString( "application/x-designer-actiongroup" ) : - ::tqqt_cast<TQSeparatorAction*>(a) ? TQString( "application/x-designer-separator" ) : TQString( "application/x-designer-actions" ); + ::tqqt_cast<QSeparatorAction*>(a) ? TQString( "application/x-designer-separator" ) : TQString( "application/x-designer-actions" ); TQStoredDrag *drag = new ActionDrag( type, a, this ); drag->setPixmap( a->iconSet().pixmap() ); - if ( ::tqqt_cast<TQDesignerAction*>(a) ) { - if ( formWindow->widgets()->tqfind( ( (TQDesignerAction*)a )->widget() ) ) - formWindow->selectWidget( ( TQT_TQOBJECT(( (TQDesignerAction*)a )->widget())), FALSE ); + if ( ::tqqt_cast<QDesignerAction*>(a) ) { + if ( formWindow->widgets()->tqfind( ( (QDesignerAction*)a )->widget() ) ) + formWindow->selectWidget( ( TQT_TQOBJECT(( (QDesignerAction*)a )->widget())), FALSE ); } if ( !drag->drag() ) { AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Action '%1' to Toolbar '%2'" ). @@ -515,7 +515,7 @@ void TQDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o ) #ifndef TQT_NO_DRAGANDDROP -void TQDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e ) +void QDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e ) { widgetInserting = FALSE; lastIndicatorPos = TQPoint( -1, -1 ); @@ -523,7 +523,7 @@ void TQDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e ) e->accept(); } -void TQDesignerToolBar::dragMoveEvent( TQDragMoveEvent *e ) +void QDesignerToolBar::dragMoveEvent( TQDragMoveEvent *e ) { if (ActionDrag::canDecode(e)) { e->accept(); @@ -531,14 +531,14 @@ void TQDesignerToolBar::dragMoveEvent( TQDragMoveEvent *e ) } } -void TQDesignerToolBar::dragLeaveEvent( TQDragLeaveEvent * ) +void QDesignerToolBar::dragLeaveEvent( TQDragLeaveEvent * ) { indicator->hide(); insertAnchor = 0; afterAnchor = TRUE; } -void TQDesignerToolBar::dropEvent( TQDropEvent *e ) +void QDesignerToolBar::dropEvent( TQDropEvent *e ) { if (!ActionDrag::canDecode(e)) return; @@ -555,11 +555,11 @@ void TQDesignerToolBar::dropEvent( TQDropEvent *e ) if ( e->provides( "application/x-designer-actions" ) || e->provides( "application/x-designer-separator" ) ) { if ( e->provides( "application/x-designer-actions" ) ) - a = ::tqqt_cast<TQDesignerAction*>(ActionDrag::action()); + a = ::tqqt_cast<QDesignerAction*>(ActionDrag::action()); else - a = ::tqqt_cast<TQSeparatorAction*>(ActionDrag::action()); + a = ::tqqt_cast<QSeparatorAction*>(ActionDrag::action()); } else { - a = ::tqqt_cast<TQDesignerActionGroup*>(ActionDrag::action()); + a = ::tqqt_cast<QDesignerActionGroup*>(ActionDrag::action()); } if ( actionList.tqfindRef( a ) != -1 ) { @@ -581,7 +581,7 @@ void TQDesignerToolBar::dropEvent( TQDropEvent *e ) #endif -void TQDesignerToolBar::reInsert() +void QDesignerToolBar::reInsert() { TQAction *a = 0; actionMap.clear(); @@ -589,27 +589,27 @@ void TQDesignerToolBar::reInsert() for ( a = actionList.first(); a; a = actionList.next() ) { a->addTo( this ); if ( ::tqqt_cast<TQActionGroup*>(a) ) { - actionMap.insert( ( (TQDesignerActionGroup*)a )->widget(), a ); - if ( ( (TQDesignerActionGroup*)a )->widget() ) - ( (TQDesignerActionGroup*)a )->widget()->installEventFilter( this ); - } else if ( ::tqqt_cast<TQDesignerAction*>(a) ) { - actionMap.insert( ( (TQDesignerAction*)a )->widget(), a ); - ( (TQDesignerAction*)a )->widget()->installEventFilter( this ); - } else if ( ::tqqt_cast<TQSeparatorAction*>(a) ) { - actionMap.insert( ( (TQSeparatorAction*)a )->widget(), a ); - ( (TQSeparatorAction*)a )->widget()->installEventFilter( this ); + actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a ); + if ( ( (QDesignerActionGroup*)a )->widget() ) + ( (QDesignerActionGroup*)a )->widget()->installEventFilter( this ); + } else if ( ::tqqt_cast<QDesignerAction*>(a) ) { + actionMap.insert( ( (QDesignerAction*)a )->widget(), a ); + ( (QDesignerAction*)a )->widget()->installEventFilter( this ); + } else if ( ::tqqt_cast<QSeparatorAction*>(a) ) { + actionMap.insert( ( (QSeparatorAction*)a )->widget(), a ); + ( (QSeparatorAction*)a )->widget()->installEventFilter( this ); } } TQApplication::sendPostedEvents(); adjustSize(); } -void TQDesignerToolBar::actionRemoved() +void QDesignerToolBar::actionRemoved() { actionList.removeRef( (TQAction*)sender() ); } -TQPoint TQDesignerToolBar::calcIndicatorPos( const TQPoint &pos ) +TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos ) { if ( orientation() ==Qt::Horizontal ) { TQPoint pnt( width() - 2, 0 ); @@ -660,7 +660,7 @@ TQPoint TQDesignerToolBar::calcIndicatorPos( const TQPoint &pos ) } } -void TQDesignerToolBar::drawIndicator( const TQPoint &pos ) +void QDesignerToolBar::drawIndicator( const TQPoint &pos ) { if ( lastIndicatorPos == pos ) return; @@ -684,7 +684,7 @@ void TQDesignerToolBar::drawIndicator( const TQPoint &pos ) TQApplication::sendPostedEvents(); } -void TQDesignerToolBar::doInsertWidget( const TQPoint &p ) +void QDesignerToolBar::doInsertWidget( const TQPoint &p ) { if ( formWindow != MainWindow::self->formWindow() ) return; @@ -692,7 +692,7 @@ void TQDesignerToolBar::doInsertWidget( const TQPoint &p ) TQWidget *w = WidgetFactory::create( MainWindow::self->currentTool(), this, 0, TRUE ); installEventFilters( w ); MainWindow::self->formWindow()->insertWidget( w, TRUE ); - TQDesignerAction *a = new TQDesignerAction( w, tqparent() ); + QDesignerAction *a = new QDesignerAction( w, tqparent() ); int index = actionList.tqfindRef( *actionMap.tqfind( insertAnchor ) ); if ( index != -1 && afterAnchor ) ++index; @@ -706,16 +706,16 @@ void TQDesignerToolBar::doInsertWidget( const TQPoint &p ) MainWindow::self->resetTool(); } -void TQDesignerToolBar::clear() +void QDesignerToolBar::clear() { for ( TQAction *a = actionList.first(); a; a = actionList.next() ) { - if ( ::tqqt_cast<TQDesignerAction*>(a) ) - ( (TQDesignerAction*)a )->remove(); + if ( ::tqqt_cast<QDesignerAction*>(a) ) + ( (QDesignerAction*)a )->remove(); } TQToolBar::clear(); } -void TQDesignerToolBar::installEventFilters( TQWidget *w ) +void QDesignerToolBar::installEventFilters( TQWidget *w ) { if ( !w ) return; |