Eneboo - Documentación para desarrolladores
src/qt/src/kernel/qregion.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qregion.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QRegion class
00005 **
00006 ** Created : 940514
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QREGION_H
00039 #define QREGION_H
00040 
00041 #ifndef QT_H
00042 #include "qshared.h"
00043 #include "qrect.h"
00044 #endif // QT_H
00045 
00046 #ifdef Q_WS_X11
00047 struct QRegionPrivate;
00048 #endif
00049 
00050 class Q_EXPORT QRegion
00051 {
00052 public:
00053     enum RegionType { Rectangle, Ellipse };
00054 
00055     QRegion();
00056     QRegion( int x, int y, int w, int h, RegionType = Rectangle );
00057     QRegion( const QRect &, RegionType = Rectangle );
00058     QRegion( const QPointArray &, bool winding=FALSE );
00059     QRegion( const QRegion & );
00060     QRegion( const QBitmap & );
00061    ~QRegion();
00062     QRegion &operator=( const QRegion & );
00063 
00064     bool    isNull()   const;
00065     bool    isEmpty()  const;
00066 
00067     bool    contains( const QPoint &p ) const;
00068     bool    contains( const QRect &r )  const;
00069 
00070     void    translate( int dx, int dy );
00071 
00072     QRegion unite( const QRegion & )    const;
00073     QRegion intersect( const QRegion &) const;
00074     QRegion subtract( const QRegion & ) const;
00075     QRegion eor( const QRegion & )      const;
00076 
00077     QRect   boundingRect() const;
00078     QMemArray<QRect> rects() const;
00079     void setRects( const QRect *, int );
00080 
00081     const QRegion operator|( const QRegion & ) const;
00082     const QRegion operator+( const QRegion & ) const;
00083     const QRegion operator&( const QRegion & ) const;
00084     const QRegion operator-( const QRegion & ) const;
00085     const QRegion operator^( const QRegion & ) const;
00086     QRegion& operator|=( const QRegion & );
00087     QRegion& operator+=( const QRegion & );
00088     QRegion& operator&=( const QRegion & );
00089     QRegion& operator-=( const QRegion & );
00090     QRegion& operator^=( const QRegion & );
00091 
00092     bool    operator==( const QRegion & )  const;
00093     bool    operator!=( const QRegion &r ) const
00094                         { return !(operator==(r)); }
00095 
00096 #if defined(Q_WS_WIN)
00097     HRGN    handle() const { return data->rgn; }
00098 #elif defined(Q_WS_X11)
00099     Region handle() const { if(!data->rgn) updateX11Region(); return data->rgn; }
00100 #elif defined(Q_WS_MAC)
00101     RgnHandle handle(bool require_rgn=FALSE) const;
00102 #elif defined(Q_WS_QWS)
00103     // QGfx_QWS needs this for region drawing
00104     void * handle() const { return data->rgn; }
00105 #endif
00106 
00107 #ifndef QT_NO_DATASTREAM
00108     friend Q_EXPORT QDataStream &operator<<( QDataStream &, const QRegion & );
00109     friend Q_EXPORT QDataStream &operator>>( QDataStream &, QRegion & );
00110 #endif
00111 private:
00112     QRegion( bool );
00113     QRegion copy() const;
00114     void    detach();
00115 #if defined(Q_WS_WIN)
00116     QRegion winCombine( const QRegion &, int ) const;
00117 #endif
00118 #if defined(Q_WS_X11)
00119     void updateX11Region() const;
00120     void *clipRectangles( int &num ) const;
00121     friend void *qt_getClipRects( const QRegion &, int & );
00122 #endif
00123     void    exec( const QByteArray &, int ver = 0 );
00124     struct QRegionData : public QShared {
00125 #if defined(Q_WS_WIN)
00126         HRGN   rgn;
00127 #elif defined(Q_WS_X11)
00128         Region rgn;
00129         void *xrectangles;
00130         QRegionPrivate *region;
00131 #elif defined(Q_WS_MAC)
00132         uint is_rect:1;
00133         QRect rect;
00134         RgnHandle rgn;
00135 #elif defined(Q_WS_QWS)
00136         void * rgn;
00137 #endif
00138         bool   is_null;
00139     } *data;
00140 #if defined(Q_WS_MAC)
00141     friend struct qt_mac_rgn_data_cache;
00142     friend QRegionData *qt_mac_get_rgn_data();
00143     friend void qt_mac_free_rgn_data(QRegionData *);
00144     void rectifyRegion();
00145 #elif defined(Q_WS_WIN)
00146     friend class QETWidget;
00147 #endif
00148 
00149 };
00150 
00151 
00152 #define QRGN_SETRECT            1               // region stream commands
00153 #define QRGN_SETELLIPSE         2               //  (these are internal)
00154 #define QRGN_SETPTARRAY_ALT     3
00155 #define QRGN_SETPTARRAY_WIND    4
00156 #define QRGN_TRANSLATE          5
00157 #define QRGN_OR                 6
00158 #define QRGN_AND                7
00159 #define QRGN_SUB                8
00160 #define QRGN_XOR                9
00161 #define QRGN_RECTS             10
00162 
00163 
00164 /*****************************************************************************
00165   QRegion stream functions
00166  *****************************************************************************/
00167 
00168 #ifndef QT_NO_DATASTREAM
00169 Q_EXPORT QDataStream &operator<<( QDataStream &, const QRegion & );
00170 Q_EXPORT QDataStream &operator>>( QDataStream &, QRegion & );
00171 #endif
00172 
00173 
00174 #endif // QREGION_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'