From a30f5359f03c3017fa19a6770fab32d25d22cb87 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Mon, 15 Jul 2024 19:08:22 +0900 Subject: Rename graphics class nt* related files to equivalent tq* (part 1) Signed-off-by: Michele Calgaro --- doc/html/desktop-example.html | 82 +++++++++++++++++++++---------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'doc/html/desktop-example.html') diff --git a/doc/html/desktop-example.html b/doc/html/desktop-example.html index fffc382c8..64ccac086 100644 --- a/doc/html/desktop-example.html +++ b/doc/html/desktop-example.html @@ -34,7 +34,7 @@ body { background: #ffffff; color: black; }

The desktop demo contains three routines, each of which draws -something on the desktop. It does some nice stuff with TQPainter, +something on the desktop. It does some nice stuff with TQPainter, and also demonstrates how one can treat the desktop as a widget like any other.


@@ -51,7 +51,7 @@ any other. #include <tqimage.h> #include <tqbitmap.h> -#include <ntqpainter.h> +#include <tqpainter.h> #include <ntqapplication.h> #include <tqdropsite.h> #include <tqdragobject.h> @@ -109,12 +109,12 @@ void poly() yvel[i] = velocity(i); } - TQPainter paint; - paint.begin( d ); // start painting desktop + TQPainter paint; + paint.begin( d ); // start painting desktop for ( int ntimes=0; ntimes<2000; ntimes++ ) { - paint.setBrush( TQColor(kindaRand()%360, 180, 255, TQColor::Hsv) ); - paint.drawPolygon( a[head] ); + paint.setBrush( TQColor(kindaRand()%360, 180, 255, TQColor::Hsv) ); + paint.drawPolygon( a[head] ); if ( ++tail >= maxcurves ) tail = 0; @@ -147,7 +147,7 @@ void poly() a[head].setPoint( i, x, y ); } } - paint.end(); // painting done + paint.end(); // painting done delete[] a; } @@ -190,39 +190,39 @@ void rotate() // void generateStone( TQPixmap *pm, - const TQColor &c1, const TQColor &c2, const TQColor &c3 ) + const TQColor &c1, const TQColor &c2, const TQColor &c3 ) { - TQPainter p; + TQPainter p; TQPen p1 ( c1, 0 ); TQPen p2 ( c2, 0 ); TQPen p3 ( c3, 0 ); - p.begin( pm ); + p.begin( pm ); for( int i = 0 ; i < pm->width() ; i++ ) for( int j = 0 ; j < pm->height() ; j++ ) { int r = kindaRand(); if ( r < KINDA_RAND_MAX / 3 ) - p.setPen( p1 ); + p.setPen( p1 ); else if ( r < KINDA_RAND_MAX / 3 * 2 ) - p.setPen( p2 ); + p.setPen( p2 ); else - p.setPen( p3 ); - p.drawPoint( i,j ); + p.setPen( p3 ); + p.drawPoint( i,j ); } - p.end(); + p.end(); } -void drawShadeText( TQPainter *p, int x, int y, const char *text, - const TQColor &topColor, const TQColor &bottomColor, +void drawShadeText( TQPainter *p, int x, int y, const char *text, + const TQColor &topColor, const TQColor &bottomColor, int sw = 2 ) { - if ( !p->isActive() ) + if ( !p->isActive() ) return; - p->setPen( bottomColor ); - p->drawText( x+sw, y+sw, text ); - p->setPen( topColor ); - p->drawText( x, y, text ); + p->setPen( bottomColor ); + p->drawText( x+sw, y+sw, text ); + p->setPen( topColor ); + p->drawText( x, y, text ); } // NOTE: desktop drag/drop is experimental @@ -232,7 +232,7 @@ class DesktopWidget : public TQWidget, private TQDro public: DesktopWidget( const char *s, TQWidget *parent=0, const char *name=0 ); ~DesktopWidget(); - void paintEvent( TQPaintEvent * ); + void paintEvent( TQPaintEvent * ); void dragEnterEvent( TQDragEnterEvent *e ) { @@ -276,11 +276,11 @@ DesktopWidget::~DesktopWidget() delete pm; } -void DesktopWidget::paintEvent( TQPaintEvent * ) +void DesktopWidget::paintEvent( TQPaintEvent * ) { - TQColor c1 = backgroundColor(); - TQColor c2 = c1.light(104); - TQColor c3 = c1.dark(106); + TQColor c1 = backgroundColor(); + TQColor c2 = c1.light(104); + TQColor c3 = c1.dark(106); if ( !pm ) { pm = new TQPixmap( 64, 64 ); generateStone( pm, c1, c2, c3 ); @@ -292,10 +292,10 @@ void DesktopWidget::paintEvent( width()/2 - br.width()/2; int y = height()/2 - br.height()/2; offscreen.fill( this, x, y ); - TQPainter p; - p.begin( &offscreen ); + TQPainter p; + p.begin( &offscreen ); drawShadeText( &p, -br.x(), -br.y(), text, c2, c3, 3 ); - p.end(); + p.end(); bitBlt( this, x, y, &offscreen ); } @@ -311,16 +311,16 @@ void desktopText( const char *s = "Trolltech" ) { const int border = 20; - TQColor c1 = tqApp->palette().inactive().background(); - TQColor c2 = c1.light(104); - TQColor c3 = c1.dark(106); + TQColor c1 = tqApp->palette().inactive().background(); + TQColor c2 = c1.light(104); + TQColor c3 = c1.dark(106); TQPixmap pm(10,10); - TQPainter p; - p.begin( &pm ); - TQRect r = p.fontMetrics().boundingRect( s ); - p.end(); + TQPainter p; + p.begin( &pm ); + TQRect r = p.fontMetrics().boundingRect( s ); + p.end(); int appWidth = tqApp->desktop()->width(); int appHeight = tqApp->desktop()->height(); @@ -331,9 +331,9 @@ void desktopText( const char *s = "Trolltech" ) pm.resize( r.size() + TQSize( border*2, border*2 ) ); generateStone( &pm, c1, c2, c3 ); - p.begin( &pm ); + p.begin( &pm ); drawShadeText( &p, -r.x() + border, -r.y() + border, s, c2, c3 ); - p.end(); + p.end(); tqApp->desktop()->setBackgroundPixmap( pm ); } @@ -347,8 +347,8 @@ int main( int argc, char **argv ) TQApplication app( argc, argv ); if ( argc > 1 ) { - TQFont f( "charter", 96, TQFont::Black ); - f.setStyleHint( TQFont::Times ); + TQFont f( "charter", 96, TQFont::Black ); + f.setStyleHint( TQFont::Times ); app.setFont( f ); } -- cgit v1.2.3