diff options
Diffstat (limited to 'src/widgets/tqscrollview.cpp')
| -rw-r--r-- | src/widgets/tqscrollview.cpp | 160 |
1 files changed, 80 insertions, 80 deletions
diff --git a/src/widgets/tqscrollview.cpp b/src/widgets/tqscrollview.cpp index 40a5bb509..ec062eece 100644 --- a/src/widgets/tqscrollview.cpp +++ b/src/widgets/tqscrollview.cpp @@ -130,10 +130,10 @@ public: vx( 0 ), vy( 0 ), vwidth( 1 ), vheight( 1 ), #ifndef TQT_NO_DRAGANDDROP autoscroll_timer( parent, "scrollview autoscroll timer" ), - drag_autoscroll( TRUE ), + drag_autoscroll( true ), #endif scrollbar_timer( parent, "scrollview scrollbar timer" ), - inresize( FALSE ), use_cached_size_hint( TRUE ) + inresize( false ), use_cached_size_hint( true ) { l_marg = r_marg = t_marg = b_marg = 0; viewport->polish(); @@ -147,11 +147,11 @@ public: vbar->setSteps( 20, 1/*set later*/ ); hbar->setSteps( 20, 1/*set later*/ ); policy = TQScrollView::Default; - signal_choke = FALSE; - static_bg = FALSE; - fake_scroll = FALSE; - hbarPressed = FALSE; - vbarPressed = FALSE; + signal_choke = false; + static_bg = false; + fake_scroll = false; + hbarPressed = false; + vbarPressed = false; } ~TQScrollViewData(); @@ -171,7 +171,7 @@ public: delete r; } - void hideOrShowAll(TQScrollView* sv, bool isScroll = FALSE ); + void hideOrShowAll(TQScrollView* sv, bool isScroll = false ); void moveAllBy(int dx, int dy); bool anyVisibleChildren(); void autoMove(TQScrollView* sv); @@ -225,7 +225,7 @@ public: inline TQScrollViewData::~TQScrollViewData() { - children.setAutoDelete( TRUE ); + children.setAutoDelete( true ); } TQSVChildRec* TQScrollViewData::ancestorRec(TQWidget* w) @@ -256,7 +256,7 @@ void TQScrollViewData::hideOrShowAll(TQScrollView* sv, bool isScroll ) viewport->height() ) { // clipped_viewport still covers viewport if( static_bg ) - clipped_viewport->repaint( TRUE ); + clipped_viewport->repaint( true ); else if ( ( !isScroll && !clipped_viewport->testWFlags( TQt::WStaticContents) ) || static_bg ) TQApplication::postEvent( clipped_viewport, @@ -284,16 +284,16 @@ void TQScrollViewData::moveAllBy(int dx, int dy) r->child->move(r->child->x()+dx,r->child->y()+dy); } if ( static_bg ) - viewport->repaint( TRUE ); + viewport->repaint( true ); } } bool TQScrollViewData::anyVisibleChildren() { for (TQSVChildRec *r = children.first(); r; r=children.next()) { - if (r->child->isVisible()) return TRUE; + if (r->child->isVisible()) return true; } - return FALSE; + return false; } void TQScrollViewData::autoMove(TQScrollView* sv) @@ -441,11 +441,11 @@ void TQScrollViewData::viewportResized( int w, int h ) potentially larger than 4000 pixels in either dimension. In this usage you call resizeContents() to set the size of the area and reimplement drawContents() to paint the contents. You then call - enableClipper(TRUE) and add widgets, again by making them children + enableClipper(true) and add widgets, again by making them children of the viewport(), and adding them with addChild(): \code TQScrollView* sv = new TQScrollView(...); - sv->enableClipper(TRUE); + sv->enableClipper(true); TQLabel* child1 = new TQLabel("CHILD", sv->viewport()); sv->addChild(child1); TQLabel* child2 = new TQLabel("CHILD", sv->viewport()); @@ -469,9 +469,9 @@ void TQScrollViewData::viewportResized( int w, int h ) Note that the widget you see in the scrolled area is the viewport() widget, not the TQScrollView itself. So to turn mouse - tracking on, for example, use viewport()->setMouseTracking(TRUE). + tracking on, for example, use viewport()->setMouseTracking(true). - To enable drag-and-drop, you would setAcceptDrops(TRUE) on the + To enable drag-and-drop, you would setAcceptDrops(true) on the TQScrollView (because drag-and-drop events propagate to the parent). But to work out the logical position in the view, you would need to map the drop co-ordinate from being relative to the @@ -658,18 +658,18 @@ TQScrollView::~TQScrollView() */ void TQScrollView::hbarIsPressed() { - d->hbarPressed = TRUE; + d->hbarPressed = true; emit( horizontalSliderPressed() ); } void TQScrollView::hbarIsReleased() { - d->hbarPressed = FALSE; + d->hbarPressed = false; emit( horizontalSliderReleased() ); } /*! - Returns TRUE if horizontal slider is pressed by user; otherwise returns FALSE. + Returns true if horizontal slider is pressed by user; otherwise returns false. */ bool TQScrollView::isHorizontalSliderPressed() { @@ -678,18 +678,18 @@ bool TQScrollView::isHorizontalSliderPressed() void TQScrollView::vbarIsPressed() { - d->vbarPressed = TRUE; + d->vbarPressed = true; emit( verticalSliderPressed() ); } void TQScrollView::vbarIsReleased() { - d->vbarPressed = FALSE; + d->vbarPressed = false; emit( verticalSliderReleased() ); } /*! - Returns TRUE if vertical slider is pressed by user; otherwise returns FALSE. + Returns true if vertical slider is pressed by user; otherwise returns false. */ bool TQScrollView::isVerticalSliderPressed() { @@ -804,27 +804,27 @@ TQSize TQScrollView::viewportSize( int x, int y ) const // Do we intend to show the scrollbar? if (d->hMode == AlwaysOn) - showh = TRUE; + showh = true; else if (d->hMode == AlwaysOff) - showh = FALSE; + showh = false; else showh = needh; if (d->vMode == AlwaysOn) - showv = TRUE; + showv = true; else if (d->vMode == AlwaysOff) - showv = FALSE; + showv = false; else showv = needv; // Given other scrollbar will be shown, NOW do we need one? if ( showh && h-vsbExt-tmarg-bmarg < y ) { if (d->vMode == Auto) - showv=TRUE; + showv=true; } if ( showv && w-hsbExt-lmarg-rmarg < x ) { if (d->hMode == Auto) - showh=TRUE; + showh=true; } } else { // Scrollbars not needed, only show scrollbar that are always on. @@ -863,7 +863,7 @@ void TQScrollView::updateScrollBars() bool needv; bool showh; bool showv; - bool showc = FALSE; + bool showc = false; int hsbExt = horizontalScrollBar()->sizeHint().height(); int vsbExt = verticalScrollBar()->sizeHint().width(); @@ -879,29 +879,29 @@ void TQScrollView::updateScrollBars() // Do we intend to show the scrollbar? if (d->hMode == AlwaysOn) - showh = TRUE; + showh = true; else if (d->hMode == AlwaysOff) - showh = FALSE; + showh = false; else showh = needh; if (d->vMode == AlwaysOn) - showv = TRUE; + showv = true; else if (d->vMode == AlwaysOff) - showv = FALSE; + showv = false; else showv = needv; #ifdef TQ_WS_MAC - bool mac_need_scroll = FALSE; + bool mac_need_scroll = false; if(!parentWidget()) { - mac_need_scroll = TRUE; + mac_need_scroll = true; } else { TQWidget *tlw = topLevelWidget(); TQPoint tlw_br = TQPoint(tlw->width(), tlw->height()), my_br = posInWindow(this) + TQPoint(w, h); if(my_br.x() >= tlw_br.x() - 3 && my_br.y() >= tlw_br.y() - 3) - mac_need_scroll = TRUE; + mac_need_scroll = true; } if(mac_need_scroll) { WindowAttributes attr; @@ -909,34 +909,34 @@ void TQScrollView::updateScrollBars() mac_need_scroll = (attr & kWindowResizableAttribute); } if(mac_need_scroll) { - showc = TRUE; + showc = true; if(d->vMode == Auto) - showv = TRUE; + showv = true; if(d->hMode == Auto) - showh = TRUE; + showh = true; } #endif // Given other scrollbar will be shown, NOW do we need one? if ( showh && h-vsbExt-tmarg-bmarg < contentsHeight() ) { - needv=TRUE; + needv=true; if (d->vMode == Auto) - showv=TRUE; + showv=true; } if ( showv && !d->inresize && w-hsbExt-lmarg-rmarg < d->contentsWidth() ) { - needh=TRUE; + needh=true; if (d->hMode == Auto) - showh=TRUE; + showh=true; } } else { // Scrollbars not needed, only show scrollbar that are always on. - needh = needv = FALSE; + needh = needv = false; showh = d->hMode == AlwaysOn; showv = d->vMode == AlwaysOn; } bool sc = d->signal_choke; - d->signal_choke=TRUE; + d->signal_choke=true; // Hide unneeded scrollbar, calculate viewport size if ( showh ) { @@ -1075,10 +1075,10 @@ void TQScrollView::updateScrollBars() if ( showv && ( d->vbar->isHidden() || !d->vbar->isVisible() ) ) d->vbar->show(); - d->signal_choke=TRUE; + d->signal_choke=true; d->vbar->setValue( d->contentsY() ); d->hbar->setValue( d->contentsX() ); - d->signal_choke=FALSE; + d->signal_choke=false; TQSize newVisibleSize( visibleWidth(), visibleHeight() ); if ( d->clipped_viewport && oldVisibleSize != newVisibleSize ) { @@ -1125,17 +1125,17 @@ void TQScrollView::resizeEvent( TQResizeEvent* event ) #if 0 if ( TQApplication::reverseLayout() ) { - d->fake_scroll = TRUE; + d->fake_scroll = true; scrollBy( -event->size().width() + event->oldSize().width(), 0 ); - d->fake_scroll = FALSE; + d->fake_scroll = false; } #endif bool inresize = d->inresize; - d->inresize = TRUE; + d->inresize = true; updateScrollBars(); d->inresize = inresize; - d->scrollbar_timer.start( 0, TRUE ); + d->scrollbar_timer.start( 0, true ); d->hideOrShowAll(this); } @@ -1320,7 +1320,7 @@ void TQScrollView::setCornerWidget(TQWidget* corner) if ( corner && corner->parentWidget() != this ) { // #### No clean way to get current WFlags corner->reparent( this, (((TQScrollView*)corner))->getWFlags(), - TQPoint(0,0), FALSE ); + TQPoint(0,0), false ); } updateScrollBars(); @@ -1381,7 +1381,7 @@ void TQScrollView::removeChild(TQObject* child) (\a x, \a y). The position defaults to (0, 0). If the child is already in the view, it is just moved. - You may want to call enableClipper(TRUE) if you add a large number + You may want to call enableClipper(true) if you add a large number of widgets. */ void TQScrollView::addChild(TQWidget* child, int x, int y) @@ -1417,7 +1417,7 @@ void TQScrollView::addChild(TQWidget* child, int x, int y) setResizePolicy( Manual ); } if ( child->parentWidget() != viewport() ) { - child->reparent( viewport(), 0, TQPoint(0,0), FALSE ); + child->reparent( viewport(), 0, TQPoint(0,0), false ); } d->addChildRec(child,x,y)->hideOrShow(this, d->clipped_viewport); @@ -1463,7 +1463,7 @@ int TQScrollView::childY(TQWidget* child) /*! \fn bool TQScrollView::childIsVisible(TQWidget*) \obsolete - Returns TRUE if \a child is visible. This is equivalent + Returns true if \a child is visible. This is equivalent to child->isVisible(). */ @@ -1484,7 +1484,7 @@ int TQScrollView::childY(TQWidget* child) bool TQScrollView::eventFilter( TQObject *obj, TQEvent *e ) { if ( !d ) - return FALSE; // we are destructing + return false; // we are destructing if ( obj == d->viewport || obj == d->clipped_viewport ) { switch ( e->type() ) { /* Forward many events to viewport...() functions */ @@ -1498,22 +1498,22 @@ bool TQScrollView::eventFilter( TQObject *obj, TQEvent *e ) case TQEvent::MouseButtonPress: viewportMousePressEvent( (TQMouseEvent*)e ); if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; + return true; break; case TQEvent::MouseButtonRelease: viewportMouseReleaseEvent( (TQMouseEvent*)e ); if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; + return true; break; case TQEvent::MouseButtonDblClick: viewportMouseDoubleClickEvent( (TQMouseEvent*)e ); if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; + return true; break; case TQEvent::MouseMove: viewportMouseMoveEvent( (TQMouseEvent*)e ); if ( ((TQMouseEvent*)e)->isAccepted() ) - return TRUE; + return true; break; #ifndef TQT_NO_DRAGANDDROP case TQEvent::DragEnter: @@ -1545,7 +1545,7 @@ bool TQScrollView::eventFilter( TQObject *obj, TQEvent *e ) case TQEvent::ContextMenu: viewportContextMenuEvent( (TQContextMenuEvent*)e ); if ( ((TQContextMenuEvent*)e)->isAccepted() ) - return TRUE; + return true; break; case TQEvent::ChildRemoved: removeChild((TQWidget*)((TQChildEvent*)e)->child()); @@ -1555,7 +1555,7 @@ bool TQScrollView::eventFilter( TQObject *obj, TQEvent *e ) break; case TQEvent::WindowActivate: case TQEvent::WindowDeactivate: - return TRUE; + return true; default: break; } @@ -1997,11 +1997,11 @@ void TQScrollView::setContentsPos( int x, int y ) if ( x < 0 ) x = 0; if ( y < 0 ) y = 0; // Choke signal handling while we update BOTH sliders. - d->signal_choke=TRUE; + d->signal_choke=true; moveContents( -x, -y ); d->vbar->setValue( y ); d->hbar->setValue( x ); - d->signal_choke=FALSE; + d->signal_choke=false; } /*! @@ -2094,7 +2094,7 @@ void TQScrollView::moveContents(int x, int y) // Small move clipper()->scroll(dx,dy); } - d->hideOrShowAll(this, TRUE ); + d->hideOrShowAll(this, true ); } /*! @@ -2146,7 +2146,7 @@ void TQScrollView::resizeContents( int w, int h ) d->vwidth = w; d->vheight = h; - d->scrollbar_timer.start( 0, TRUE ); + d->scrollbar_timer.start( 0, true ); if ( d->children.isEmpty() && d->policy == Default ) setResizePolicy( Manual ); @@ -2250,7 +2250,7 @@ void TQScrollView::updateContents() /*! \overload - Repaints the contents of rectangle \a r. If \a erase is TRUE the + Repaints the contents of rectangle \a r. If \a erase is true the background is cleared using the background color. */ void TQScrollView::repaintContents( const TQRect& r, bool erase ) @@ -2262,7 +2262,7 @@ void TQScrollView::repaintContents( const TQRect& r, bool erase ) /*! \overload - Repaints the contents. If \a erase is TRUE the background is + Repaints the contents. If \a erase is true the background is cleared using the background color. */ void TQScrollView::repaintContents( bool erase ) @@ -2274,7 +2274,7 @@ void TQScrollView::repaintContents( bool erase ) /*! Calls repaint() on a rectangle defined by \a x, \a y, \a w, \a h, translated appropriately. If the rectangle is not visible, nothing - is repainted. If \a erase is TRUE the background is cleared using + is repainted. If \a erase is true the background is cleared using the background color. \sa updateContents() @@ -2441,7 +2441,7 @@ void TQScrollView::changeFrameRect(const TQRect& r) fr = fr.unite( frameRect() ); fr = fr.subtract( cr ); if ( !fr.isEmpty() ) - TQApplication::postEvent( this, new TQPaintEvent( fr, FALSE ) ); + TQApplication::postEvent( this, new TQPaintEvent( fr, false ) ); } } } @@ -2560,7 +2560,7 @@ bool TQScrollView::focusNextPrevChild( bool next ) } candidate->setFocus(); - return TRUE; + return true; } @@ -2568,7 +2568,7 @@ bool TQScrollView::focusNextPrevChild( bool next ) /*! When a large numbers of child widgets are in a scrollview, especially if they are close together, the scrolling performance - can suffer greatly. If \a y is TRUE the scrollview will use an + can suffer greatly. If \a y is true the scrollview will use an extra widget to group child widgets. Note that you may only call enableClipper() prior to adding @@ -2599,8 +2599,8 @@ void TQScrollView::enableClipper(bool y) } /*! - Sets the scrollview to have a static background if \a y is TRUE, - or a scrolling background if \a y is FALSE. By default, the + Sets the scrollview to have a static background if \a y is true, + or a scrolling background if \a y is false. By default, the background is scrolling. Be aware that this mode is quite slow, as a full repaint of the @@ -2614,8 +2614,8 @@ void TQScrollView::setStaticBackground(bool y) } /*! - Returns TRUE if TQScrollView uses a static background; otherwise - returns FALSE. + Returns true if TQScrollView uses a static background; otherwise + returns false. \sa setStaticBackground() */ @@ -2797,10 +2797,10 @@ void TQScrollView::doDragAutoScroll() \property TQScrollView::dragAutoScroll \brief whether autoscrolling in drag move events is enabled - If this property is set to TRUE (the default), the TQScrollView + If this property is set to true (the default), the TQScrollView automatically scrolls the contents in drag move events if the user moves the cursor close to a border of the view. Of course this - works only if the viewport accepts drops. Specifying FALSE + works only if the viewport accepts drops. Specifying false disables this autoscroll feature. \warning Enabling this property might not be enough to @@ -2834,7 +2834,7 @@ void TQScrollView::setCachedSizeHint( const TQSize &sh ) const */ void TQScrollView::disableSizeHintCaching() { - d->use_cached_size_hint = FALSE; + d->use_cached_size_hint = false; } /*!\internal |
