@ -42,7 +42,7 @@
# include <klocale.h>
bool T QDesignerAction: : addTo ( TQWidget * w )
bool QDesignerAction: : addTo ( TQWidget * w )
{
if ( ! widgetToInsert )
return TQAction : : addTo ( w ) ;
@ -55,7 +55,7 @@ bool TQDesignerAction::addTo( TQWidget *w )
return true ;
}
bool T QDesignerAction: : removeFrom ( TQWidget * w )
bool QDesignerAction: : removeFrom ( TQWidget * w )
{
if ( ! widgetToInsert )
return TQAction : : removeFrom ( w ) ;
@ -64,7 +64,7 @@ bool TQDesignerAction::removeFrom( TQWidget *w )
return true ;
}
void T QDesignerAction: : remove ( )
void QDesignerAction: : remove ( )
{
if ( ! widgetToInsert )
return ;
@ -72,7 +72,7 @@ void TQDesignerAction::remove()
widgetToInsert - > reparent ( 0 , TQPoint ( 0 , 0 ) , false ) ;
}
T QDesignerToolBarSeparator: : T QDesignerToolBarSeparator( Qt : : Orientation o , TQToolBar * tqparent ,
QDesignerToolBarSeparator: : QDesignerToolBarSeparator( Qt : : Orientation o , TQToolBar * tqparent ,
const char * name )
: TQWidget ( tqparent , name )
{
@ -84,17 +84,17 @@ TQDesignerToolBarSeparator::TQDesignerToolBarSeparator(Qt::Orientation o , TQToo
tqsetSizePolicy ( TQSizePolicy ( TQSizePolicy : : Minimum , TQSizePolicy : : Minimum ) ) ;
}
void T QDesignerToolBarSeparator: : setOrientation ( Qt : : Orientation o )
void QDesignerToolBarSeparator: : setOrientation ( Qt : : Orientation o )
{
orient = o ;
}
void T QDesignerToolBarSeparator: : styleChange ( TQStyle & )
void QDesignerToolBarSeparator: : styleChange ( TQStyle & )
{
setOrientation ( orient ) ;
}
TQSize T QDesignerToolBarSeparator: : tqsizeHint ( ) const
TQSize QDesignerToolBarSeparator: : tqsizeHint ( ) const
{
int extent = tqstyle ( ) . tqpixelMetric ( TQStyle : : PM_DockWindowSeparatorExtent ,
this ) ;
@ -104,7 +104,7 @@ TQSize TQDesignerToolBarSeparator::tqsizeHint() const
return TQSize ( 0 , extent ) ;
}
void T QDesignerToolBarSeparator: : paintEvent ( TQPaintEvent * )
void QDesignerToolBarSeparator: : paintEvent ( TQPaintEvent * )
{
TQPainter p ( this ) ;
TQStyle : : SFlags flags = TQStyle : : Style_Default ;
@ -118,16 +118,16 @@ void TQDesignerToolBarSeparator::paintEvent( TQPaintEvent * )
T QSeparatorAction: : T QSeparatorAction( TQObject * tqparent )
QSeparatorAction: : QSeparatorAction( TQObject * tqparent )
: TQAction ( tqparent , " qt_designer_separator " ) , wid ( 0 )
{
}
bool T QSeparatorAction: : addTo ( TQWidget * w )
bool QSeparatorAction: : addTo ( TQWidget * w )
{
if ( w - > inherits ( TQTOOLBAR_OBJECT_NAME_STRING ) ) {
TQToolBar * tb = ( TQToolBar * ) w ;
wid = new T QDesignerToolBarSeparator( tb - > orientation ( ) , tb ) ;
wid = new QDesignerToolBarSeparator( tb - > orientation ( ) , tb ) ;
return true ;
} else if ( w - > inherits ( TQPOPUPMENU_OBJECT_NAME_STRING ) ) {
idx = ( ( TQPopupMenu * ) w ) - > count ( ) ;
@ -137,7 +137,7 @@ bool TQSeparatorAction::addTo( TQWidget *w )
return false ;
}
bool T QSeparatorAction: : removeFrom ( TQWidget * w )
bool QSeparatorAction: : removeFrom ( TQWidget * w )
{
if ( w - > inherits ( TQTOOLBAR_OBJECT_NAME_STRING ) ) {
delete wid ;
@ -149,7 +149,7 @@ bool TQSeparatorAction::removeFrom( TQWidget *w )
return false ;
}
TQWidget * T QSeparatorAction: : widget ( ) const
TQWidget * QSeparatorAction: : widget ( ) const
{
return wid ;
}
@ -157,7 +157,7 @@ TQWidget *TQSeparatorAction::widget() const
T QDesignerToolBar: : T QDesignerToolBar( TQMainWindow * mw )
QDesignerToolBar: : QDesignerToolBar( TQMainWindow * mw )
: TQToolBar ( mw ) , lastIndicatorPos ( - 1 , - 1 )
{
insertAnchor = 0 ;
@ -165,7 +165,7 @@ TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw )
setAcceptDrops ( true ) ;
MetaDataBase : : addEntry ( TQT_TQOBJECT ( this ) ) ;
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
indicator = new T QDesignerIndicatorWidget( this ) ;
indicator = new QDesignerIndicatorWidget( this ) ;
indicator - > hide ( ) ;
installEventFilter ( this ) ;
widgetInserting = false ;
@ -173,13 +173,13 @@ TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw )
mw - > setDockEnabled ( DockTornOff , false ) ;
}
T QDesignerToolBar: : T QDesignerToolBar( 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 T QDesignerIndicatorWidget( this ) ;
indicator = new QDesignerIndicatorWidget( this ) ;
indicator - > hide ( ) ;
MetaDataBase : : addEntry ( TQT_TQOBJECT ( this ) ) ;
installEventFilter ( this ) ;
@ -188,7 +188,7 @@ TQDesignerToolBar::TQDesignerToolBar( TQMainWindow *mw, Dock dock )
mw - > setDockEnabled ( DockTornOff , false ) ;
}
void T QDesignerToolBar: : findFormWindow ( )
void QDesignerToolBar: : findFormWindow ( )
{
TQWidget * w = this ;
while ( w ) {
@ -198,29 +198,29 @@ void TQDesignerToolBar::findFormWindow()
}
}
void T QDesignerToolBar: : addAction ( TQAction * a )
void QDesignerToolBar: : addAction ( TQAction * a )
{
actionList . append ( a ) ;
connect ( a , TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( actionRemoved ( ) ) ) ;
if ( a - > inherits ( TQACTIONGROUP_OBJECT_NAME_STRING ) ) {
( ( T QDesignerActionGroup* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
actionMap . insert ( ( ( T QDesignerActionGroup* ) a ) - > widget ( ) , a ) ;
} else if ( a - > inherits ( " T QSeparatorAction" ) ) {
( ( T QSeparatorAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
actionMap . insert ( ( ( T QSeparatorAction* ) a ) - > widget ( ) , a ) ;
( ( QDesignerActionGroup* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
actionMap . insert ( ( ( QDesignerActionGroup* ) a ) - > widget ( ) , a ) ;
} else if ( a - > inherits ( " QSeparatorAction" ) ) {
( ( QSeparatorAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
actionMap . insert ( ( ( QSeparatorAction* ) a ) - > widget ( ) , a ) ;
} else {
( ( T QDesignerAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
actionMap . insert ( ( ( T QDesignerAction* ) a ) - > widget ( ) , a ) ;
( ( QDesignerAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
actionMap . insert ( ( ( QDesignerAction* ) a ) - > widget ( ) , a ) ;
}
}
static void fixObject ( TQObject * & o )
{
while ( o & & o - > tqparent ( ) & & ! o - > tqparent ( ) - > inherits ( " T QDesignerToolBar" ) )
while ( o & & o - > tqparent ( ) & & ! o - > tqparent ( ) - > inherits ( " QDesignerToolBar" ) )
o = o - > tqparent ( ) ;
}
bool T QDesignerToolBar: : 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 ) ;
@ -279,7 +279,7 @@ bool TQDesignerToolBar::eventFilter( TQObject *o, TQEvent *e )
return TQToolBar : : eventFilter ( o , e ) ;
}
void T QDesignerToolBar: : paintEvent ( TQPaintEvent * e )
void QDesignerToolBar: : paintEvent ( TQPaintEvent * e )
{
TQToolBar : : paintEvent ( e ) ;
if ( e - > rect ( ) ! = rect ( ) )
@ -287,7 +287,7 @@ void TQDesignerToolBar::paintEvent( TQPaintEvent *e )
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
}
void T QDesignerToolBar: : contextMenuEvent ( TQContextMenuEvent * e )
void QDesignerToolBar: : contextMenuEvent ( TQContextMenuEvent * e )
{
e - > accept ( ) ;
TQPopupMenu menu ( 0 ) ;
@ -301,7 +301,7 @@ void TQDesignerToolBar::contextMenuEvent( TQContextMenuEvent *e )
}
}
void T QDesignerToolBar: : mousePressEvent ( TQMouseEvent * e )
void QDesignerToolBar: : mousePressEvent ( TQMouseEvent * e )
{
widgetInserting = false ;
if ( e - > button ( ) = = Qt : : LeftButton & &
@ -318,14 +318,14 @@ void TQDesignerToolBar::mousePressEvent( TQMouseEvent *e )
}
}
void T QDesignerToolBar: : mouseReleaseEvent ( TQMouseEvent * e )
void QDesignerToolBar: : mouseReleaseEvent ( TQMouseEvent * e )
{
if ( widgetInserting )
doInsertWidget ( mapFromGlobal ( e - > globalPos ( ) ) ) ;
widgetInserting = false ;
}
void T QDesignerToolBar: : buttonMouseReleaseEvent ( TQMouseEvent * e , TQObject * w )
void QDesignerToolBar: : buttonMouseReleaseEvent ( TQMouseEvent * e , TQObject * w )
{
if ( widgetInserting )
doInsertWidget ( mapFromGlobal ( e - > globalPos ( ) ) ) ;
@ -336,7 +336,7 @@ void TQDesignerToolBar::buttonMouseReleaseEvent( TQMouseEvent *e, TQObject *w )
widgetInserting = false ;
}
void T QDesignerToolBar: : buttonContextMenuEvent ( TQContextMenuEvent * e , TQObject * o )
void QDesignerToolBar: : buttonContextMenuEvent ( TQContextMenuEvent * e , TQObject * o )
{
e - > accept ( ) ;
TQPopupMenu menu ( 0 ) ;
@ -344,7 +344,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 ( ) & & ( * it ) - > inherits ( " T QSeparatorAction" ) )
if ( it ! = actionMap . end ( ) & & ( * it ) - > inherits ( " QSeparatorAction" ) )
menu . insertItem ( i18n ( " Delete Separator " ) , ID_DELETE ) ;
else
menu . insertItem ( i18n ( " Delete Item " ) , ID_DELETE ) ;
@ -366,7 +366,7 @@ void TQDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject
cmd - > execute ( ) ;
} else if ( res = = ID_SEP ) {
calcIndicatorPos ( mapFromGlobal ( e - > globalPos ( ) ) ) ;
TQAction * a = new T QSeparatorAction( 0 ) ;
TQAction * a = new QSeparatorAction( 0 ) ;
int index = actionList . tqfindRef ( * actionMap . tqfind ( insertAnchor ) ) ;
if ( index ! = - 1 & & afterAnchor )
+ + index ;
@ -387,7 +387,7 @@ void TQDesignerToolBar::buttonContextMenuEvent( TQContextMenuEvent *e, TQObject
}
}
void T QDesignerToolBar: : buttonMousePressEvent ( TQMouseEvent * e , TQObject * )
void QDesignerToolBar: : buttonMousePressEvent ( TQMouseEvent * e , TQObject * )
{
widgetInserting = false ;
@ -411,7 +411,7 @@ void TQDesignerToolBar::buttonMousePressEvent( TQMouseEvent *e, TQObject * )
dragStartPos = e - > pos ( ) ;
}
void T QDesignerToolBar: : removeWidget ( TQWidget * w )
void QDesignerToolBar: : removeWidget ( TQWidget * w )
{
TQMap < TQWidget * , TQAction * > : : Iterator it = actionMap . tqfind ( w ) ;
if ( it = = actionMap . end ( ) )
@ -428,7 +428,7 @@ void TQDesignerToolBar::removeWidget( TQWidget *w )
adjustSize ( ) ;
}
void T QDesignerToolBar: : buttonMouseMoveEvent ( TQMouseEvent * e , TQObject * o )
void QDesignerToolBar: : buttonMouseMoveEvent ( TQMouseEvent * e , TQObject * o )
{
if ( widgetInserting | | ( e - > state ( ) & Qt : : LeftButton ) = = 0 )
return ;
@ -451,14 +451,14 @@ void TQDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o )
adjustSize ( ) ;
TQString type = a - > inherits ( TQACTIONGROUP_OBJECT_NAME_STRING ) ? TQString ( " application/x-designer-actiongroup " ) :
a - > inherits ( " T QSeparatorAction" ) ? TQString ( " application/x-designer-separator " ) : TQString ( " application/x-designer-actions " ) ;
a - > inherits ( " QSeparatorAction" ) ? TQString ( " application/x-designer-separator " ) : TQString ( " application/x-designer-actions " ) ;
TQStoredDrag * drag = new TQStoredDrag ( type , this ) ;
TQString s = TQString : : number ( ( long ) a ) ; // #### huha, that is evil
drag - > setEncodedData ( TQCString ( s . latin1 ( ) ) ) ;
drag - > setPixmap ( a - > iconSet ( ) . pixmap ( ) ) ;
if ( a - > inherits ( " T QDesignerAction" ) ) {
if ( formWindow - > widgets ( ) - > tqfind ( ( ( T QDesignerAction* ) a ) - > widget ( ) ) )
formWindow - > selectWidget ( TQT_TQOBJECT ( ( ( T QDesignerAction* ) a ) - > widget ( ) ) , false ) ;
if ( a - > inherits ( " QDesignerAction" ) ) {
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' " ) .
@ -473,7 +473,7 @@ void TQDesignerToolBar::buttonMouseMoveEvent( TQMouseEvent *e, TQObject *o )
# ifndef TQT_NO_DRAGANDDROP
void T QDesignerToolBar: : dragEnterEvent ( TQDragEnterEvent * e )
void QDesignerToolBar: : dragEnterEvent ( TQDragEnterEvent * e )
{
widgetInserting = false ;
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
@ -483,7 +483,7 @@ void TQDesignerToolBar::dragEnterEvent( TQDragEnterEvent *e )
e - > accept ( ) ;
}
void T QDesignerToolBar: : dragMoveEvent ( TQDragMoveEvent * e )
void QDesignerToolBar: : dragMoveEvent ( TQDragMoveEvent * e )
{
if ( e - > provides ( " application/x-designer-actions " ) | |
e - > provides ( " application/x-designer-actiongroup " ) | |
@ -494,14 +494,14 @@ void TQDesignerToolBar::dragMoveEvent( TQDragMoveEvent *e )
drawIndicator ( calcIndicatorPos ( e - > pos ( ) ) ) ;
}
void T QDesignerToolBar: : dragLeaveEvent ( TQDragLeaveEvent * )
void QDesignerToolBar: : dragLeaveEvent ( TQDragLeaveEvent * )
{
indicator - > hide ( ) ;
insertAnchor = 0 ;
afterAnchor = true ;
}
void T QDesignerToolBar: : dropEvent ( TQDropEvent * e )
void QDesignerToolBar: : dropEvent ( TQDropEvent * e )
{
if ( e - > provides ( " application/x-designer-actions " ) | |
e - > provides ( " application/x-designer-actiongroup " ) | |
@ -527,11 +527,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 = ( T QDesignerAction* ) s . toLong ( ) ;
a = ( QDesignerAction* ) s . toLong ( ) ;
else
a = ( T QSeparatorAction* ) s . toLong ( ) ;
a = ( QSeparatorAction* ) s . toLong ( ) ;
} else {
a = ( T QDesignerActionGroup* ) s . toLong ( ) ;
a = ( QDesignerActionGroup* ) s . toLong ( ) ;
}
if ( actionList . tqfindRef ( a ) ! = - 1 ) {
@ -553,7 +553,7 @@ void TQDesignerToolBar::dropEvent( TQDropEvent *e )
# endif
void T QDesignerToolBar: : reInsert ( )
void QDesignerToolBar: : reInsert ( )
{
TQAction * a = 0 ;
actionMap . clear ( ) ;
@ -561,27 +561,27 @@ void TQDesignerToolBar::reInsert()
for ( a = actionList . first ( ) ; a ; a = actionList . next ( ) ) {
a - > addTo ( this ) ;
if ( a - > inherits ( TQACTIONGROUP_OBJECT_NAME_STRING ) ) {
actionMap . insert ( ( ( T QDesignerActionGroup* ) a ) - > widget ( ) , a ) ;
if ( ( ( T QDesignerActionGroup* ) a ) - > widget ( ) )
( ( T QDesignerActionGroup* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
} else if ( a - > inherits ( " T QDesignerAction" ) ) {
actionMap . insert ( ( ( T QDesignerAction* ) a ) - > widget ( ) , a ) ;
( ( T QDesignerAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
} else if ( a - > inherits ( " T QSeparatorAction" ) ) {
actionMap . insert ( ( ( T QSeparatorAction* ) a ) - > widget ( ) , a ) ;
( ( T QSeparatorAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
actionMap . insert ( ( ( QDesignerActionGroup* ) a ) - > widget ( ) , a ) ;
if ( ( ( QDesignerActionGroup* ) a ) - > widget ( ) )
( ( QDesignerActionGroup* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
} else if ( a - > inherits ( " QDesignerAction" ) ) {
actionMap . insert ( ( ( QDesignerAction* ) a ) - > widget ( ) , a ) ;
( ( QDesignerAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
} else if ( a - > inherits ( " QSeparatorAction" ) ) {
actionMap . insert ( ( ( QSeparatorAction* ) a ) - > widget ( ) , a ) ;
( ( QSeparatorAction* ) a ) - > widget ( ) - > installEventFilter ( this ) ;
}
}
TQApplication : : sendPostedEvents ( ) ;
adjustSize ( ) ;
}
void T QDesignerToolBar: : actionRemoved ( )
void QDesignerToolBar: : actionRemoved ( )
{
actionList . removeRef ( ( TQAction * ) sender ( ) ) ;
}
TQPoint T QDesignerToolBar: : calcIndicatorPos ( const TQPoint & pos )
TQPoint QDesignerToolBar: : calcIndicatorPos ( const TQPoint & pos )
{
if ( orientation ( ) = = Qt : : Horizontal ) {
TQPoint pnt ( width ( ) - 2 , 0 ) ;
@ -632,7 +632,7 @@ TQPoint TQDesignerToolBar::calcIndicatorPos( const TQPoint &pos )
}
}
void T QDesignerToolBar: : drawIndicator ( const TQPoint & pos )
void QDesignerToolBar: : drawIndicator ( const TQPoint & pos )
{
if ( lastIndicatorPos = = pos )
return ;
@ -656,7 +656,7 @@ void TQDesignerToolBar::drawIndicator( const TQPoint &pos )
TQApplication : : sendPostedEvents ( ) ;
}
void T QDesignerToolBar: : doInsertWidget ( const TQPoint & p )
void QDesignerToolBar: : doInsertWidget ( const TQPoint & p )
{
if ( formWindow ! = MainWindow : : self - > formWindow ( ) )
return ;
@ -664,7 +664,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 ) ;
T QDesignerAction * a = new T QDesignerAction( w , tqparent ( ) ) ;
QDesignerAction * a = new QDesignerAction( w , tqparent ( ) ) ;
int index = actionList . tqfindRef ( * actionMap . tqfind ( insertAnchor ) ) ;
if ( index ! = - 1 & & afterAnchor )
+ + index ;
@ -678,16 +678,16 @@ void TQDesignerToolBar::doInsertWidget( const TQPoint &p )
MainWindow : : self - > resetTool ( ) ;
}
void T QDesignerToolBar: : clear ( )
void QDesignerToolBar: : clear ( )
{
for ( TQAction * a = actionList . first ( ) ; a ; a = actionList . next ( ) ) {
if ( a - > inherits ( " T QDesignerAction" ) )
( ( T QDesignerAction* ) a ) - > remove ( ) ;
if ( a - > inherits ( " QDesignerAction" ) )
( ( QDesignerAction* ) a ) - > remove ( ) ;
}
TQToolBar : : clear ( ) ;
}
void T QDesignerToolBar: : installEventFilters ( TQWidget * w )
void QDesignerToolBar: : installEventFilters ( TQWidget * w )
{
if ( ! w )
return ;
@ -699,7 +699,7 @@ void TQDesignerToolBar::installEventFilters( TQWidget *w )
T QDesignerMenuBar: : T QDesignerMenuBar( TQWidget * mw )
QDesignerMenuBar: : QDesignerMenuBar( TQWidget * mw )
: TQMenuBar ( mw , 0 )
{
show ( ) ;
@ -709,12 +709,12 @@ TQDesignerMenuBar::TQDesignerMenuBar( TQWidget *mw )
mousePressed = false ;
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
insertAt = - 1 ;
indicator = new T QDesignerIndicatorWidget( this ) ;
indicator = new QDesignerIndicatorWidget( this ) ;
indicator - > hide ( ) ;
findFormWindow ( ) ;
}
void T QDesignerMenuBar: : findFormWindow ( )
void QDesignerMenuBar: : findFormWindow ( )
{
TQWidget * w = this ;
while ( w ) {
@ -724,7 +724,7 @@ void TQDesignerMenuBar::findFormWindow()
}
}
void T QDesignerMenuBar: : contextMenuEvent ( TQContextMenuEvent * e )
void QDesignerMenuBar: : contextMenuEvent ( TQContextMenuEvent * e )
{
e - > accept ( ) ;
int itm = itemAtPos ( e - > pos ( ) ) ;
@ -742,7 +742,7 @@ void TQDesignerMenuBar::contextMenuEvent( TQContextMenuEvent *e )
RemoveMenuCommand * cmd = new RemoveMenuCommand ( i18n ( " Delete Menu '%1' " ) . tqarg ( item - > text ( ) ) ,
formWindow ,
( TQMainWindow * ) tqparentWidget ( ) , this ,
( T QDesignerPopupMenu* ) item - > popup ( ) ,
( QDesignerPopupMenu* ) item - > popup ( ) ,
idAt ( itm ) , itm , item - > text ( ) ) ;
formWindow - > commandHistory ( ) - > addCommand ( cmd ) ;
cmd - > execute ( ) ;
@ -764,7 +764,7 @@ void TQDesignerMenuBar::contextMenuEvent( TQContextMenuEvent *e )
}
}
void T QDesignerMenuBar: : mousePressEvent ( TQMouseEvent * e )
void QDesignerMenuBar: : mousePressEvent ( TQMouseEvent * e )
{
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
insertAt = - 1 ;
@ -776,7 +776,7 @@ void TQDesignerMenuBar::mousePressEvent( TQMouseEvent *e )
TQMenuBar : : mousePressEvent ( e ) ;
}
void T QDesignerMenuBar: : mouseMoveEvent ( TQMouseEvent * e )
void QDesignerMenuBar: : mouseMoveEvent ( TQMouseEvent * e )
{
if ( ! mousePressed | | e - > state ( ) = = Qt : : NoButton ) {
TQMenuBar : : mouseMoveEvent ( e ) ;
@ -814,7 +814,7 @@ void TQDesignerMenuBar::mouseMoveEvent( TQMouseEvent *e )
mousePressed = false ;
}
void T QDesignerMenuBar: : mouseReleaseEvent ( TQMouseEvent * e )
void QDesignerMenuBar: : mouseReleaseEvent ( TQMouseEvent * e )
{
TQMenuBar : : mouseReleaseEvent ( e ) ;
mousePressed = false ;
@ -822,7 +822,7 @@ void TQDesignerMenuBar::mouseReleaseEvent( TQMouseEvent *e )
# ifndef TQT_NO_DRAGANDDROP
void T QDesignerMenuBar: : dragEnterEvent ( TQDragEnterEvent * e )
void QDesignerMenuBar: : dragEnterEvent ( TQDragEnterEvent * e )
{
if ( e - > provides ( " application/x-designer-actions " ) | |
e - > provides ( " application/x-designer-actiongroup " ) | |
@ -834,7 +834,7 @@ void TQDesignerMenuBar::dragEnterEvent( TQDragEnterEvent *e )
insertAt = - 1 ;
}
void T QDesignerMenuBar: : dragMoveEvent ( TQDragMoveEvent * e )
void QDesignerMenuBar: : dragMoveEvent ( TQDragMoveEvent * e )
{
if ( e - > provides ( " application/x-designer-actions " ) | |
e - > provides ( " application/x-designer-menuitem " ) | |
@ -860,14 +860,14 @@ void TQDesignerMenuBar::dragMoveEvent( TQDragMoveEvent *e )
}
}
void T QDesignerMenuBar: : dragLeaveEvent ( TQDragLeaveEvent * )
void QDesignerMenuBar: : dragLeaveEvent ( TQDragLeaveEvent * )
{
mousePressed = false ;
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
insertAt = - 1 ;
}
void T QDesignerMenuBar: : dropEvent ( TQDropEvent * e )
void QDesignerMenuBar: : dropEvent ( TQDropEvent * e )
{
mousePressed = false ;
if ( ! e - > provides ( " application/x-designer-menuitem " ) )
@ -881,7 +881,7 @@ void TQDesignerMenuBar::dropEvent( TQDropEvent *e )
insertItem ( txt , popup , - 1 , insertAt ) ;
MoveMenuCommand * cmd = new MoveMenuCommand ( i18n ( " Move Menu '%1' " ) . tqarg ( txt ) , formWindow ,
this , ( T QDesignerPopupMenu* ) popup , oldPos , insertAt , txt ) ;
this , ( QDesignerPopupMenu* ) popup , oldPos , insertAt , txt ) ;
// do not execute, we did the work already
formWindow - > commandHistory ( ) - > addCommand ( cmd ) ;
@ -890,7 +890,7 @@ void TQDesignerMenuBar::dropEvent( TQDropEvent *e )
# endif
TQPoint T QDesignerMenuBar: : calcIndicatorPos ( const TQPoint & pos )
TQPoint QDesignerMenuBar: : calcIndicatorPos ( const TQPoint & pos )
{
int w = frameWidth ( ) ;
insertAt = count ( ) ;
@ -906,7 +906,7 @@ TQPoint TQDesignerMenuBar::calcIndicatorPos( const TQPoint &pos )
return TQPoint ( w , 0 ) ;
}
void T QDesignerMenuBar: : drawIndicator ( const TQPoint & pos )
void QDesignerMenuBar: : drawIndicator ( const TQPoint & pos )
{
if ( lastIndicatorPos = = pos )
return ;
@ -920,38 +920,38 @@ void TQDesignerMenuBar::drawIndicator( const TQPoint &pos )
TQApplication : : sendPostedEvents ( ) ;
}
void T QDesignerMenuBar: : setItemNumber ( int num )
void QDesignerMenuBar: : setItemNumber ( int num )
{
itemNum = num ;
}
int T QDesignerMenuBar: : itemNumber ( ) const
int QDesignerMenuBar: : itemNumber ( ) const
{
return itemNum ;
}
void T QDesignerMenuBar: : setItemText ( const TQString & s )
void QDesignerMenuBar: : setItemText ( const TQString & s )
{
if ( itemNum < 0 | | itemNum > = ( int ) count ( ) )
return ;
changeItem ( idAt ( itemNum ) , s ) ;
}
TQString T QDesignerMenuBar: : itemText ( ) const
TQString QDesignerMenuBar: : itemText ( ) const
{
if ( itemNum < 0 | | ( int ) itemNum > = ( int ) count ( ) )
return TQString ( ) ;
return text ( idAt ( itemNum ) ) ;
}
void T QDesignerMenuBar: : setItemName ( const TQCString & s )
void QDesignerMenuBar: : setItemName ( const TQCString & s )
{
if ( itemNum < 0 | | itemNum > = ( int ) count ( ) )
return ;
tqfindItem ( idAt ( itemNum ) ) - > popup ( ) - > setName ( s ) ;
}
TQCString T QDesignerMenuBar: : itemName ( ) const
TQCString QDesignerMenuBar: : itemName ( ) const
{
if ( itemNum < 0 | | itemNum > = ( int ) count ( ) )
return " " ;
@ -960,7 +960,7 @@ TQCString TQDesignerMenuBar::itemName() const
T QDesignerPopupMenu: : T QDesignerPopupMenu( TQWidget * w )
QDesignerPopupMenu: : QDesignerPopupMenu( TQWidget * w )
: TQPopupMenu ( w , 0 ) ,
popupMenu ( 0 )
{
@ -969,11 +969,11 @@ TQDesignerPopupMenu::TQDesignerPopupMenu( TQWidget *w )
insertAt = - 1 ;
mousePressed = false ;
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
indicator = new T QDesignerIndicatorWidget( this ) ;
indicator = new QDesignerIndicatorWidget( this ) ;
indicator - > hide ( ) ;
}
void T QDesignerPopupMenu: : contextMenuEvent ( TQContextMenuEvent * e )
void QDesignerPopupMenu: : contextMenuEvent ( TQContextMenuEvent * e )
{
# if defined( TQ_WS_MAC ) //the mac needs us to use context menu rather than right click
e - > accept ( ) ;
@ -984,7 +984,7 @@ void TQDesignerPopupMenu::contextMenuEvent( TQContextMenuEvent *e )
# endif
}
void T QDesignerPopupMenu: : mousePressEvent ( TQMouseEvent * e )
void QDesignerPopupMenu: : mousePressEvent ( TQMouseEvent * e )
{
if ( e - > button ( ) = = Qt : : MidButton )
return ;
@ -1006,7 +1006,7 @@ void TQDesignerPopupMenu::mousePressEvent( TQMouseEvent *e )
TQPopupMenu : : mousePressEvent ( e ) ;
}
void T QDesignerPopupMenu: : createPopupMenu ( )
void QDesignerPopupMenu: : createPopupMenu ( )
{
// actually creates our popup for the popupmenu.
TQPopupMenu menu ( 0 ) ;
@ -1018,7 +1018,7 @@ void TQDesignerPopupMenu::createPopupMenu()
if ( itm = = - 1 )
return ;
TQAction * a = actionList . at ( itm ) ;
if ( a & & a - > inherits ( " T QSeparatorAction" ) )
if ( a & & a - > inherits ( " QSeparatorAction" ) )
menu . insertItem ( i18n ( " Delete Separator " ) , ID_DELETE ) ;
else
menu . insertItem ( i18n ( " Delete Item " ) , ID_DELETE ) ;
@ -1037,22 +1037,22 @@ void TQDesignerPopupMenu::createPopupMenu()
} else if ( res = = ID_SEP ) {
TQPoint p ( pos ( ) ) ;
calcIndicatorPos ( mapFromGlobal ( popupPos ) ) ;
TQAction * a = new T QSeparatorAction( 0 ) ;
TQAction * a = new QSeparatorAction( 0 ) ;
AddActionToPopupCommand * cmd = new AddActionToPopupCommand (
i18n ( " Add Separator to Popup Menu '%1' " ) .
arg ( name ( ) ) ,
formWindow , a , this , insertAt ) ;
formWindow - > commandHistory ( ) - > addCommand ( cmd ) ;
cmd - > execute ( ) ;
( ( T QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > hidePopups ( ) ;
( ( T QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > activateItemAt ( - 1 ) ;
( ( QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > hidePopups ( ) ;
( ( QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > activateItemAt ( - 1 ) ;
popup ( p ) ;
}
// set this back to zero so we know a popup (will soon) not exist.
popupMenu = 0 ;
}
void T QDesignerPopupMenu: : mouseMoveEvent ( TQMouseEvent * e )
void QDesignerPopupMenu: : mouseMoveEvent ( TQMouseEvent * e )
{
if ( ! mousePressed | | e - > state ( ) = = Qt : : NoButton ) {
TQPopupMenu : : mouseMoveEvent ( e ) ;
@ -1075,7 +1075,7 @@ void TQDesignerPopupMenu::mouseMoveEvent( TQMouseEvent *e )
cmd - > execute ( ) ;
TQString type = a - > inherits ( TQACTIONGROUP_OBJECT_NAME_STRING ) ? TQString ( " application/x-designer-actiongroup " ) :
a - > inherits ( " T QSeparatorAction" ) ? TQString ( " application/x-designer-separator " ) : TQString ( " application/x-designer-actions " ) ;
a - > inherits ( " QSeparatorAction" ) ? TQString ( " application/x-designer-separator " ) : TQString ( " application/x-designer-actions " ) ;
TQStoredDrag * drag = new TQStoredDrag ( type , this ) ;
TQString s = TQString : : number ( ( long ) a ) ; // #### huha, that is evil
drag - > setEncodedData ( TQCString ( s . latin1 ( ) ) ) ;
@ -1092,7 +1092,7 @@ void TQDesignerPopupMenu::mouseMoveEvent( TQMouseEvent *e )
mousePressed = false ;
}
void T QDesignerPopupMenu: : mouseReleaseEvent ( TQMouseEvent * e )
void QDesignerPopupMenu: : mouseReleaseEvent ( TQMouseEvent * e )
{
mousePressed = false ;
TQPopupMenu : : mouseReleaseEvent ( e ) ;
@ -1100,7 +1100,7 @@ void TQDesignerPopupMenu::mouseReleaseEvent( TQMouseEvent *e )
# ifndef TQT_NO_DRAGANDDROP
void T QDesignerPopupMenu: : dragEnterEvent ( TQDragEnterEvent * e )
void QDesignerPopupMenu: : dragEnterEvent ( TQDragEnterEvent * e )
{
mousePressed = false ;
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
@ -1110,7 +1110,7 @@ void TQDesignerPopupMenu::dragEnterEvent( TQDragEnterEvent *e )
e - > accept ( ) ;
}
void T QDesignerPopupMenu: : dragMoveEvent ( TQDragMoveEvent * e )
void QDesignerPopupMenu: : dragMoveEvent ( TQDragMoveEvent * e )
{
mousePressed = false ;
if ( e - > provides ( " application/x-designer-actions " ) | |
@ -1122,14 +1122,14 @@ void TQDesignerPopupMenu::dragMoveEvent( TQDragMoveEvent *e )
drawIndicator ( calcIndicatorPos ( e - > pos ( ) ) ) ;
}
void T QDesignerPopupMenu: : dragLeaveEvent ( TQDragLeaveEvent * )
void QDesignerPopupMenu: : dragLeaveEvent ( TQDragLeaveEvent * )
{
mousePressed = false ;
indicator - > hide ( ) ;
insertAt = - 1 ;
}
void T QDesignerPopupMenu: : dropEvent ( TQDropEvent * e )
void QDesignerPopupMenu: : dropEvent ( TQDropEvent * e )
{
mousePressed = false ;
if ( e - > provides ( " application/x-designer-actions " ) | |
@ -1143,15 +1143,15 @@ void TQDesignerPopupMenu::dropEvent( TQDropEvent *e )
TQAction * a = 0 ;
if ( e - > provides ( " application/x-designer-actiongroup " ) ) {
TQString s ( e - > tqencodedData ( " application/x-designer-actiongroup " ) ) ;
a = ( T QDesignerActionGroup* ) s . toLong ( ) ;
a = ( QDesignerActionGroup* ) s . toLong ( ) ;
} else {
TQString s ;
if ( e - > provides ( " application/x-designer-separator " ) ) {
s = TQString ( e - > tqencodedData ( " application/x-designer-separator " ) ) ;
a = ( T QSeparatorAction* ) s . toLong ( ) ;
a = ( QSeparatorAction* ) s . toLong ( ) ;
} else {
s = TQString ( e - > tqencodedData ( " application/x-designer-actions " ) ) ;
a = ( T QDesignerAction* ) s . toLong ( ) ;
a = ( QDesignerAction* ) s . toLong ( ) ;
}
}
@ -1169,22 +1169,22 @@ void TQDesignerPopupMenu::dropEvent( TQDropEvent *e )
formWindow - > commandHistory ( ) - > addCommand ( cmd ) ;
cmd - > execute ( ) ;
( ( T QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > hidePopups ( ) ;
( ( T QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > activateItemAt ( - 1 ) ;
( ( QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > hidePopups ( ) ;
( ( QDesignerMenuBar* ) ( ( TQMainWindow * ) tqparentWidget ( ) ) - > menuBar ( ) ) - > activateItemAt ( - 1 ) ;
indicator - > hide ( ) ;
popup ( p ) ;
}
# endif
void T QDesignerPopupMenu: : reInsert ( )
void QDesignerPopupMenu: : reInsert ( )
{
clear ( ) ;
for ( TQAction * a = actionList . first ( ) ; a ; a = actionList . next ( ) )
a - > addTo ( this ) ;
}
void T QDesignerPopupMenu: : drawIndicator ( const TQPoint & pos )
void QDesignerPopupMenu: : drawIndicator ( const TQPoint & pos )
{
if ( lastIndicatorPos = = pos )
return ;
@ -1198,7 +1198,7 @@ void TQDesignerPopupMenu::drawIndicator( const TQPoint &pos )
TQApplication : : sendPostedEvents ( ) ;
}
TQPoint T QDesignerPopupMenu: : calcIndicatorPos ( const TQPoint & pos )
TQPoint QDesignerPopupMenu: : calcIndicatorPos ( const TQPoint & pos )
{
int h = frameWidth ( ) ;
insertAt = count ( ) ;
@ -1214,18 +1214,18 @@ TQPoint TQDesignerPopupMenu::calcIndicatorPos( const TQPoint &pos )
return TQPoint ( 0 , h ) ;
}
void T QDesignerPopupMenu: : addAction ( TQAction * a )
void QDesignerPopupMenu: : addAction ( TQAction * a )
{
actionList . append ( a ) ;
connect ( a , TQT_SIGNAL ( destroyed ( ) ) , this , TQT_SLOT ( actionRemoved ( ) ) ) ;
}
void T QDesignerPopupMenu: : actionRemoved ( )
void QDesignerPopupMenu: : actionRemoved ( )
{
actionList . removeRef ( ( TQAction * ) sender ( ) ) ;
}
void T QDesignerPopupMenu: : paintEvent ( TQPaintEvent * e )
void QDesignerPopupMenu: : paintEvent ( TQPaintEvent * e )
{
TQPopupMenu : : paintEvent ( e ) ;
if ( e - > rect ( ) ! = rect ( ) )
@ -1233,7 +1233,7 @@ void TQDesignerPopupMenu::paintEvent( TQPaintEvent *e )
lastIndicatorPos = TQPoint ( - 1 , - 1 ) ;
}
void T QDesignerPopupMenu: : findFormWindow ( )
void QDesignerPopupMenu: : findFormWindow ( )
{
TQWidget * w = this ;
while ( w ) {