Eneboo - Documentación para desarrolladores
src/qsa/src/custom/quickpaintwidget.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: quickpaintwidget.h  1.1.5   edited 2006-02-23T15:39:57$
00003 **
00004 ** Copyright (C) 2001-2006 Trolltech AS.  All rights reserved.
00005 **
00006 ** This file is part of the Qt Script for Applications framework (QSA).
00007 **
00008 ** This file may be distributed and/or modified under the terms of the
00009 ** GNU General Public License version 2 as published by the Free Software
00010 ** Foundation and appearing in the file LICENSE.GPL included in the
00011 ** packaging of this file.
00012 **
00013 ** Licensees holding a valid QSA Beta Evaluation Version license may use
00014 ** this file in accordance with the QSA Beta Evaluation Version License
00015 ** Agreement provided with the Software.
00016 **
00017 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00018 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00019 **
00020 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00021 **   information about QSA Commercial License Agreements.
00022 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00023 **
00024 ** Contact info@trolltech.com if any conditions of this licensing are
00025 ** not clear to you.
00026 **
00027 *****************************************************************************/
00028 
00029 #ifndef QUICKPAINTWIDGET_H
00030 #define QUICKPAINTWIDGET_H
00031 
00032 #include <qwidget.h>
00033 #include <qpixmap.h>
00034 
00035 class QPainter;
00036 class QTimer;
00037 
00038 class PaintWidget : public QWidget
00039 {
00040     Q_OBJECT
00041 
00042     Q_PROPERTY( QString penColor READ penColor WRITE setPenColor )
00043     Q_PROPERTY( QString brushColor READ brushColor WRITE setBrushColor )
00044     Q_PROPERTY( QString backgroundColor READ backgroundColorEx WRITE setBackgroundColor )
00045     Q_PROPERTY( QString fontFamily READ fontFamily WRITE setFontFamily )
00046     Q_PROPERTY( int pointSize READ pointSize WRITE setPointSize )
00047     Q_PROPERTY( int penWidth READ penWidth WRITE setPenWidth )
00048     Q_PROPERTY( QPixmap pixmap READ canvasPixmap )
00049     Q_PROPERTY( QPixmap erasePixmap READ erasePixmap WRITE setErasePixmap )
00050 
00051 public:
00052     PaintWidget( QWidget *parent=0 , const char *name=0 );
00053     ~PaintWidget();
00054 
00055     void setPenColor( const QString &color );
00056     void setBrushColor( const QString &color );
00057     void setBackgroundColor( const QString &color );
00058     void setPenWidth( int width );
00059     QString penColor() const;
00060     QString brushColor() const;
00061     QString backgroundColorEx() const;
00062     int penWidth() const;
00063 
00064     void setFontFamily( const QString &family );
00065     void setPointSize( int size );
00066     QString fontFamily() const;
00067     int pointSize() const;
00068 
00069     void setPaletteBackgroundColor( const QColor &color );
00070 
00071     QPixmap canvasPixmap() const { return buffer; }
00072     QPixmap erasePixmap() const { return ePixmap; }
00073     void setErasePixmap( const QPixmap &pm ) { ePixmap = pm; }
00074 
00075 public slots:
00076     void setWindow( int x, int y, int w, int h );
00077     void setClipRect( int x, int y, int w, int h );
00078     void drawPoint( int x, int y );
00079     void moveTo( int x, int y );
00080     void lineTo( int x, int y );
00081     void drawLine( int x1, int y1, int x2, int y2 );
00082     void drawRect( int x, int y, int w, int h );
00083     void drawRoundRect( int x, int y, int w, int h, int xRnd, int yRnd );
00084     void drawEllipse( int x, int y, int w, int h );
00085     void drawArc( int x, int y, int w, int h, int a, int alen );
00086     void drawPie( int x, int y, int w, int h, int a, int alen );
00087     void drawChord( int x, int y, int w, int h, int a, int alen );
00088     void fillRect( int x, int y, int w, int h );
00089     void eraseRect( int x, int y, int w, int h );
00090     void drawText( int x, int y, const QString &text );
00091     int drawText( int x, int y, int w, int h, const QString &text, bool wordWrap );
00092     void drawPixmap( int x, int y, const QPixmap &pixmap );
00093     int textWidth( const QString &text );
00094     int textHeight();
00095     int textAscent();
00096     int textDescent();
00097 
00098     void flush();
00099     void erase();
00100 
00101 signals:
00102     void updateContents();
00103 
00104 protected:
00105     void resizeEvent( QResizeEvent *e );
00106     void paintEvent( QPaintEvent *e );
00107 
00108 private:
00109     QTimer *updateTimer;
00110     QPixmap buffer;
00111     QPainter *painter;
00112     QRegion updateRegion;
00113     QPixmap ePixmap;
00114 
00115 };
00116 
00117 #endif
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'