diff options
Diffstat (limited to 'src/widgets/tqpopupmenu.cpp')
| -rw-r--r-- | src/widgets/tqpopupmenu.cpp | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/src/widgets/tqpopupmenu.cpp b/src/widgets/tqpopupmenu.cpp index c52c00005..66da3a26a 100644 --- a/src/widgets/tqpopupmenu.cpp +++ b/src/widgets/tqpopupmenu.cpp @@ -101,7 +101,7 @@ static int motion; // used to provide ONE single-shot timer static TQTimer * singleSingleShot = 0; -static bool supressAboutToShow = FALSE; +static bool supressAboutToShow = false; static void cleanup() { @@ -118,10 +118,10 @@ static void popupSubMenuLater( int msec, TQPopupMenu * receiver ) { singleSingleShot->disconnect( TQ_SIGNAL(timeout()) ); TQObject::connect( singleSingleShot, TQ_SIGNAL(timeout()), receiver, TQ_SLOT(subMenuTimer()) ); - singleSingleShot->start( msec, TRUE ); + singleSingleShot->start( msec, true ); } -static bool preventAnimation = FALSE; +static bool preventAnimation = false; #ifndef TQT_NO_WHATSTHIS extern void tqWhatsThisBDH(); @@ -170,7 +170,7 @@ static TQMenuItem* whatsThisItem = 0; removeItem() or removeItemAt(). A popup menu can display check marks for certain items when - enabled with setCheckable(TRUE). You check or uncheck items with + enabled with setCheckable(true). You check or uncheck items with setItemChecked(). Items are either enabled or disabled. You toggle their state with @@ -280,13 +280,13 @@ TQPopupMenu::TQPopupMenu( TQWidget *parent, const char *name ) d->scroll.scrollable = TQPopupMenuPrivate::Scroll::ScrollNone; d->scroll.scrolltimer = 0; d->hasmouse = 0; - isPopupMenu = TRUE; + isPopupMenu = true; #ifndef TQT_NO_ACCEL autoaccel = 0; - accelDisabled = FALSE; + accelDisabled = false; #endif popupActive = -1; - snapToMouse = TRUE; + snapToMouse = true; tab = 0; checkable = 0; tornOff = 0; @@ -329,7 +329,7 @@ TQPopupMenu::~TQPopupMenu() delete (TQWidget*) TQMenuData::d->aWidget; // tear-off menu - preventAnimation = FALSE; + preventAnimation = false; delete d; } @@ -347,7 +347,7 @@ void TQPopupMenu::setCheckable( bool enable ) { if ( isCheckable() != enable ) { checkable = enable; - badSize = TRUE; + badSize = true; if ( TQMenuData::d->aWidget ) ( (TQPopupMenu*)(TQWidget*)TQMenuData::d->aWidget)->setCheckable( enable ); } @@ -357,7 +357,7 @@ void TQPopupMenu::setCheckable( bool enable ) \property TQPopupMenu::checkable \brief whether the display of check marks on menu items is enabled - When TRUE, the display of check marks on menu items is enabled. + When true, the display of check marks on menu items is enabled. Checking is always enabled when in Windows-style. \sa TQMenuData::setItemChecked() @@ -372,7 +372,7 @@ void TQPopupMenu::menuContentsChanged() { // here the part that can't be delayed TQMenuData::menuContentsChanged(); - badSize = TRUE; // might change the size + badSize = true; // might change the size #if defined(TQ_WS_MAC) && !defined(TQMAC_QMENUBAR_NO_NATIVE) mac_dirty_popup = 1; #endif @@ -396,12 +396,12 @@ void TQPopupMenu::performDelayedContentsChanged() if ( isVisible() ) { if ( tornOff ) return; - updateSize(TRUE); + updateSize(true); update(); } TQPopupMenu* p = (TQPopupMenu*)(TQWidget*)TQMenuData::d->aWidget; if ( p && p->isVisible() ) { - p->updateSize(TRUE); + p->updateSize(true); p->update(); } #if defined(TQ_WS_MAC) && !defined(TQMAC_QMENUBAR_NO_NATIVE) @@ -514,7 +514,7 @@ void TQPopupMenu::popup( const TQPoint &pos, int indexAtPoint ) if(d->scroll.scrollable) { d->scroll.scrollable = TQPopupMenuPrivate::Scroll::ScrollNone; d->scroll.topScrollableIndex = d->scroll.scrollableSize = 0; - badSize = TRUE; + badSize = true; } updateSize(); @@ -524,10 +524,10 @@ void TQPopupMenu::popup( const TQPoint &pos, int indexAtPoint ) // have to emit here as a menu might be setup in a slot connected // to aboutToShow which will change the size of the menu bool s = supressAboutToShow; - supressAboutToShow = TRUE; + supressAboutToShow = true; if ( !s) { emit aboutToShow(); - updateSize(TRUE); + updateSize(true); } int sw = screen.width(); // screen width @@ -610,7 +610,7 @@ void TQPopupMenu::popup( const TQPoint &pos, int indexAtPoint ) d->scroll.scrollableSize = ch; } - updateSize(TRUE); //now set the size using the scrollable/scrollableSize as above + updateSize(true); //now set the size using the scrollable/scrollableSize as above w = width(); h = height(); if(indexAtPoint >= 0) { @@ -655,7 +655,7 @@ void TQPopupMenu::popup( const TQPoint &pos, int indexAtPoint ) #endif if ( TQApplication::isEffectEnabled( UI_AnimateMenu ) && - preventAnimation == FALSE ) { + preventAnimation == false ) { if ( TQApplication::isEffectEnabled( UI_FadeMenu ) ) qFadeEffect( this ); else if ( parentMenu ) @@ -715,7 +715,7 @@ void TQPopupMenu::subHighlighted( int id ) emit highlightedRedirect( id ); } -static bool fromAccel = FALSE; +static bool fromAccel = false; #ifndef TQT_NO_ACCEL void TQPopupMenu::accelActivated( int id ) @@ -723,9 +723,9 @@ void TQPopupMenu::accelActivated( int id ) TQMenuItem *mi = findItem( id ); if ( mi && mi->isEnabledAndVisible() ) { TQGuardedPtr<TQSignal> signal = mi->signal(); - fromAccel = TRUE; + fromAccel = true; actSig( mi->id() ); - fromAccel = FALSE; + fromAccel = false; if ( signal ) signal->activate(); } @@ -804,7 +804,7 @@ void TQPopupMenu::hideAllPopups() TQMenuData *top = this; // find top level popup if ( !preventAnimation ) TQTimer::singleShot( 10, this, TQ_SLOT(allowAnimation()) ); - preventAnimation = TRUE; + preventAnimation = true; if ( !isPopup() ) return; // nothing to do @@ -832,7 +832,7 @@ void TQPopupMenu::hidePopups() { if ( !preventAnimation ) TQTimer::singleShot( 10, this, TQ_SLOT(allowAnimation()) ); - preventAnimation = TRUE; + preventAnimation = true; TQMenuItemListIt it(*mitems); TQMenuItem *mi; @@ -846,7 +846,7 @@ void TQPopupMenu::hidePopups() d->mouseMoveBuffer = TQRegion(); TQRect mfrect = itemGeometry( actItem ); - setMicroFocusHint( mfrect.x(), mfrect.y(), mfrect.width(), mfrect.height(), FALSE ); + setMicroFocusHint( mfrect.x(), mfrect.y(), mfrect.width(), mfrect.height(), false ); } @@ -876,13 +876,13 @@ bool TQPopupMenu::tryMenuBar( TQMouseEvent *e ) bool TQPopupMenu::tryMouseEvent( TQPopupMenu *p, TQMouseEvent * e) { if ( p == this ) - return FALSE; + return false; TQPoint pos = mapFromGlobal( e->globalPos() ); if ( !rect().contains( pos ) ) // outside - return FALSE; + return false; TQMouseEvent ee( e->type(), pos, e->globalPos(), e->button(), e->state() ); event( &ee ); - return TRUE; + return true; } /*! @@ -1040,7 +1040,7 @@ TQSize TQPopupMenu::updateSize(bool force_update, bool do_resize) TQSize ret = TQSize( 50, 8 ); if(do_resize) setFixedSize( ret ); - badSize = TRUE; + badSize = true; return ret; } @@ -1069,7 +1069,7 @@ TQSize TQPopupMenu::updateSize(bool force_update, bool do_resize) TQWidget *miw = mi->widget(); if (miw) { if ( miw->parentWidget() != this ) - miw->reparent( this, TQPoint(0,0), TRUE ); + miw->reparent( this, TQPoint(0,0), true ); // widget items musn't propgate mouse events ((TQPopupMenu*)miw)->setWFlags(WNoMousePropagation); } @@ -1170,7 +1170,7 @@ TQSize TQPopupMenu::updateSize(bool force_update, bool do_resize) if(style().styleHint(TQStyle::SH_PopupMenu_Scrollable, this)) { height += scrheight; - setMouseTracking(TRUE); + setMouseTracking(true); } if ( tab ) @@ -1190,7 +1190,7 @@ TQSize TQPopupMenu::updateSize(bool force_update, bool do_resize) else d->calcSize = TQSize( TQMAX( minimumWidth(), (ncols*(max_width + tab)) + extra_width ), TQMAX( minimumHeight(), TQMIN( max_height + extra_height + 1, dh ) ) ); - badSize = FALSE; + badSize = false; } { @@ -1277,7 +1277,7 @@ void TQPopupMenu::updateAccel( TQWidget *parent ) connect( autoaccel, TQ_SIGNAL(destroyed()), TQ_SLOT(accelDestroyed()) ); if ( accelDisabled ) - autoaccel->setEnabled( FALSE ); + autoaccel->setEnabled( false ); } while ( (mi=it.current()) ) { ++it; @@ -1307,7 +1307,7 @@ void TQPopupMenu::updateAccel( TQWidget *parent ) } if ( s != mi->text() ) { mi->setText( s ); - badSize = TRUE; + badSize = true; } } if ( mi->popup() && parent ) { // call recursively @@ -1348,7 +1348,7 @@ void TQPopupMenu::enableAccel( bool enable ) void TQPopupMenu::setFont( const TQFont &font ) { TQWidget::setFont( font ); - badSize = TRUE; + badSize = true; if ( isVisible() ) { updateSize(); update(); @@ -1364,16 +1364,16 @@ void TQPopupMenu::show() hide(); if ( isVisible() ) { - supressAboutToShow = FALSE; + supressAboutToShow = false; TQWidget::show(); return; } if (!supressAboutToShow) emit aboutToShow(); else - supressAboutToShow = FALSE; + supressAboutToShow = false; performDelayedChanges(); - updateSize(TRUE); + updateSize(true); TQWidget::show(); updateSize(); popupActive = -1; @@ -1402,7 +1402,7 @@ void TQPopupMenu::hide() actItem = popupActive = -1; if(style().styleHint(TQStyle::SH_PopupMenu_SubMenuPopupDelay, this)) d->mouseMoveBuffer = TQRegion(); - mouseBtDn = FALSE; // mouse button up + mouseBtDn = false; // mouse button up #if defined(QT_ACCESSIBILITY_SUPPORT) TQAccessible::updateAccessibility( this, 0, TQAccessible::PopupMenuEnd ); #endif @@ -1460,8 +1460,8 @@ int TQPopupMenu::itemHeight( TQMenuItem *mi ) const /*! Draws menu item \a mi in the area \a x, \a y, \a w, \a h, using - painter \a p. The item is drawn active if \a act is TRUE or drawn - inactive if \a act is FALSE. The rightmost \a tab_ pixels are used + painter \a p. The item is drawn active if \a act is true or drawn + inactive if \a act is false. The rightmost \a tab_ pixels are used for accelerator text. \sa TQStyle::drawControl() @@ -1627,7 +1627,7 @@ void TQPopupMenu::mousePressEvent( TQMouseEvent *e ) e->pos().y() >= contentsRect().height() - sh))) //down return; - mouseBtDn = TRUE; // mouse button down + mouseBtDn = true; // mouse button down int item = itemAtPos( e->pos() ); if ( item == -1 ) { if ( !rect().contains(e->pos()) && !tryMenuBar(e) ) { @@ -1666,7 +1666,7 @@ void TQPopupMenu::mouseReleaseEvent( TQMouseEvent *e ) if ( !parentMenu && !mouseBtDn && actItem < 0 && motion < 6 ) return; - mouseBtDn = FALSE; + mouseBtDn = false; // if the user released the mouse outside the menu, pass control // to the menubar or our parent menu @@ -1688,7 +1688,7 @@ void TQPopupMenu::mouseReleaseEvent( TQMouseEvent *e ) } else { // selected menu item! TQMenuItem *mi = mitems->at(actItem); if ( mi ->widget() ) { - TQWidget* widgetAt = TQApplication::widgetAt( e->globalPos(), TRUE ); + TQWidget* widgetAt = TQApplication::widgetAt( e->globalPos(), true ); if ( widgetAt && widgetAt != this ) { TQMouseEvent me( e->type(), widgetAt->mapFromGlobal( e->globalPos() ), e->globalPos(), e->button(), e->state() ); @@ -1699,7 +1699,7 @@ void TQPopupMenu::mouseReleaseEvent( TQMouseEvent *e ) #ifndef TQT_NO_WHATSTHIS bool b = TQWhatsThis::inWhatsThisMode(); #else - const bool b = FALSE; + const bool b = false; #endif if ( !mi->isEnabledAndVisible() ) { #ifndef TQT_NO_WHATSTHIS @@ -1797,12 +1797,12 @@ void TQPopupMenu::mouseMoveEvent( TQMouseEvent *e ) // but did not register mouse press d->hasmouse = 1; if ( (e->state() & TQt::MouseButtonMask) && !mouseBtDn ) - mouseBtDn = TRUE; // so mouseReleaseEvent will pop down + mouseBtDn = true; // so mouseReleaseEvent will pop down TQMenuItem *mi = mitems->at( item ); if ( mi->widget() ) { - TQWidget* widgetAt = TQApplication::widgetAt( e->globalPos(), TRUE ); + TQWidget* widgetAt = TQApplication::widgetAt( e->globalPos(), true ); if ( widgetAt && widgetAt != this ) { TQMouseEvent me( e->type(), widgetAt->mapFromGlobal( e->globalPos() ), e->globalPos(), e->button(), e->state() ); @@ -1864,7 +1864,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) TQMenuItem *mi = 0; TQPopupMenu *popup; int dy = 0; - bool ok_key = TRUE; + bool ok_key = true; int key = e->key(); if ( TQApplication::reverseLayout() ) { @@ -1904,7 +1904,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) hide(); #ifndef TQT_NO_MENUBAR if ( p && p->isMenuBar ) - ((TQMenuBar*) p)->goodbye( TRUE ); + ((TQMenuBar*) p)->goodbye( true ); #endif } break; @@ -1925,7 +1925,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) break; } - ok_key = FALSE; + ok_key = false; break; case Key_Right: @@ -1950,7 +1950,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) break; } } - ok_key = FALSE; + ok_key = false; break; case Key_Space: @@ -1966,7 +1966,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) #ifndef TQT_NO_WHATSTHIS bool b = TQWhatsThis::inWhatsThisMode(); #else - const bool b = FALSE; + const bool b = false; #endif mi = mitems->at( actItem ); if ( !mi->isEnabled() && !b ) @@ -2005,7 +2005,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) //fall-through! #endif default: - ok_key = FALSE; + ok_key = false; } if ( !ok_key && @@ -2029,7 +2029,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) int i = s.find( '&' ); while ( i >= 0 && i < (int)s.length() - 1 ) { if ( s[i+1].upper() == c ) { - ok_key = TRUE; + ok_key = true; clashCount++; if ( !first ) first = m; @@ -2063,7 +2063,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) #ifndef TQT_NO_WHATSTHIS bool b = TQWhatsThis::inWhatsThisMode(); #else - const bool b = FALSE; + const bool b = false; #endif if ( mi->isEnabledAndVisible() || b ) { active_popup_menu = this; @@ -2092,7 +2092,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) int beforeId = top->actItem; ((TQMenuBar*)top)->tryKeyEvent( this, e ); if ( beforeId != top->actItem ) - ok_key = TRUE; + ok_key = true; } } #endif @@ -2149,11 +2149,11 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) if(d->scroll.scrollable) { //need to scroll to make it visible? TQRect r = itemGeometry(actItem); if(r.isNull() || r.height() < itemHeight(mitems->at(actItem))) { - bool refresh = FALSE; + bool refresh = false; if(d->scroll.scrollable & TQPopupMenuPrivate::Scroll::ScrollUp && dy == -1) { //up if(d->scroll.topScrollableIndex >= 0) { d->scroll.topScrollableIndex--; - refresh = TRUE; + refresh = true; } } else if(d->scroll.scrollable & TQPopupMenuPrivate::Scroll::ScrollDown) { //down TQMenuItemListIt it(*mitems); @@ -2168,7 +2168,7 @@ void TQPopupMenu::keyPressEvent( TQKeyEvent *e ) if(y > (contentsRect().height()-sh)) { if(sz.height() > sh || !it.atLast()) d->scroll.topScrollableIndex++; - refresh = TRUE; + refresh = true; break; } } @@ -2221,7 +2221,7 @@ void TQPopupMenu::styleChange( TQStyle& old ) TQFrame::styleChange( old ); setMouseTracking(style().styleHint(TQStyle::SH_PopupMenu_MouseTracking, this)); style().polishPopupMenu( this ); - updateSize(TRUE); + updateSize(true); } /*!\reimp @@ -2329,7 +2329,7 @@ void TQPopupMenu::subMenuTimer() { popup->parentMenu = this; // set parent menu emit popup->aboutToShow(); - supressAboutToShow = TRUE; + supressAboutToShow = true; TQRect r( itemGeometry( actItem ) ); @@ -2349,26 +2349,26 @@ void TQPopupMenu::subMenuTimer() { p = TQPoint( r.left() + arrowHMargin - ps.width(), r.top() + arrowVMargin ); p = mapToGlobal( p ); - bool right = FALSE; + bool right = false; if ( ( parentMenu && parentMenu->isPopupMenu && ((TQPopupMenu*)parentMenu)->geometry().x() < geometry().x() ) || p.x() < screenRect( p ).left()) - right = TRUE; + right = true; if ( right && (ps.width() > screenRect( p ).right() - mapToGlobal( r.topRight() ).x() ) ) - right = FALSE; + right = false; if ( right ) p.setX( mapToGlobal( r.topRight() ).x() ); } else { p = TQPoint( r.right() - arrowHMargin, r.top() + arrowVMargin ); p = mapToGlobal( p ); - bool left = FALSE; + bool left = false; if ( ( parentMenu && parentMenu->isPopupMenu && ((TQPopupMenu*)parentMenu)->geometry().x() > geometry().x() ) || p.x() + ps.width() > screenRect( p ).right() ) - left = TRUE; + left = true; if ( left && (ps.width() > mapToGlobal( r.topLeft() ).x() ) ) - left = FALSE; + left = false; if ( left ) p.setX( mapToGlobal( r.topLeft() ).x() - ps.width() ); } @@ -2404,7 +2404,7 @@ void TQPopupMenu::subMenuTimer() { void TQPopupMenu::allowAnimation() { - preventAnimation = FALSE; + preventAnimation = false; } void TQPopupMenu::updateRow( int row ) @@ -2464,7 +2464,7 @@ void TQPopupMenu::updateRow( int row ) int TQPopupMenu::exec( const TQPoint & pos, int indexAtPoint ) { - snapToMouse = TRUE; + snapToMouse = true; if ( !tqApp ) return -1; @@ -2474,10 +2474,10 @@ int TQPopupMenu::exec( const TQPoint & pos, int indexAtPoint ) syncMenuId = -1; TQGuardedPtr<TQPopupMenu> that = this; - connectModal( that, TRUE ); + connectModal( that, true ); popup( pos, indexAtPoint ); tqApp->enter_loop(); - connectModal( that, FALSE ); + connectModal( that, false ); syncMenu = priorSyncMenu; return syncMenuId; @@ -2564,7 +2564,7 @@ void TQPopupMenu::setActiveItem( int i ) } else { setFocus(); TQRect mfrect = itemGeometry( actItem ); - setMicroFocusHint( mfrect.x(), mfrect.y(), mfrect.width(), mfrect.height(), FALSE ); + setMicroFocusHint( mfrect.x(), mfrect.y(), mfrect.width(), mfrect.height(), false ); } if ( mi->id() != -1 ) hilitSig( mi->id() ); @@ -2585,7 +2585,7 @@ TQSize TQPopupMenu::sizeHint() const constPolish(); TQPopupMenu* that = (TQPopupMenu*) this; //We do not need a resize here, just the sizeHint.. - return that->updateSize(FALSE).expandedTo( TQApplication::globalStrut() ); + return that->updateSize(false).expandedTo( TQApplication::globalStrut() ); } @@ -2616,7 +2616,7 @@ int TQPopupMenu::idAt( const TQPoint& pos ) const */ bool TQPopupMenu::customWhatsThis() const { - return TRUE; + return true; } @@ -2649,7 +2649,7 @@ bool TQPopupMenu::focusNextPrevChild( bool next ) if ( i != actItem ) setActiveItem( i ); } - return TRUE; + return true; } @@ -2687,7 +2687,7 @@ public: } bool fullSpan() const { - return TRUE; + return true; } TQSize sizeHint() @@ -2743,9 +2743,9 @@ void TQPopupMenu::toggleTearOff() p->setCheckable( isCheckable() ); p->reparent( parentWidget(), WType_TopLevel | WStyle_Tool | WNoAutoErase | WDestructiveClose, - geometry().topLeft(), FALSE ); - p->mitems->setAutoDelete( FALSE ); - p->tornOff = TRUE; + geometry().topLeft(), false ); + p->mitems->setAutoDelete( false ); + p->tornOff = true; #ifdef TQ_WS_X11 p->x11SetWindowType( X11WindowTypeMenu ); #endif @@ -2786,7 +2786,7 @@ void TQPopupMenu::activateItemAt( int index ) #ifndef TQT_NO_WHATSTHIS bool b = TQWhatsThis::inWhatsThisMode(); #else - const bool b = FALSE; + const bool b = false; #endif if ( !mi->isEnabledAndVisible() ) { #ifndef TQT_NO_WHATSTHIS @@ -2819,7 +2819,7 @@ void TQPopupMenu::activateItemAt( int index ) hide(); #ifndef TQT_NO_MENUBAR if ( p && p->isMenuBar ) - ((TQMenuBar*) p)->goodbye( TRUE ); + ((TQMenuBar*) p)->goodbye( true ); #endif } } |
