summaryrefslogtreecommitdiffstats
path: root/kdevdesigner/designer/actiondnd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kdevdesigner/designer/actiondnd.cpp')
-rw-r--r--kdevdesigner/designer/actiondnd.cpp172
1 files changed, 86 insertions, 86 deletions
diff --git a/kdevdesigner/designer/actiondnd.cpp b/kdevdesigner/designer/actiondnd.cpp
index 33f0c4bf..0d524d9e 100644
--- a/kdevdesigner/designer/actiondnd.cpp
+++ b/kdevdesigner/designer/actiondnd.cpp
@@ -105,13 +105,13 @@ bool QDesignerAction::addTo( TQWidget *w )
if ( !widgetToInsert )
return TQAction::addTo( w );
- if ( ::tqqt_cast<TQPopupMenu*>(w) )
- return FALSE;
+ if ( ::tqt_cast<TQPopupMenu*>(w) )
+ return false;
- widgetToInsert->reparent( w, TQPoint( 0, 0 ), FALSE );
+ widgetToInsert->reparent( w, TQPoint( 0, 0 ), false );
widgetToInsert->show();
addedTo( widgetToInsert, w );
- return TRUE;
+ return true;
}
bool QDesignerAction::removeFrom( TQWidget *w )
@@ -120,30 +120,30 @@ bool QDesignerAction::removeFrom( TQWidget *w )
return TQAction::removeFrom( w );
remove();
- return TRUE;
+ return true;
}
void QDesignerAction::remove()
{
if ( !widgetToInsert )
return;
- MainWindow::self->formWindow()->selectWidget( TQT_TQOBJECT(widgetToInsert), FALSE );
- widgetToInsert->reparent( 0, TQPoint( 0, 0 ), FALSE );
+ MainWindow::self->formWindow()->selectWidget( widgetToInsert, false );
+ widgetToInsert->reparent( 0, TQPoint( 0, 0 ), false );
}
-QDesignerToolBarSeparator::QDesignerToolBarSeparator(Qt::Orientation o , TQToolBar *parent,
+QDesignerToolBarSeparator::QDesignerToolBarSeparator(TQt::Orientation o , TQToolBar *parent,
const char* name )
: TQWidget( parent, name )
{
- connect( parent, TQT_SIGNAL(orientationChanged(Qt::Orientation)),
- this, TQT_SLOT(setOrientation(Qt::Orientation)) );
+ connect( parent, TQ_SIGNAL(orientationChanged(TQt::Orientation)),
+ this, TQ_SLOT(setOrientation(TQt::Orientation)) );
setOrientation( o );
setBackgroundMode( parent->backgroundMode() );
setBackgroundOrigin( ParentOrigin );
setSizePolicy( TQSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Minimum ) );
}
-void QDesignerToolBarSeparator::setOrientation( Qt::Orientation o )
+void QDesignerToolBarSeparator::setOrientation( TQt::Orientation o )
{
orient = o;
}
@@ -157,7 +157,7 @@ TQSize QDesignerToolBarSeparator::sizeHint() const
{
int extent = style().pixelMetric( TQStyle::PM_DockWindowSeparatorExtent,
this );
- if ( orient ==Qt::Horizontal )
+ if ( orient ==TQt::Horizontal )
return TQSize( extent, 0 );
else
return TQSize( 0, extent );
@@ -168,10 +168,10 @@ void QDesignerToolBarSeparator::paintEvent( TQPaintEvent * )
TQPainter p( this );
TQStyle::SFlags flags = TQStyle::Style_Default;
- if ( orientation() ==Qt::Horizontal )
+ if ( orientation() ==TQt::Horizontal )
flags |= TQStyle::Style_Horizontal;
- style().tqdrawPrimitive( TQStyle::PE_DockWindowSeparator, &p, rect(),
+ style().drawPrimitive( TQStyle::PE_DockWindowSeparator, &p, rect(),
colorGroup(), flags );
}
@@ -184,28 +184,28 @@ QSeparatorAction::QSeparatorAction( TQObject *parent )
bool QSeparatorAction::addTo( TQWidget *w )
{
- if ( ::tqqt_cast<TQToolBar*>(w) ) {
+ if ( ::tqt_cast<TQToolBar*>(w) ) {
TQToolBar *tb = (TQToolBar*)w;
wid = new QDesignerToolBarSeparator( tb->orientation(), tb );
- return TRUE;
- } else if ( ::tqqt_cast<TQPopupMenu*>(w) ) {
+ return true;
+ } else if ( ::tqt_cast<TQPopupMenu*>(w) ) {
idx = ( (TQPopupMenu*)w )->count();
( (TQPopupMenu*)w )->insertSeparator( idx );
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool QSeparatorAction::removeFrom( TQWidget *w )
{
- if ( ::tqqt_cast<TQToolBar*>(w) ) {
+ if ( ::tqt_cast<TQToolBar*>(w) ) {
delete wid;
- return TRUE;
- } else if ( ::tqqt_cast<TQPopupMenu*>(w) ) {
+ return true;
+ } else if ( ::tqt_cast<TQPopupMenu*>(w) ) {
( (TQPopupMenu*)w )->removeItemAt( idx );
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
TQWidget *QSeparatorAction::widget() const
@@ -219,38 +219,38 @@ QDesignerToolBar::QDesignerToolBar( TQMainWindow *mw )
: TQToolBar( mw ), lastIndicatorPos( -1, -1 )
{
insertAnchor = 0;
- afterAnchor = TRUE;
- setAcceptDrops( TRUE );
- MetaDataBase::addEntry( TQT_TQOBJECT(this) );
+ afterAnchor = true;
+ setAcceptDrops( true );
+ MetaDataBase::addEntry( this );
lastIndicatorPos = TQPoint( -1, -1 );
indicator = new QDesignerIndicatorWidget( this );
indicator->hide();
installEventFilter( this );
- widgetInserting = FALSE;
+ widgetInserting = false;
findFormWindow();
- mw->setDockEnabled( DockTornOff, FALSE );
+ mw->setDockEnabled( DockTornOff, false );
}
QDesignerToolBar::QDesignerToolBar( TQMainWindow *mw, Dock dock )
: TQToolBar( TQString(), mw, dock), lastIndicatorPos( -1, -1 )
{
insertAnchor = 0;
- afterAnchor = TRUE;
- setAcceptDrops( TRUE );
+ afterAnchor = true;
+ setAcceptDrops( true );
indicator = new QDesignerIndicatorWidget( this );
indicator->hide();
- MetaDataBase::addEntry( TQT_TQOBJECT(this) );
+ MetaDataBase::addEntry( this );
installEventFilter( this );
- widgetInserting = FALSE;
+ widgetInserting = false;
findFormWindow();
- mw->setDockEnabled( DockTornOff, FALSE );
+ mw->setDockEnabled( DockTornOff, false );
}
void QDesignerToolBar::findFormWindow()
{
TQWidget *w = this;
while ( w ) {
- formWindow = ::tqqt_cast<FormWindow*>(w);
+ formWindow = ::tqt_cast<FormWindow*>(w);
if ( formWindow )
break;
w = w->parentWidget();
@@ -260,11 +260,11 @@ void QDesignerToolBar::findFormWindow()
void QDesignerToolBar::addAction( TQAction *a )
{
actionList.append( a );
- connect( a, TQT_SIGNAL( destroyed() ), this, TQT_SLOT( actionRemoved() ) );
- if ( ::tqqt_cast<TQActionGroup*>(a) ) {
+ connect( a, TQ_SIGNAL( destroyed() ), this, TQ_SLOT( actionRemoved() ) );
+ if ( ::tqt_cast<TQActionGroup*>(a) ) {
( (QDesignerActionGroup*)a )->widget()->installEventFilter( this );
actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a );
- } else if ( ::tqqt_cast<QSeparatorAction*>(a) ) {
+ } else if ( ::tqt_cast<QSeparatorAction*>(a) ) {
( (QSeparatorAction*)a )->widget()->installEventFilter( this );
actionMap.insert( ( (QSeparatorAction*)a )->widget(), a );
} else {
@@ -275,52 +275,52 @@ void QDesignerToolBar::addAction( TQAction *a )
static void fixObject( TQObject *&o )
{
- while ( o && o->parent() && !::tqqt_cast<QDesignerToolBar*>(o->parent()) )
+ while ( o && o->parent() && !::tqt_cast<QDesignerToolBar*>(o->parent()) )
o = o->parent();
}
bool QDesignerToolBar::eventFilter( TQObject *o, TQEvent *e )
{
- if ( !o || !e || o->inherits( TQDOCKWINDOWHANDLE_OBJECT_NAME_STRING ) || o->inherits( "TQDockWindowTitleBar" ) )
+ if ( !o || !e || o->inherits( "TQDockWindowHandle" ) || o->inherits( "TQDockWindowTitleBar" ) )
return TQToolBar::eventFilter( o, e );
- if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) && e->type() == TQEvent::MouseButtonPress &&
- ( ( TQMouseEvent*)e )->button() == Qt::LeftButton ) {
+ if ( o == this && e->type() == TQEvent::MouseButtonPress &&
+ ( ( TQMouseEvent*)e )->button() == TQt::LeftButton ) {
mousePressEvent( (TQMouseEvent*)e );
- return TRUE;
+ return true;
}
- if ( TQT_BASE_OBJECT(o) == TQT_BASE_OBJECT(this) )
+ if ( o == this )
return TQToolBar::eventFilter( o, e );
if ( e->type() == TQEvent::MouseButtonPress ) {
TQMouseEvent *ke = (TQMouseEvent*)e;
fixObject( o );
if ( !o )
- return FALSE;
+ return false;
buttonMousePressEvent( ke, o );
- return TRUE;
+ return true;
} else if(e->type() == TQEvent::ContextMenu ) {
TQContextMenuEvent *ce = (TQContextMenuEvent*)e;
fixObject( o );
if( !o )
- return FALSE;
+ return false;
buttonContextMenuEvent( ce, o );
- return TRUE;
+ return true;
} else if ( e->type() == TQEvent::MouseMove ) {
TQMouseEvent *ke = (TQMouseEvent*)e;
fixObject( o );
if ( !o )
- return FALSE;
+ return false;
buttonMouseMoveEvent( ke, o );
- return TRUE;
+ return true;
} else if ( e->type() == TQEvent::MouseButtonRelease ) {
TQMouseEvent *ke = (TQMouseEvent*)e;
fixObject( o );
if ( !o )
- return FALSE;
+ return false;
buttonMouseReleaseEvent( ke, o );
- return TRUE;
+ return true;
} else if ( e->type() == TQEvent::DragEnter ) {
TQDragEnterEvent *de = (TQDragEnterEvent*)e;
if (ActionDrag::canDecode(de))
@@ -358,20 +358,20 @@ void QDesignerToolBar::contextMenuEvent( TQContextMenuEvent *e )
void QDesignerToolBar::mousePressEvent( TQMouseEvent *e )
{
- widgetInserting = FALSE;
- if ( e->button() == Qt::LeftButton &&
+ widgetInserting = false;
+ if ( e->button() == TQt::LeftButton &&
MainWindow::self->currentTool() != POINTER_TOOL &&
MainWindow::self->currentTool() != ORDER_TOOL &&
MainWindow::self->currentTool() != CONNECT_TOOL &&
MainWindow::self->currentTool() != BUDDY_TOOL )
- widgetInserting = TRUE;
+ widgetInserting = true;
}
void QDesignerToolBar::mouseReleaseEvent( TQMouseEvent *e )
{
if ( widgetInserting )
doInsertWidget( mapFromGlobal( e->globalPos() ) );
- widgetInserting = FALSE;
+ widgetInserting = false;
}
void QDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w )
@@ -379,10 +379,10 @@ void QDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w )
if ( widgetInserting )
doInsertWidget( mapFromGlobal( e->globalPos() ) );
else if ( w->isWidgetType() && formWindow->widgets()->find( w ) ) {
- formWindow->clearSelection( FALSE );
+ formWindow->clearSelection( false );
formWindow->selectWidget( w );
}
- widgetInserting = FALSE;
+ widgetInserting = false;
}
void QDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject *o )
@@ -393,7 +393,7 @@ void QDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject *
const int ID_SEP = 2;
const int ID_DELTOOLBAR = 3;
TQMap<TQWidget*, TQAction*>::Iterator it = actionMap.find( (TQWidget*)o );
- if ( it != actionMap.end() && ::tqqt_cast<QSeparatorAction*>(*it) )
+ if ( it != actionMap.end() && ::tqt_cast<QSeparatorAction*>(*it) )
menu.insertItem( i18n( "Delete Separator" ), ID_DELETE );
else
menu.insertItem( i18n( "Delete Item" ), ID_DELETE );
@@ -438,17 +438,17 @@ void QDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject *
void QDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * )
{
- widgetInserting = FALSE;
+ widgetInserting = false;
- if ( e->button() == Qt::MidButton )
+ if ( e->button() == TQt::MidButton )
return;
- if ( e->button() == Qt::LeftButton &&
+ if ( e->button() == TQt::LeftButton &&
MainWindow::self->currentTool() != POINTER_TOOL &&
MainWindow::self->currentTool() != ORDER_TOOL &&
MainWindow::self->currentTool() != CONNECT_TOOL &&
MainWindow::self->currentTool() != BUDDY_TOOL ) {
- widgetInserting = TRUE;
+ widgetInserting = true;
return;
}
@@ -474,7 +474,7 @@ void QDesignerToolBar::removeWidget( TQWidget *w )
void QDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o )
{
- if ( widgetInserting || ( e->state() & Qt::LeftButton ) == 0 )
+ if ( widgetInserting || ( e->state() & TQt::LeftButton ) == 0 )
return;
if ( TQABS( TQPoint( dragStartPos - e->pos() ).manhattanLength() ) < TQApplication::startDragDistance() )
return;
@@ -494,13 +494,13 @@ void QDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o )
TQApplication::sendPostedEvents();
adjustSize();
- TQString type = ::tqqt_cast<TQActionGroup*>(a) ? TQString( "application/x-designer-actiongroup" ) :
- ::tqqt_cast<QSeparatorAction*>(a) ? TQString( "application/x-designer-separator" ) : TQString( "application/x-designer-actions" );
+ TQString type = ::tqt_cast<TQActionGroup*>(a) ? TQString( "application/x-designer-actiongroup" ) :
+ ::tqt_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<QDesignerAction*>(a) ) {
+ if ( ::tqt_cast<QDesignerAction*>(a) ) {
if ( formWindow->widgets()->find( ( (QDesignerAction*)a )->widget() ) )
- formWindow->selectWidget( ( TQT_TQOBJECT(( (QDesignerAction*)a )->widget())), FALSE );
+ formWindow->selectWidget( ( ( (QDesignerAction*)a )->widget()), false );
}
if ( !drag->drag() ) {
AddActionToToolBarCommand *cmd = new AddActionToToolBarCommand( i18n( "Add Action '%1' to Toolbar '%2'" ).
@@ -517,7 +517,7 @@ void QDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o )
void QDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e )
{
- widgetInserting = FALSE;
+ widgetInserting = false;
lastIndicatorPos = TQPoint( -1, -1 );
if (ActionDrag::canDecode(e))
e->accept();
@@ -535,7 +535,7 @@ void QDesignerToolBar::dragLeaveEvent( TQDragLeaveEvent * )
{
indicator->hide();
insertAnchor = 0;
- afterAnchor = TRUE;
+ afterAnchor = true;
}
void QDesignerToolBar::dropEvent( TQDropEvent *e )
@@ -555,11 +555,11 @@ void QDesignerToolBar::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<QDesignerAction*>(ActionDrag::action());
+ a = ::tqt_cast<QDesignerAction*>(ActionDrag::action());
else
- a = ::tqqt_cast<QSeparatorAction*>(ActionDrag::action());
+ a = ::tqt_cast<QSeparatorAction*>(ActionDrag::action());
} else {
- a = ::tqqt_cast<QDesignerActionGroup*>(ActionDrag::action());
+ a = ::tqt_cast<QDesignerActionGroup*>(ActionDrag::action());
}
if ( actionList.findRef( a ) != -1 ) {
@@ -588,14 +588,14 @@ void QDesignerToolBar::reInsert()
clear();
for ( a = actionList.first(); a; a = actionList.next() ) {
a->addTo( this );
- if ( ::tqqt_cast<TQActionGroup*>(a) ) {
+ if ( ::tqt_cast<TQActionGroup*>(a) ) {
actionMap.insert( ( (QDesignerActionGroup*)a )->widget(), a );
if ( ( (QDesignerActionGroup*)a )->widget() )
( (QDesignerActionGroup*)a )->widget()->installEventFilter( this );
- } else if ( ::tqqt_cast<QDesignerAction*>(a) ) {
+ } else if ( ::tqt_cast<QDesignerAction*>(a) ) {
actionMap.insert( ( (QDesignerAction*)a )->widget(), a );
( (QDesignerAction*)a )->widget()->installEventFilter( this );
- } else if ( ::tqqt_cast<QSeparatorAction*>(a) ) {
+ } else if ( ::tqt_cast<QSeparatorAction*>(a) ) {
actionMap.insert( ( (QSeparatorAction*)a )->widget(), a );
( (QSeparatorAction*)a )->widget()->installEventFilter( this );
}
@@ -611,10 +611,10 @@ void QDesignerToolBar::actionRemoved()
TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos )
{
- if ( orientation() ==Qt::Horizontal ) {
+ if ( orientation() ==TQt::Horizontal ) {
TQPoint pnt( width() - 2, 0 );
insertAnchor = 0;
- afterAnchor = TRUE;
+ afterAnchor = true;
TQObjectList clo = childrenListObject();
if ( clo.isEmpty() )
return pnt;
@@ -629,7 +629,7 @@ TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos )
if ( w->x() < pos.x() ) {
pnt.setX( w->x() + w->width() + 1 );
insertAnchor = w;
- afterAnchor = TRUE;
+ afterAnchor = true;
}
}
}
@@ -637,7 +637,7 @@ TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos )
} else {
TQPoint pnt( 0, height() - 2 );
insertAnchor = 0;
- afterAnchor = TRUE;
+ afterAnchor = true;
TQObjectList clo = childrenListObject();
if ( clo.isEmpty() )
return pnt;
@@ -652,7 +652,7 @@ TQPoint QDesignerToolBar::calcIndicatorPos( const TQPoint &pos )
if ( w->y() < pos.y() ) {
pnt.setY( w->y() + w->height() + 1 );
insertAnchor = w;
- afterAnchor = TRUE;
+ afterAnchor = true;
}
}
}
@@ -665,7 +665,7 @@ void QDesignerToolBar::drawIndicator( const TQPoint &pos )
if ( lastIndicatorPos == pos )
return;
bool wasVsisible = indicator->isVisible();
- if ( orientation() ==Qt::Horizontal ) {
+ if ( orientation() ==TQt::Horizontal ) {
indicator->resize( 3, height() );
if ( pos != TQPoint( -1, -1 ) )
indicator->move( pos.x() - 1, 0 );
@@ -689,9 +689,9 @@ void QDesignerToolBar::doInsertWidget( const TQPoint &p )
if ( formWindow != MainWindow::self->formWindow() )
return;
calcIndicatorPos( p );
- TQWidget *w = WidgetFactory::create( MainWindow::self->currentTool(), this, 0, TRUE );
+ TQWidget *w = WidgetFactory::create( MainWindow::self->currentTool(), this, 0, true );
installEventFilters( w );
- MainWindow::self->formWindow()->insertWidget( w, TRUE );
+ MainWindow::self->formWindow()->insertWidget( w, true );
QDesignerAction *a = new QDesignerAction( w, parent() );
int index = actionList.findRef( *actionMap.find( insertAnchor ) );
if ( index != -1 && afterAnchor )
@@ -709,7 +709,7 @@ void QDesignerToolBar::doInsertWidget( const TQPoint &p )
void QDesignerToolBar::clear()
{
for ( TQAction *a = actionList.first(); a; a = actionList.next() ) {
- if ( ::tqqt_cast<QDesignerAction*>(a) )
+ if ( ::tqt_cast<QDesignerAction*>(a) )
( (QDesignerAction*)a )->remove();
}
TQToolBar::clear();
@@ -719,7 +719,7 @@ void QDesignerToolBar::installEventFilters( TQWidget *w )
{
if ( !w )
return;
- TQObjectList *l = w->queryList( TQWIDGET_OBJECT_NAME_STRING );
+ TQObjectList *l = w->queryList( "TQWidget" );
for ( TQObject *o = l->first(); o; o = l->next() )
o->installEventFilter( this );
delete l;